<div class="mx-auto md:w-2/3 w-full">
  <% if alert = flash[:alert] %>
    <p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%= alert %></p>
  <% end %>

  <% if notice = flash[:notice] %>
    <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
  <% end %>

  <div class="bg-blue-50 border border-blue-200 rounded-lg p-6 mb-6">
    <h2 class="text-lg font-semibold text-blue-900 mb-2">🎉 Welcome to Baffle Hub!</h2>
    <p class="text-blue-700">
      This is the first time Baffle Hub is being set up. You'll create the initial administrator account
      that will have full access to manage users, projects, and system settings.
    </p>
  </div>

  <h1 class="font-bold text-3xl mb-6">Create Administrator Account</h1>

  <%= form_with(model: @user, url: registration_path, class: "contents") do |form| %>
    <% if @user.errors.any? %>
      <div class="bg-red-50 border border-red-200 rounded-lg p-4 mb-6">
        <h2 class="text-red-800 font-medium mb-2">
          <%= pluralize(@user.errors.count, "error") %> prohibited this account from being saved:
        </h2>
        <ul class="list-disc list-inside text-red-700">
          <% @user.errors.each do |error| %>
            <li><%= error.full_message %></li>
          <% end %>
        </ul>
      </div>
    <% end %>

    <div class="my-5">
      <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "email", placeholder: "Enter your email address", class: "block shadow-sm rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
    </div>

    <div class="my-5">
      <%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Create a password", minlength: 8, class: "block shadow-sm rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
      <p class="mt-1 text-sm text-gray-600">Minimum 8 characters</p>
    </div>

    <div class="my-5">
      <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Confirm your password", minlength: 8, class: "block shadow-sm rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
    </div>

    <div class="inline">
      <%= form.submit "Create Administrator Account", class: "rounded-md px-3.5 py-2.5 bg-green-600 hover:bg-green-500 text-white font-medium cursor-pointer" %>
    </div>
  <% end %>

  <div class="mt-8 text-sm text-gray-600">
    <p class="mb-2">This administrator account will have:</p>
    <ul class="list-disc list-inside space-y-1">
      <li>Full system access and control</li>
      <li>Ability to manage other users</li>
      <li>Permission to create and manage projects</li>
      <li>Access to system configuration and analytics</li>
    </ul>
  </div>
</div>
