<!-- Memory table partial - refreshable via HTMX -->
<table class="w-full">
    <thead class="bg-dark-800 border-b border-gray-800">
        <tr>
            <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">ID</th>
            <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Type</th>
            <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Content</th>
            <th class="px-4 py-3 text-center text-xs font-medium text-gray-400 uppercase tracking-wider" title="When memory was created">Created</th>
            <th class="px-4 py-3 text-center text-xs font-medium text-gray-400 uppercase tracking-wider" title="Trust score (0-1)">Trust</th>
            <th class="px-4 py-3 text-center text-xs font-medium text-gray-400 uppercase tracking-wider" title="Used / Retrieved">Help</th>
            <th class="px-4 py-3 text-right text-xs font-medium text-gray-400 uppercase tracking-wider">Actions</th>
        </tr>
    </thead>
    <tbody class="divide-y divide-gray-800">
        {% if memories %}
            {% for memory in memories %}
                {% include "partials/memory_row.html" %}
            {% endfor %}
        {% else %}
            <tr>
                <td colspan="7" class="px-4 py-8 text-center text-gray-500">
                    {% if query %}
                        No memories match your search
                    {% else %}
                        No memories found
                    {% endif %}
                </td>
            </tr>
        {% endif %}
    </tbody>
</table>

<!-- Pagination -->
{% if total_pages > 1 %}
<div class="px-4 py-3 border-t border-gray-800 flex items-center justify-between">
    <div class="text-sm text-gray-400">
        Page {{ page }} of {{ total_pages }}
    </div>
    <div class="flex gap-2">
        {% if page > 1 %}
        <button hx-get="/api/memories/search?page={{ page - 1 }}"
                hx-target="#memory-table-body"
                hx-include="[name='query'], [name='type_filter']"
                class="px-3 py-1 text-sm bg-gray-700 hover:bg-gray-600 text-white rounded transition-colors">
            Previous
        </button>
        {% endif %}
        {% if page < total_pages %}
        <button hx-get="/api/memories/search?page={{ page + 1 }}"
                hx-target="#memory-table-body"
                hx-include="[name='query'], [name='type_filter']"
                class="px-3 py-1 text-sm bg-gray-700 hover:bg-gray-600 text-white rounded transition-colors">
            Next
        </button>
        {% endif %}
    </div>
</div>
{% endif %}
