/* ============================================================
 * DÉLICES SUPRÊMES — 08. Page panier (cart)
 * ============================================================
 * Layout cible (design source ECart) :
 *   ┌─────────────────────────────────────────────┐
 *   │ Votre panier (italic 64px)                  │
 *   │ N ARTICLES                                  │
 *   ├──────────────────────────┬──────────────────┤
 *   │ Liste articles 1.6fr     │ Récapitulatif    │
 *   │ ┌──┐ Nom        Total    │ Sous-total       │
 *   │ │  │ Format     22px     │ Livraison        │
 *   │ │  │ [- 1 +]             │ ────────         │
 *   │ │  │ Retirer             │ TOTAL    32px    │
 *   │ └──┘                     │ [progress 30k F] │
 *   │ ────────                 │ Passer commande  │
 *   │                          │ WhatsApp         │
 *   │                          │ Continuer achats │
 *   └──────────────────────────┴──────────────────┘
 * ========================================================= */

#cart {
    background: #ffffff;
    padding: var(--ds-space-10) 0 var(--ds-space-24);
}

#cart .container {
    max-width: var(--ds-container-max);
    padding-left: var(--ds-space-12);
    padding-right: var(--ds-space-12);
}

/* ─── Header (titre + eyebrow) ──────────────────────────── */
.cart-header {
    margin-bottom: var(--ds-space-10);
}

#cart h1,
.cart-title,
.cart-grid h1 {
    font-family: var(--ds-font-display);
    font-size: clamp(48px, 7vw, 64px);
    font-weight: 400;
    font-style: italic;
    line-height: 1.05;
    color: var(--ds-ink);
    margin: 0 0 var(--ds-space-2);
}

/* Sous-titre N ARTICLES */
.ds-cart-eyebrow {
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ds-gray-600);
    margin: 0;
    font-weight: 500;
}

/* ─── Layout 2 colonnes ─────────────────────────────────── */
#cart .cart-grid,
.cart-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: var(--ds-space-16);
    margin: 0;
    align-items: flex-start;
}

#cart .cart-grid-body,
.cart-grid-body {
    width: 100%;
    flex: none;
    max-width: none;
    padding: 0;
    margin: 0;
}

#cart .cart-grid-right,
.cart-grid-right {
    width: 100%;
    flex: none;
    max-width: none;
    padding: 0;
    margin: 0;
    position: sticky;
    top: 100px;
}

/* ─── Bloc liste articles ───────────────────────────────── */
.cart-overview,
.cart-items,
#cart-items,
.card.cart-container {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    margin: 0;
}

.cart-overview .cart-items,
.cart-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ─── Article individuel — layout flex ──────────────────── */
/*
 * On utilise display:flex (et non grid) parce que PrestaShop wrappe
 * le contenu dans .product-line-grid avec ses propres .col-md-* qui
 * cassent un grid externe. Flex laisse les colonnes Bootstrap se
 * comporter comme des items flex sans conflit.
 */
#cart .cart-item,
.cart-items .cart-item {
    display: flex;
    flex-direction: row;
    gap: var(--ds-space-4);
    align-items: flex-start;
    padding: var(--ds-space-6) var(--ds-space-4);
    margin: 0 0 8px;
    width: 100%;
    border-bottom: 1px solid var(--ds-gray-200);
    background: transparent;
}

#cart .cart-item:first-child {
    border-top: 1px solid var(--ds-gray-200);
}

/* Wrapper interne PS : flex enfant */
#cart .cart-item .product-line-grid,
.cart-items .cart-item .product-line-grid {
    display: flex;
    flex-direction: row;
    gap: var(--ds-space-4);
    flex: 1 1 auto;
    width: 100%;
    align-items: flex-start;
}

/* Reset des colonnes Bootstrap au sein du flex */
#cart .cart-item [class*="col-md-"],
#cart .cart-item [class*="col-xs-"],
.cart-items .cart-item [class*="col-md-"],
.cart-items .cart-item [class*="col-xs-"] {
    max-width: none;
    padding: 0;
    margin: 0;
}

/* Image produit : 120×120 fixe */
#cart .cart-item .product-line-grid-left {
    flex: 0 0 120px;
    width: 120px;
    height: 120px;
    background: var(--ds-coral-pale, #FBE6E8);
    overflow: hidden;
    padding: 0;
}

#cart .cart-item .product-line-grid-left img,
#cart .cart-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

