<div class="p-4 bg-white block sm:flex items-center justify-between border-b border-gray-200 lg:mt-1.5">
  <div class="w-full mb-1">
    <div class="mb-4">
      <h1 class="text-xl font-semibold text-gray-900 sm:text-2xl">All Properties (Cross-Tenant)</h1>
      <p class="text-sm text-gray-600"><%= @pagy.count %> total properties</p>
    </div>
  </div>
</div>

<div class="flex flex-col">
  <div class="overflow-x-auto">
    <div class="inline-block min-w-full align-middle">
      <div class="overflow-hidden shadow">
        <table class="min-w-full divide-y divide-gray-200">
          <thead class="bg-gray-100">
            <tr>
              <th class="p-4 text-xs font-medium text-left text-gray-500 uppercase">Reference</th>
              <th class="p-4 text-xs font-medium text-left text-gray-500 uppercase">Title</th>
              <th class="p-4 text-xs font-medium text-left text-gray-500 uppercase">Website</th>
              <th class="p-4 text-xs font-medium text-left text-gray-500 uppercase">Created</th>
              <th class="p-4 text-xs font-medium text-left text-gray-500 uppercase">Actions</th>
            </tr>
          </thead>
          <tbody class="bg-white divide-y divide-gray-200">
            <% @props.each do |prop| %>
              <tr class="hover:bg-gray-100">
                <td class="p-4 text-sm font-medium text-gray-900">
                  <%= prop.reference || "N/A" %>
                </td>
                <td class="p-4 text-sm text-gray-900">
                  <%= link_to prop.title || "Property ##{prop.id}", tenant_admin_prop_path(prop), class: "text-blue-600 hover:underline" %>
                </td>
                <td class="p-4 text-sm text-gray-500">
                  <% if prop.respond_to?(:website) %>
                    <%= prop.website&.subdomain || "N/A" %>
                  <% else %>
                    N/A
                  <% end %>
                </td>
                <td class="p-4 text-sm text-gray-500">
                  <%= time_ago_in_words(prop.created_at) %> ago
                </td>
                <td class="p-4">
                  <%= link_to "View", tenant_admin_prop_path(prop), class: "inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white rounded-lg bg-blue-600 hover:bg-blue-700" %>
                </td>
              </tr>
            <% end %>
            <% if @props.empty? %>
              <tr>
                <td colspan="5" class="p-8 text-center text-gray-500">No properties found</td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
    </div>
  </div>

  <%# Pagination %>
  <div class="px-4 pb-4">
    <%= render 'shared/pagination', pagy: @pagy %>
  </div>
</div>
