<!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>{{ 'order.admin_mail.heading'|trans({}, 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-subtitle {
                font-size: 20px !important;
                line-height: 1.35 !important;
            }
        }
    </style>
</head>
<body style="margin:0; padding:0; background:#f7f2ea; color:#201917; font-family:Georgia, 'Times New Roman', serif;">
{% set payment_method = cart.paymentMethod ?: (cart.cartCheckout ? cart.cartCheckout.paymentMethod : null) %}
{% set payment_configuration = payment_method ? payment_method.configuration : {} %}
{% set configured_name = payment_configuration['name'] ?? null %}
{% set order_comment = cart.comment|default('')|trim %}
{% if configured_name %}
    {% set payment_method_label = configured_name %}
{% elseif payment_method %}
    {% set payment_method_label = payment_method.paymentOnline
        ? 'checkout_design.payment_card'|trans({}, null, locale|default('fr'))
        : (payment_method.method in ['bankTransfert', 'banktransfert']
            ? 'checkout_design.payment_banktransfert'|trans({}, null, locale|default('fr'))
            : 'checkout_design.payment_check'|trans({}, null, locale|default('fr'))) %}
{% else %}
    {% set payment_method_label = null %}
{% endif %}
<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;">{{ 'order.admin_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;">{{ 'order.admin_mail.heading'|trans({}, null, locale|default('fr')) }}</h1>
                        {% if payment_method_label %}
                            <div style="margin:16px 0 0; font-size:11px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">
                                {{ 'order.admin_mail.payment_label'|trans({}, null, locale|default('fr')) }}
                            </div>
                            <div class="email-subtitle" style="margin:8px 0 0; font-family:Arial, Helvetica, sans-serif; font-size:22px; line-height:1.35; color:#201917;">
                                {{ payment_method_label }}
                            </div>
                        {% endif %}
                    </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 16px;">{{ 'order.admin_mail.intro'|trans({'%company%': company }, null, locale|default('fr')) }}</p>
                        <p style="margin:0 0 24px;">{{ 'order.admin_mail.customer_intro'|trans({'%firstname%': cart.firstname|default(''), '%lastname%': cart.lastname|default('') }, null, locale|default('fr')) }}</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;">{{ 'order.admin_mail.reference_label'|trans({}, null, locale|default('fr')) }}</div>
                                    <div style="font-size:20px; line-height:1.35; color:#201917;">{{ reference }}</div>
                                    <div style="margin:16px 0 6px; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'shop.total'|trans({}, null, locale|default('fr')) }}</div>
                                    <div style="font-size:20px; line-height:1.35; color:#201917;">{% if cart.total is not null %}{{ cart.total|price_format }} €{% else %}-{% endif %}</div>
                                </td>
                            </tr>
                        </table>

                        <p style="margin:0 0 16px;">{{ attachment_notice }}</p>
                        {% if order_comment != '' %}
                            <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="width:100%; margin:0 0 24px; background:#fcfaf7; border:1px solid #eadfce;">
                                <tr>
                                    <td style="padding:18px 22px;">
                                        <div style="margin:0 0 10px; font-size:12px; letter-spacing:0.18em; text-transform:uppercase; color:#9d7c47;">{{ 'checkout_design.info_title'|trans({}, null, locale|default('fr')) }}</div>
                                        <div style="font-size:15px; line-height:1.7; color:#5d4b41;">{{ order_comment|nl2br }}</div>
                                    </td>
                                </tr>
                            </table>
                        {% endif %}
                        <p style="margin:0;">{{ company }}</p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>