/* Body : flex grow */
#cart .cart-item .product-line-grid-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
}

#cart .cart-item .product-line-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

#cart .cart-item .product-line-info a,
#cart .cart-item .product-line-info .product-line__title,
#cart .cart-item .product-line-info .label,
#cart .cart-item .label {
    font-family: var(--ds-font-display);
    font-size: 22px;
    font-style: italic;
    font-weight: 400;
    color: var(--ds-ink);
    text-decoration: none;
    line-height: 1.2;
    letter-spacing: -0.01em;
    display: block;
    margin-bottom: 4px;
    transition: color var(--ds-transition);
}

#cart .cart-item .product-line-info a:hover {
    color: var(--ds-coral);
}

#cart .cart-item .product-line-info.product-price {
    font-family: var(--ds-font-body);
    font-size: 13px;
    color: var(--ds-gray-600);
    font-style: normal;
    margin: 0;
}

/* Variantes affichées (size, color, etc.) */
#cart .cart-item .product-line-info-attribute {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ds-gray-600);
    margin-top: 8px;
    font-weight: 500;
}

/* ─── Colonne droite article : qty + total + remove ─────── */
#cart .cart-item .product-line-grid-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    min-width: 160px;
    width: 160px;
}

/* Quantité encadrée */
#cart .cart-item .qty,
#cart .cart-item .input-group,
.cart-line-product-actions .qty {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--ds-ink);
    background: #ffffff;
    margin: 0;
    height: 36px;
    width: max-content;
    border-radius: 0;
}

#cart .cart-item .input-group input,
#cart .cart-item .qty input[type="number"],
#cart .cart-item .input-qty {
    width: 50px;
    height: 100%;
    border: 0;
    background: transparent;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--ds-ink);
    box-shadow: none;
    -moz-appearance: textfield;
    padding: 0;
    border-radius: 0;
}

#cart .cart-item .input-group input::-webkit-outer-spin-button,
#cart .cart-item .input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#cart .cart-item .qty .input-group-btn,
#cart .cart-item .qty button,
#cart .cart-item .bootstrap-touchspin-up,
#cart .cart-item .bootstrap-touchspin-down,
#cart .cart-item .input-group-btn-vertical button {
    width: 32px;
    height: 100%;
    background: transparent;
    border: 0;
    border-left: 1px solid var(--ds-ink);
    color: var(--ds-ink);
    font-size: 14px;
    cursor: pointer;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

#cart .cart-item .bootstrap-touchspin-up:hover,
#cart .cart-item .bootstrap-touchspin-down:hover {
    background: var(--ds-cream);
}

#cart .cart-item .bootstrap-touchspin-up::before { content: "+"; }
#cart .cart-item .bootstrap-touchspin-down::before { content: "−"; }

#cart .cart-item .bootstrap-touchspin-up i,
#cart .cart-item .bootstrap-touchspin-down i,
#cart .cart-item .material-icons {
    display: none;
}

#cart .cart-item .input-group-btn-vertical {
    display: flex;
    flex-direction: row;
    width: auto;
    border: none;
}

/* Prix total ligne */
#cart .cart-item .product-price,
#cart .cart-item .price,
#cart .cart-item .product-line-grid-right .price,
#cart .cart-item .total,
.cart-line-product-total {
    font-family: var(--ds-font-display);
    font-size: 22px;
    font-style: italic;
    font-weight: 400;
    color: var(--ds-ink);
    text-align: right;
    white-space: nowrap;
}

#cart .cart-item .product-price strong {
    font-weight: 400;
}

/* Lien retirer */
#cart .cart-item .remove-from-cart,
#cart .cart-item a[data-link-action="remove-from-cart"],
#cart .cart-item .remove-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ds-gray-600);
    padding: 0;
    margin: 0;
    transition: color var(--ds-transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#cart .cart-item .remove-from-cart:hover {
    color: var(--ds-coral);
}

#cart .cart-item .remove-from-cart i,
#cart .cart-item .remove-from-cart .material-icons {
    display: none;
}

#cart .cart-item .remove-from-cart::before {
    content: "✕";
    font-size: 11px;
    margin-right: 4px;
}

/* ─── Panier vide ────────────────────────────────────────── */
.ds-cart-empty,
.cart-grid-body .cart-empty,
.no-items {
    background: var(--ds-cream);
    padding: 80px var(--ds-space-8);
    text-align: center;
    margin: var(--ds-space-8) 0;
}

