<div class="min-h-screen container mx-auto px-4 py-8">
  <div class="max-w-2xl mx-auto">
    <div class="card bg-base-100 shadow-xl">
      <div class="card-body">
        <h2 class="card-title text-2xl mb-6">Account Settings</h2>

        <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: "space-y-6" }) do |f| %>
          <%= render "devise/shared/error_messages", resource: resource %>

          <div class="form-control">
            <%= f.label :email, class: "label" %>
            <%= f.email_field :email,
                              autofocus: true,
                              autocomplete: "email",
                              class: "input input-bordered w-full" %>
          </div>

          <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
            <div class="alert alert-info">
              <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
              <span>Currently waiting confirmation for: <%= resource.unconfirmed_email %></span>
            </div>
          <% end %>

          <div class="divider">Change Password</div>

          <div class="form-control">
            <%= f.label :password, class: "label" do %>
              <span class="label-text">New Password</span>
              <span class="label-text-alt text-gray-500">(leave blank if you don't want to change it)</span>
            <% end %>
            <%= f.password_field :password,
                                 autocomplete: "new-password",
                                 class: "input input-bordered w-full" %>
            <% if @minimum_password_length %>
              <label class="label">
                <span class="label-text-alt text-gray-500"><%= @minimum_password_length %> characters minimum</span>
              </label>
            <% end %>
          </div>

          <div class="form-control">
            <%= f.label :password_confirmation, "Confirm New Password", class: "label" %>
            <%= f.password_field :password_confirmation,
                                 autocomplete: "new-password",
                                 class: "input input-bordered w-full" %>
          </div>

          <div class="form-control">
            <%= f.label :current_password, class: "label" do %>
              <span class="label-text">Current Password</span>
              <span class="label-text-alt text-gray-500">(required to confirm changes)</span>
            <% end %>
            <%= f.password_field :current_password,
                                 autocomplete: "current-password",
                                 class: "input input-bordered w-full" %>
          </div>

          <div class="form-control mt-6">
            <%= f.submit "Update Account", class: "btn btn-primary" %>
          </div>
        <% end %>

        <div class="divider">Danger Zone</div>

        <div class="bg-error/10 rounded-box p-4">
          <h3 class="font-bold text-error mb-2">Delete Account</h3>
          <p class="text-sm mb-4">Once you delete your account, there is no going back. Please be certain.</p>
          <%= button_to registration_path(resource_name),
                        class: "btn btn-error",
                        data: {
                          confirm: "Are you sure?",
                          turbo_confirm: "Are you sure you want to delete your account? This action cannot be undone."
                        },
                        method: :delete do %>
            Delete Account
          <% end %>
        </div>

        <div class="text-center mt-6">
          <%= link_to "← Back", :back, class: "btn btn-ghost btn-sm" %>
        </div>
      </div>
    </div>
  </div>
</div>