{% load i18n admin_list %}

<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
    <thead class="bg-gray-50 dark:bg-gray-750">
        <tr>
            {% if result_hidden_fields %}
            <td class="hidden">{% for item in result_hidden_fields %}{{ item }}{% endfor %}</td>
            {% endif %}
            {% for header in result_headers %}
            <th scope="col"{{ header.class_attrib }}>
                <div class="px-6 py-3 text-left text-xs font-semibold text-gray-600 dark:text-gray-300 uppercase tracking-wider">
                {% if header.sortable %}
                    {% if header.sort_priority > 0 %}
                    <a href="{{ header.url_remove }}" class="inline-flex items-center hover:text-gray-900 dark:hover:text-white">
                        {{ header.text }}
                        {% if header.ascending %}
                        <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"/></svg>
                        {% else %}
                        <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
                        {% endif %}
                    </a>
                    {% else %}
                    <a href="{{ header.url_primary }}" class="hover:text-gray-900 dark:hover:text-white">
                        {{ header.text }}
                    </a>
                    {% endif %}
                {% else %}
                    {# Non-sortable: action checkbox header or plain text #}
                    {{ header.text }}
                {% endif %}
                </div>
            </th>
            {% endfor %}
        </tr>
    </thead>
    <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
        {% for result in results %}
        <tr class="hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors">
            {% for item in result %}
                {{ item }}
            {% endfor %}
        </tr>
        {% endfor %}
    </tbody>
</table>
