<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
  <div class="mb-8">
    <h1 class="text-3xl font-bold text-gray-900">Edit Entry Request</h1>
    <p class="text-gray-600 mt-2">Modify the entry details before approval.</p>
  </div>

  <div class="bg-white rounded-lg shadow-md overflow-hidden">
    <%= form_with model: @entry, url: admin_request_path(@entry), method: :patch, class: "space-y-6" do |f| %>
      <% if @entry.errors.any? %>
        <div class="mx-6 mt-6 p-4 bg-red-50 border border-red-200 rounded-lg">
          <h3 class="font-semibold text-red-800 mb-2">Please fix the following errors:</h3>
          <ul class="list-disc list-inside text-red-700 text-sm space-y-1">
            <% @entry.errors.full_messages.each do |message| %>
              <li><%= message %></li>
            <% end %>
          </ul>
        </div>
      <% end %>

      <div class="px-6 pt-6 space-y-4">
        <%= render 'entries/form_fields', f: f %>

        <div class="border-t border-gray-200 pt-6">
          <h3 class="text-sm font-semibold text-gray-700 mb-2">Requester (Read-only)</h3>
          <div class="bg-gray-50 rounded-lg p-4 space-y-1 text-sm">
            <div><span class="font-medium">Name:</span> <%= @entry.requested_by&.name %></div>
            <div><span class="font-medium">Email:</span> <%= @entry.requested_by&.email %></div>
          </div>
        </div>
      </div>

      <div class="border-t border-gray-200 px-6 py-4 bg-gray-50 flex gap-3">
        <%= f.submit "Save Changes", class: "px-6 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg transition" %>
        <%= link_to "Cancel", admin_request_path(@entry), class: "px-6 py-2 bg-gray-200 hover:bg-gray-300 text-gray-800 font-semibold rounded-lg transition" %>
      </div>
    <% end %>
  </div>
</div>
