{% extends "superadmin/base.html" %}

{% block superadmin_content %}
<div class="flex justify-between items-center mb-6">
    <div>
        <h2 style="font-size: var(--font-size-xl); font-weight: 700;">Platform Audit Logs</h2>
        <p class="text-sm text-secondary">Historical record of administrative and system operations</p>
    </div>
</div>

{% if logs %}
<div class="flex flex-col gap-3">
    {% for log in logs %}
    <div class="card card--flat">
        <div class="flex justify-between items-start mb-1">
            <div>
                <strong class="text-sm" style="color:var(--color-primary);">{{ log.action }}</strong>
                <span class="text-xs text-muted ml-2">by <strong>{% if log.user %}{{ log.user.username }}{% else %}System{% endif %}</strong></span>
            </div>
            <span class="text-xs text-muted">{{ log.created_at|date:"M d, Y H:i:s" }}</span>
        </div>
        <p class="text-xs text-secondary mt-1">Target: {{ log.target_model }} (ID: {{ log.target_id }})</p>
        {% if log.details %}
        <div class="text-xs font-mono text-muted mt-2 p-2" style="background:var(--color-bg-card);border-radius:var(--radius-sm);border:1px solid var(--color-border-light);">
            {{ log.details }}
        </div>
        {% endif %}
    </div>
    {% endfor %}
</div>
{% else %}
<div class="empty-state">
    <h3 class="empty-state__title">No audit log entries</h3>
</div>
{% endif %}
{% endblock %}