.ds-cart-empty__message,
.cart-empty-message {
    font-family: var(--ds-font-display);
    font-size: 32px;
    font-style: italic;
    color: var(--ds-ink);
    margin-bottom: var(--ds-space-6);
}

.ds-cart-empty__lead {
    color: var(--ds-gray-600);
    margin-bottom: var(--ds-space-8);
}

.ds-cart-empty__cta {
    background: var(--ds-ink);
    color: #ffffff;
    padding: 16px var(--ds-space-8);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 0;
    display: inline-block;
}

.ds-cart-empty__cta:hover {
    background: var(--ds-coral);
    color: #ffffff;
    text-decoration: none;
}

/* ─── Bloc récapitulatif (sidebar) ──────────────────────── */
.cart-summary,
#cart-summary,
.cart-grid-right .card,
.card.cart-summary {
    background: var(--ds-cream);
    padding: var(--ds-space-8);
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.cart-summary .card-body,
.cart-summary > .card-block {
    padding: 0;
    background: transparent;
}

.cart-summary .h3,
.cart-summary h3,
.cart-summary .card-title,
.cart-summary .h4 {
    font-family: var(--ds-font-display);
    font-size: 24px;
    font-style: italic;
    font-weight: 400;
    color: var(--ds-ink);
    margin: 0 0 var(--ds-space-6);
    padding: 0;
    border: none;
    background: transparent;
}

/* Lignes du récapitulatif */
.cart-summary-line,
.cart-summary .cart-summary-line,
.cart-detailed-totals .cart-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border: none;
    font-size: 14px;
    color: var(--ds-ink);
}

.cart-summary-line .label,
.cart-summary-line span:first-child {
    color: var(--ds-ink);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.cart-summary-line .value,
.cart-summary-line span:last-child {
    color: var(--ds-ink);
    font-weight: 500;
}

/* Ligne livraison gratuite */
.cart-summary-line.cart-summary-shipping .value,
.free-shipping {
    color: var(--ds-coral);
    font-weight: 600;
}

/* Total */
.cart-summary-line.cart-total,
.cart-detailed-totals .cart-total,
.cart-summary-totals,
.cart-summary > .cart-summary-products + .cart-summary-line {
    margin-top: var(--ds-space-4);
    padding-top: var(--ds-space-4);
    border-top: 1px solid var(--ds-gray-200);
    align-items: baseline;
}

.cart-summary-line.cart-total .label,
.cart-total .label,
.cart-summary-totals .label {
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--ds-ink);
}

.cart-summary-line.cart-total .value,
.cart-total .value,
.cart-summary-totals .value {
    font-family: var(--ds-font-display);
    font-size: 32px;
    font-weight: 400;
    color: var(--ds-ink);
    line-height: 1;
}

/* ─── Barre de progression livraison gratuite ──────────── */
.ds-cart-progress {
    margin-top: var(--ds-space-4);
    padding: var(--ds-space-3);
    background: #ffffff;
    font-size: 12px;
    color: var(--ds-ink);
}

.ds-cart-progress strong {
    color: var(--ds-coral);
    font-weight: 600;
}

.ds-cart-progress__bar {
    height: 2px;
    background: var(--ds-gray-200);
    margin-top: 8px;
    overflow: hidden;
}

.ds-cart-progress__fill {
    height: 100%;
    background: var(--ds-coral);
    transition: width 0.4s ease-out;
}

.ds-cart-progress--unlocked {
    background: rgba(37, 211, 102, 0.1);
    border-left: 3px solid var(--ds-whatsapp);
}

.ds-cart-progress--unlocked strong {
    color: var(--ds-whatsapp);
}

/* ─── Bouton "Passer commande" ──────────────────────────── */
.cart-detailed-actions,
#cart-summary-product-list + .cart-detailed-actions,
.cart-summary .cart-detailed-actions,
.checkout.cart-detailed-actions {
    margin-top: var(--ds-space-6);
    padding: 0;
    background: transparent;
    text-align: center;
}

