<%= form_for @conn, Routes.membership_path(@conn, :transfer_ownership, @site.domain), [class: "max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>
  <h2 class="text-xl font-black dark:text-gray-100">Transfer ownership of <%= @site.domain %></h2>

  <p class="mt-4 max-w-2xl text-sm text-gray-500">
    Enter the email address of the new owner. We will contact them over email to
    offer them the ownership of <%= @site.domain %>. If they don't respond in 48
    hours, the request will expire automatically.
  </p>
  <p class="mt-4 max-w-2xl text-sm text-gray-500">
    Do note that a subscription plan is not transferred alongside the site. If
    they accept the transfer request, the new owner will need to have an active
    subscription. Your access will be downgraded to <b>admin</b> and any other
    member roles will stay the same.
  </p>

  <%= if @conn.assigns[:error] do %>
    <div class="text-red-500 text-xs italic mt-4"><%= @conn.assigns[:error] %></div>
  <% end %>

  <div class="my-6">
    <%= label f, :email, "Email address", class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %>
    <div class="mt-1 relative rounded-md shadow-sm">
      <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
        <svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path d="M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z" /><path d="M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z" /></svg>
      </div>
      <%= email_input(f, :email, class: "focus:ring-indigo-500 focus:border-indigo-500 block w-full rounded-md pl-10 sm:text-sm border-gray-300", placeholder: "john.doe@example.com", required: "true") %>
    </div>
    <%= error_tag f, :email %>
  </div>

  <div class="mt-6">
    <%= submit("Request transfer", class: "button w-full") %>
  </div>
<% end %>
