{% extends 'game/admin/base.html.twig' %}

{% block title %}Email Log — Admin{% endblock %}

{% block admin_body %}
    <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
        <h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Email Log</h1>
        <span style="color: #64748b; font-size: 0.9rem;">{{ logs|length }} entries</span>
    </div>

    <div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
        <table style="width: 100%; border-collapse: collapse; font-size: 0.9rem;">
            <thead>
                <tr style="background: #f1f5f9; border-bottom: 1px solid #e2e8f0;">
                    <th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">ID</th>
                    <th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">User</th>
                    <th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Email</th>
                    <th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Type</th>
                    <th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Sent at</th>
                </tr>
            </thead>
            <tbody>
                {% for log in logs %}
                    <tr style="border-bottom: 1px solid #f1f5f9;">
                        <td style="padding: 0.75rem 1rem; color: #94a3b8;">{{ log.id }}</td>
                        <td style="padding: 0.75rem 1rem; font-weight: 500; color: #0f172a;">{{ log.user.username }}</td>
                        <td style="padding: 0.75rem 1rem; color: #475569;">{{ log.user.email }}</td>
                        <td style="padding: 0.75rem 1rem;">
                            <span style="
                                display: inline-block;
                                padding: 0.2rem 0.6rem;
                                border-radius: 4px;
                                font-size: 0.75rem;
                                font-weight: 600;
                                background: #dbeafe;
                                color: #1e40af;
                            ">{{ log.emailIdentifier }}</span>
                        </td>
                        <td style="padding: 0.75rem 1rem; color: #475569;">{{ log.sentAt|date('Y-m-d H:i:s') }}</td>
                    </tr>
                {% else %}
                    <tr>
                        <td colspan="5" style="padding: 2rem; text-align: center; color: #94a3b8;">No emails logged yet.</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