.cart-detailed-actions .btn-primary,
.cart-detailed-actions a[href*="checkout"],
.cart-detailed-actions button {
    background: var(--ds-coral);
    color: #ffffff;
    border: none;
    padding: 16px var(--ds-space-6);
    width: 100%;
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
    transition: filter var(--ds-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    box-shadow: none;
    text-shadow: none;
    line-height: 1;
}

.cart-detailed-actions .btn-primary:hover,
.cart-detailed-actions a[href*="checkout"]:hover {
    filter: brightness(0.9);
    color: #ffffff;
    text-decoration: none;
}

.cart-detailed-actions .btn-primary::after {
    content: " →";
}

/* CTA WhatsApp (injecté par cart-detailed-actions ou JS) */
.ds-cart-whatsapp {
    background: var(--ds-whatsapp);
    color: #ffffff;
    border: none;
    padding: 14px var(--ds-space-6);
    width: 100%;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
    transition: filter var(--ds-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    margin-top: 8px;
}

.ds-cart-whatsapp:hover {
    filter: brightness(0.92);
    color: #ffffff;
    text-decoration: none;
}

/* ─── Lien continuer mes achats ────────────────────────── */
.ds-cart-continue-link,
.cart-summary .continue-shopping,
.ds-cart-continue {
    background: transparent;
    border: none;
    color: var(--ds-gray-600);
    text-decoration: underline;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0;
    margin-top: var(--ds-space-6);
    display: inline-block;
}

.ds-cart-continue-link:hover,
.cart-summary .continue-shopping:hover {
    color: var(--ds-coral);
}

/* ─── Code promo ───────────────────────────────────────── */
.cart-summary-line.cart-summary-discount,
.discount-name,
.promo-code,
.block-promo {
    background: transparent;
    border: none;
    padding: var(--ds-space-3) 0;
    margin: var(--ds-space-3) 0 0;
    border-top: 1px solid var(--ds-gray-200);
}

.block-promo .promo-code-button,
.cart-summary .promo-code-button,
.promo-code-button a {
    background: transparent;
    border: none;
    color: var(--ds-coral);
    text-decoration: underline;
    padding: 0;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.block-promo .promo-input,
.promo-code form input[type="text"] {
    background: #ffffff;
    border: 1px solid var(--ds-gray-200);
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 0;
    width: 100%;
    flex: 1;
}

.block-promo .promo-input:focus {
    border-color: var(--ds-coral);
    outline: none;
}

.block-promo .promo-code form,
.promo-code form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.block-promo .promo-code form button,
.promo-code form button[type="submit"] {
    background: var(--ds-ink);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 0;
    white-space: nowrap;
}

.block-promo .promo-code form button:hover {
    background: var(--ds-coral);
}

/* Code promo : .promo-discounts est utilisé par PS pour la LISTE des codes
   disponibles (BIENVENUE10, MERCI10, VIP15...) — pas un seul code appliqué.
   Affichage en colonne pour éviter débordement horizontal sur mobile. */
.promo-discounts,
.cart-discount {
    background: rgba(244, 64, 81, 0.08);
    padding: var(--ds-space-3);
    margin-top: var(--ds-space-2);
    font-size: 13px;
    color: var(--ds-coral);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    list-style: none;
}

/* Chaque item promo en pleine largeur, icône à gauche, texte à droite */
.promo-discounts > li,
.promo-discounts .cart-summary-line {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 4px 0;
}

.promo-discounts > li::before,
.promo-discounts .cart-summary-line::before {
    content: "✓";
    background: var(--ds-coral);
    color: #ffffff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.promo-discounts .label,
.promo-discounts .value {
    text-align: left;
    line-height: 1.3;
}

.promo-discounts .label {
    font-weight: 600;
    flex-shrink: 0;
}

/* Discount unique appliqué (sans <li> — c'est .cart-discount) : icône inline */
.cart-discount::before {
    content: "✓";
    background: var(--ds-coral);
    color: #ffffff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── Mobile (≤767px) ──────────────────────────────────── */
@media (max-width: 767px) {
    #cart .cart-grid,
    .cart-grid {
        grid-template-columns: 1fr;
        gap: var(--ds-space-8);
    }

    #cart .cart-grid-right,
    .cart-grid-right {
        position: static;
    }

    #cart .cart-item,
    .cart-items .cart-item,
    #cart .cart-item .product-line-grid {
        flex-direction: column;
    }

    #cart .cart-item .product-line-grid-left {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
    }

    #cart .cart-item .product-line-grid-left img,
    #cart .cart-item .product-image img {
        width: 100%;
        max-width: 200px;
        height: auto;
        aspect-ratio: 1;
    }

    #cart .cart-item .product-line-grid-right {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-top: var(--ds-space-4);
        border-top: 1px solid var(--ds-gray-200);
    }
}
