<!DOCTYPE html>
<html lang="{{ locale|default('fr') }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="x-apple-disable-message-reformatting">
    <title>{{ 'delivery.mail.subject_mail'|trans({'%company%': company, '%ref%': reference }, null, locale|default('fr')) }}</title>
    <style>
        body, table, td, a {
            -webkit-text-size-adjust: 100%;
            -ms-text-size-adjust: 100%;
        }

        table {
            border-collapse: collapse !important;
        }

        img {
            border: 0;
            height: auto;
            line-height: 100%;
            outline: none;
            text-decoration: none;
            -ms-interpolation-mode: bicubic;
        }

        @media only screen and (max-width: 640px) {
            .email-shell {
                padding: 20px 12px !important;
            }

            .email-card {
                width: 100% !important;
            }

            .email-header,
            .email-body {
                padding-left: 22px !important;
                padding-right: 22px !important;
            }

            .email-header {
                padding-top: 32px !important;
                padding-bottom: 20px !important;
            }

            .email-body {
                padding-top: 26px !important;
                padding-bottom: 32px !important;
                font-size: 17px !important;
                line-height: 1.75 !important;
            }

            .email-logo {
                max-width: 150px !important;
                margin-bottom: 20px !important;
            }

            .email-eyebrow {
                font-size: 10px !important;
                letter-spacing: 0.28em !important;
            }

            .email-title {
                font-size: 28px !important;
                line-height: 1.25 !important;
            }

            .email-button a {
                display: block !important;
                padding: 18px 24px !important;
                font-size: 13px !important;
            }

            .email-line-label,
            .email-line-value {
                display: block !important;
                width: 100% !important;
                padding-left: 0 !important;
                padding-right: 0 !important;
            }

            .email-line-value {
                padding-top: 6px !important;
            }
        }
    </style>
