{% extends 'email/base.html.twig' %}

{% block content %}
<table width="600" cellpadding="0" cellspacing="0" style="margin: 0 auto;">
    <tr>
        <td style="padding: 32px;">
            <h1 style="font-family: Arial, Helvetica, sans-serif; font-size: 22px; font-weight: 700; color: #111827; margin: 0 0 16px; line-height: 28px;">Rapport noms de domaine</h1>

            {% if message %}
                <p style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #16a34a; line-height: 22px; margin: 0;">
                    <strong>{{ message }}</strong>
                </p>
            {% else %}
                <p style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #374151; line-height: 22px; margin: 0 0 16px;">
                    {{ domains|length }} nom(s) de domaine arrivent a expiration dans les {{ thresholdDays }} prochains jours.
                </p>

                <table width="100%" cellpadding="0" cellspacing="0" style="margin: 24px 0; border-collapse: collapse;">
                    <thead>
                        <tr>
                            <th align="left" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">Domaine</th>
                            <th align="left" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">Client</th>
                            <th align="left" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">Expire</th>
                            <th align="right" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">Delai</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for d in domains %}
                            <tr>
                                <td style="font-family: monospace; font-size: 13px; font-weight: 700; color: #111827; padding: 10px 12px; border-bottom: 1px solid #f3f4f6;">
                                    {{ d.fqdn }}
                                    {% if d.registrar %}<br><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #9ca3af; font-weight: 400;">{{ d.registrar }}</span>{% endif %}
                                </td>
                                <td style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #374151; padding: 10px 12px; border-bottom: 1px solid #f3f4f6;">
                                    {{ d.customerName }}
                                    {% if d.customerEmail %}<br><span style="font-size: 10px; color: #9ca3af;">{{ d.customerEmail }}</span>{% endif %}
                                </td>
                                <td style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #374151; padding: 10px 12px; border-bottom: 1px solid #f3f4f6;">{{ d.expiredAt|date('d/m/Y') }}</td>
                                <td align="right" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: 700; color: {{ d.isExpired or d.daysLeft <= 7 ? '#dc2626' : '#f59e0b' }}; padding: 10px 12px; border-bottom: 1px solid #f3f4f6;">
                                    {% if d.isExpired %}
                                        Expire
                                    {% else %}
                                        {{ d.daysLeft }} j
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            {% endif %}

            <p style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #9ca3af; line-height: 18px; margin: 24px 0 0;">
                Rapport automatique genere par CRM E-Cosplay - {{ "now"|date('d/m/Y H:i') }}
            </p>
        </td>
    </tr>
</table>
{% endblock %}
