{% extends 'mail/_layout.html.twig' %}

{% block mail_subject %}
    {{ (is_reminder ? 'marketing.review_request.mail.reminder_subject' : 'marketing.review_request.mail.subject')|trans({'%company%': company}, 'messages', locale|default('fr')) }}
{% endblock %}
{% block mail_eyebrow %}{{ company }}{% endblock %}
{% block mail_heading %}{{ email_title }}{% endblock %}

{% block mail_body %}
    <p style="margin:0 0 26px; text-align:center;">
        {{ (is_reminder ? 'marketing.review_request.mail.reminder_intro' : 'marketing.review_request.mail.intro')|trans({'%company%': company}, 'messages', locale|default('fr')) }}
    </p>

    <table role="presentation" width="100%" cellspacing="0" cellpadding="0" bgcolor="#fcf7f0" style="width:100%; margin:0 0 26px; border:1px solid #eadfce; background:#fcf7f0;">
        <tr>
            <td class="email-block" style="padding:22px 24px;">
                <div style="margin:0 0 14px; font-family:Georgia, 'Times New Roman', serif; font-size:22px; line-height:1.35; color:#3f2f24;">
                    {{ 'marketing.review_request.mail.order_heading'|trans({'%reference%': cart.token ?: cart.id}, 'messages', locale|default('fr')) }}
                </div>
                <div style="margin:0 0 10px; font-size:11px; letter-spacing:0.16em; text-transform:uppercase; color:#8a6a2f;">
                    {{ 'marketing.review_request.mail.products_heading'|trans({}, 'messages', locale|default('fr')) }}
                </div>
                <ul style="margin:0; padding:0 0 0 20px; color:#6e5848;">
                    {% for item in cart.items %}
                        {% set variant = item.variant %}
                        {% set product_name = variant ? (variant.fullName ?: (variant.product ? variant.product.fullName : '')) : '' %}
                        {% if product_name %}
                            <li style="margin:0 0 6px; font-size:14px; line-height:1.55;">
                                {{ 'marketing.review_request.mail.product_line'|trans({
                                    '%quantity%': item.quantity,
                                    '%product%': product_name,
                                }, 'messages', locale|default('fr')) }}
                            </li>
                        {% endif %}
                    {% endfor %}
                </ul>
            </td>
        </tr>
    </table>

    <table role="presentation" cellspacing="0" cellpadding="0" align="center" style="margin:0 auto 24px;">
        <tr>
            <td class="email-button" align="center" bgcolor="#3f2f24" style="background:#3f2f24;">
                <a href="{{ review_url }}" style="display:inline-block; padding:16px 28px; color:#ffffff; font-size:12px; font-weight:700; letter-spacing:0.12em; text-decoration:none; text-transform:uppercase;">
                    {{ 'marketing.review_request.mail.button'|trans({}, 'messages', locale|default('fr')) }}
                </a>
            </td>
        </tr>
    </table>

    {% if google_business_review_url %}
        <p style="margin:0 0 16px; text-align:center;">
            {{ 'marketing.review_request.mail.google_intro'|trans({}, 'messages', locale|default('fr')) }}
        </p>
        <table role="presentation" cellspacing="0" cellpadding="0" align="center" style="margin:0 auto 26px;">
            <tr>
                <td class="email-button" align="center" bgcolor="#fffdf9" style="background:#fffdf9; border:1px solid #3f2f24;">
                    <a href="{{ google_business_review_url }}" style="display:inline-block; padding:14px 24px; color:#3f2f24; font-size:12px; font-weight:700; letter-spacing:0.1em; text-decoration:none; text-transform:uppercase;">
                        {{ 'marketing.review_request.mail.google_button'|trans({}, 'messages', locale|default('fr')) }}
                    </a>
                </td>
            </tr>
        </table>
    {% endif %}

    <p style="margin:0; text-align:center; font-size:13px; color:#8c7564;">
        {{ 'marketing.review_request.mail.expiry'|trans({'%date%': expires_at|date('d/m/Y')}, 'messages', locale|default('fr')) }}
    </p>
{% endblock %}

{% block mail_footer_extra %}
    <a href="{{ review_policy_url }}" style="color:#6e5848; text-decoration:underline;">
        {{ 'marketing.review_request.mail.policy_link'|trans({}, 'messages', locale|default('fr')) }}
    </a>
    <br>
    <a href="{{ opt_out_url }}" style="color:#6e5848; text-decoration:underline;">
        {{ 'marketing.review_request.mail.opt_out_link'|trans({}, 'messages', locale|default('fr')) }}
    </a>
{% endblock %}