</head>
<body style="margin:0; padding:0; background:#f7f2ea; color:#201917; font-family:Georgia, 'Times New Roman', serif;">
{% set pricing = cart.pricing %}
{% set shipping = cart.cartShipping %}
{% set promos = cart.cartPromos ? cart.cartPromos.items : [] %}
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="width:100%; background:#f7f2ea; margin:0; padding:0;">
    <tr>
        <td class="email-shell" align="center" style="padding:32px 16px;">
            <table role="presentation" width="640" cellspacing="0" cellpadding="0" class="email-card" style="width:100%; max-width:640px; background:#ffffff;">
                <tr>
                    <td class="email-header" style="padding:40px 40px 24px; text-align:center; background:#fcfaf7;">
                        {% if contact and contact.image and contact.image.path %}
                            <img
                                src="{{ absolute_url(asset(contact.image.path)|imagine_filter('logo_email_filter')) }}"
                                alt="{{ contact.image.title ?: company }}"
                                width="180"
                                class="email-logo"
                                style="display:block; width:100%; max-width:180px; margin:0 auto 24px;"
                            >
                        {% endif %}
                        <div class="email-eyebrow" style="font-size:12px; letter-spacing:0.32em; text-transform:uppercase; color:#9d7c47;">{{ 'delivery.mail.eyebrow'|trans({}, null, locale|default('fr')) }}</div>
                        <h1 class="email-title" style="margin:18px 0 0; font-size:34px; line-height:1.2; font-weight:400; color:#201917;">{{ 'delivery.mail.heading'|trans({}, null, locale|default('fr')) }}</h1>
                    </td>
                </tr>
                <tr>
                    <td class="email-body" style="padding:32px 40px 40px; font-family:Arial, Helvetica, sans-serif; font-size:16px; line-height:1.75; color:#5d4b41;">
                        <p style="margin:0 0 24px;">{{ 'delivery.mail.intro'|trans({'%ref%': reference }, null, locale|default('fr'))|nl2br }}</p>

                        <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="width:100%; margin:0 0 24px; background:#fcfaf7;">
                            <tr>
                                <td style="padding:18px 22px;">
                                    <div style="margin:0 0 6px; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'delivery.mail.reference_label'|trans({}, null, locale|default('fr')) }}</div>
                                    <div style="font-size:20px; line-height:1.35; color:#201917;">{{ reference }}</div>
                                </td>
                            </tr>
                        </table>

                        <div style="margin:0 0 12px; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'delivery.mail.details_heading'|trans({}, null, locale|default('fr')) }}</div>
                        <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="width:100%; margin:0 0 24px; border-top:1px solid #eadfce; border-bottom:1px solid #eadfce;">
                            {% if pricing and pricing.lines is not empty %}
                                {% for line in pricing.lines %}
                                    {% set line_previous_ttc = line.isPromoGift ? line.totalTTC : (line.degressiveTTC > 0 ? line.netTTC + line.degressiveTTC : null) %}
                                    <tr>
                                        <td class="email-line-label" style="padding:16px 0; vertical-align:top; color:#201917;">
                                            <div>{{ line.productName }}</div>
                                            {% if line.typeName or line.unitLabel %}
                                                <div style="margin-top:4px; color:#5d4b41; font-size:14px;">
                                                    {{ line.typeName }}{% if line.unitLabel %}{% if line.typeName %} ({{ line.unitLabel }}){% else %}{{ line.unitLabel }}{% endif %}{% endif %}
                                                </div>
                                            {% endif %}
                                            {% if line.isPromoGift %}
                                                <div style="margin-top:6px; color:#9d7c47; font-size:14px;">{{ 'shop.offered'|trans({}, null, locale|default('fr')) }}</div>
                                            {% endif %}
                                            {% if line.degressiveTTC > 0 %}
                                                <div style="margin-top:6px; color:#9d7c47; font-size:14px;">
                                                    {{ 'shop.degressive'|trans({}, null, locale|default('fr')) }}:
                                                    -{{ line.degressiveTTC|price_format }} €
                                                </div>
                                            {% endif %}
                                        </td>
                                        <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; color:#201917; white-space:nowrap;">
                                            {{ 'delivery.mail.quantity_short'|trans({}, null, locale|default('fr')) }}{{ line.quantity }}
                                            <br>
                                            {% if line_previous_ttc is not null and line_previous_ttc > line.netTTC %}
                                                <span style="color:#5d4b41; text-decoration:line-through;">{{ line_previous_ttc|price_format }} €</span>
                                                <br>
                                            {% endif %}
                                            {% if line.isPromoGift %}
                                                {{ 'shop.offered'|trans({}, null, locale|default('fr')) }}
                                            {% else %}
                                                {{ line.netTTC|price_format }} €
                                            {% endif %}
                                        </td>
                                    </tr>
                                {% endfor %}
                            {% else %}
                                <tr>
                                    <td style="padding:16px 0; color:#5d4b41;">{{ 'delivery.mail.details_empty'|trans({}, null, locale|default('fr')) }}</td>
                                </tr>
                            {% endif %}
                        </table>

                        <div style="margin:0 0 12px; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'delivery.mail.summary_heading'|trans({}, null, locale|default('fr')) }}</div>
                        <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="width:100%; margin:0 0 24px; border-top:1px solid #eadfce; border-bottom:1px solid #eadfce;">
                            <tr>
                                <td class="email-line-label" style="padding:16px 0; vertical-align:top; color:#201917;">{{ 'checkout_design.subtotal'|trans({}, null, locale|default('fr')) }}</td>
                                <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; color:#201917;">
                                    {% if pricing %}
                                        {{ pricing.subtotalTTC|price_format }} €
                                    {% else %}
                                        -
                                    {% endif %}
                                </td>
                            </tr>
                            {% if pricing and pricing.degressiveTTC > 0 %}
                                <tr>
                                    <td class="email-line-label" style="padding:16px 0; vertical-align:top; color:#201917;">
                                        {{ (pricing.degressiveIsBottleOffered ? 'shop.of_which_bottle_offered' : 'shop.of_which_degressive')|trans({}, null, locale|default('fr')) }}
                                    </td>
                                    <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; color:#201917;">
                                        -{{ pricing.degressiveTTC|price_format }} €
                                    </td>
                                </tr>
                            {% endif %}
                            {% for promo in promos %}
                                {% if promo.discountItemsTTC > 0 %}
                                    <tr>
                                        <td class="email-line-label" style="padding:16px 0; vertical-align:top; color:#201917;">
                                            {{ 'shop.discount'|trans({}, null, locale|default('fr')) }}
                                            <div style="margin-top:4px; color:#5d4b41; font-size:14px;">
                                                {{ promo.code ?: 'Promo' }}{% if promo.percent is not null %} - {{ (promo.percent * 100)|number_format(0, ',', ' ') }}%{% endif %}
                                            </div>
                                        </td>
                                        <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; color:#201917;">
                                            -{{ promo.discountItemsTTC|price_format }} €
                                        </td>
                                    </tr>
                                {% endif %}
                            {% endfor %}
                            <tr>
                                <td class="email-line-label" style="padding:16px 0; vertical-align:top; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'delivery.mail.delivery_label'|trans({}, null, locale|default('fr')) }}</td>
                                <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; color:#201917;">
                                    {% if shipping is not null %}
                                        {{ shipping.amountTTC|price_format }} €
                                        {% if shipping.name %}
                                            <br>
                                            <span style="color:#5d4b41;">{{ shipping.name }}</span>
                                        {% endif %}
                                    {% else %}
                                        -
                                    {% endif %}
                                </td>
                            </tr>
                            {% for promo in promos %}
                                {% if promo.discountShippingTTC > 0 %}
                                    <tr>
                                        <td class="email-line-label" style="padding:16px 0; vertical-align:top; color:#201917;">
                                            {{ 'shop.discount_shipping'|trans({}, null, locale|default('fr')) }}
                                            <div style="margin-top:4px; color:#5d4b41; font-size:14px;">
                                                {{ promo.code ?: 'Promo' }}{% if promo.percent is not null %} - {{ (promo.percent * 100)|number_format(0, ',', ' ') }}%{% endif %}
                                            </div>
                                        </td>
                                        <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; color:#201917;">
                                            -{{ promo.discountShippingTTC|price_format }} €
                                        </td>
                                    </tr>
                                {% endif %}
                            {% endfor %}
                            <tr>
                                <td class="email-line-label" style="padding:16px 0; vertical-align:top; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'checkout_design.total_ttc'|trans({}, null, locale|default('fr')) }}</td>
                                <td class="email-line-value" align="right" style="padding:16px 0 16px 16px; vertical-align:top; font-size:20px; line-height:1.35; color:#201917;">
                                    {% if pricing %}
                                        {{ pricing.totalTTC|price_format }} €
                                    {% else %}
                                        -
                                    {% endif %}
                                </td>
                            </tr>
                        </table>

                        {% if cart.urlDeSuiviCarrier %}
                            <p style="margin:0 0 24px;">{{ 'delivery.mail.tracking_intro'|trans({}, null, locale|default('fr')) }}</p>

                            <table role="presentation" cellspacing="0" cellpadding="0" style="margin:0 auto 24px;">
                                <tr>
                                    <td class="email-button" align="center" style="background:#201917;">
                                        <a href="{{ cart.urlDeSuiviCarrier }}"
                                           style="display:inline-block; padding:16px 28px; color:#ffffff; text-decoration:none; font-size:12px; letter-spacing:0.22em; text-transform:uppercase; font-weight:600;">
                                            {{ 'delivery.mail.tracking_cta'|trans({}, null, locale|default('fr')) }}
                                        </a>
                                    </td>
                                </tr>
                            </table>

                            <p style="margin:0 0 12px;">{{ 'delivery.mail.tracking_fallback'|trans({}, null, locale|default('fr')) }}</p>
                            <p style="margin:0 0 24px; word-break:break-word;">
                                <a href="{{ cart.urlDeSuiviCarrier }}" style="color:#9d7c47;">{{ cart.urlDeSuiviCarrier }}</a>
                            </p>
                        {% endif %}

                        <p style="margin:0;">{{ 'delivery.mail.footer'|trans({'%company%': company }, null, locale|default('fr'))|nl2br }}</p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>
