/* ================================================================
   DÉLICES SUPRÊMES — Responsive mobile (≤ 991px et ≤ 767px)
   ================================================================ */

@media (max-width: 1199px) {
  :root {
    --ds-pad-x: 32px;
  }
  .ds-categories__grid { grid-template-columns: 1.4fr 1fr 1fr; grid-template-rows: 240px 240px; }
}

@media (max-width: 991px) {
  :root {
    --ds-pad-x: 24px;
  }

  /* Hero passe en colonne unique */
  .ds-hero { padding: 40px var(--ds-pad-x) 64px; }
  .ds-hero__inner { grid-template-columns: 1fr; gap: 32px; }
  .ds-hero__photo { height: 360px; }
  .ds-hero__floating-card { display: none; }
  .ds-hero__ornament { font-size: 120px; right: 16px; top: 16px; opacity: 0.4; }
  .ds-hero__stats { flex-wrap: wrap; gap: 24px; }
  .ds-hero__title { font-size: clamp(40px, 9vw, 64px); }

  /* Bandeau réassurance 2x2 */
  .ds-trust-strip__grid { grid-template-columns: 1fr 1fr; gap: 24px 32px; }

  /* Catégories : 1 grande + 2x2 */
  .ds-categories { padding: 80px var(--ds-pad-x); }
  .ds-categories__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 320px 220px 220px;
  }
  .ds-category-card--feature { grid-row: span 1; grid-column: span 2; }
  .ds-section-header { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Best-sellers : 2 colonnes */
  .ds-bestsellers__grid { grid-template-columns: 1fr 1fr; gap: 24px; }

  /* Événements : 1 colonne */
  .ds-events-banner { padding: 80px var(--ds-pad-x); }
  .ds-events-banner__inner { grid-template-columns: 1fr; gap: 32px; }
  .ds-events-banner__photo { height: 280px; order: -1; }
  .ds-events-banner__bullets { grid-template-columns: 1fr; }

  /* Témoignages 1 colonne */
  .ds-testimonials__grid { grid-template-columns: 1fr; gap: 32px; }
  .ds-testimonials { padding: 80px var(--ds-pad-x); }

  /* Journal 1 colonne */
  .ds-journal__grid { grid-template-columns: 1fr; gap: 32px; }
  .ds-journal { padding: 0 var(--ds-pad-x) 80px; }

  /* ============== PAGES V2 — TABLET (≤ 991px) ============== */

  /* — Catalogue : sidebar passe au-dessus de la grille —
     Scope au row principal du wrapper (sinon header et sort-by-row sont catchés) */
  #category #wrapper > .container > .row,
  #search #wrapper > .container > .row,
  #products #wrapper > .container > .row,
  body#category #content-wrapper > .row,
  body#search #content-wrapper > .row,
  body#products #content-wrapper > .row {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  #category #js-product-list-header,
  .ds-category-header { margin-bottom: 32px; padding-bottom: 16px; }
  #category h1, .page-header h1 { font-size: 56px; }
  #products .products, .products, #category .products {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  /* — Page produit : passage en colonne unique avec thumbs en ligne — */
  #product .row.product-container,
  .product-container > .row {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  /* Reset du grid 2-cols (thumbs|cover) du desktop : sur mobile on empile,
     image principale pleine largeur, thumbs en bande horizontale dessous. */
  #product .images-container,
  #product .images-container.js-images-container,
  .product-images-grid {
    display: block;
  }
  #product .images-container > .product-cover {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    aspect-ratio: 1;
    margin: 0 0 12px;
  }
  #product .images-container > .js-qv-mask {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    height: auto;
  }
  #product .js-qv-mask .product-images,
  #product .js-qv-mask .js-qv-product-images,
  .product-images, .js-qv-product-images {
    flex-direction: row;
    overflow-x: auto;
    gap: 12px;
    position: static;
    padding-bottom: 8px;
  }
  #product .js-qv-mask .thumb-container,
  #product .js-qv-mask li,
  .product-images .thumb-container, .product-images li {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
  }
  #product h1, .product-title, .product-information h1 { font-size: 40px; }
  .ds-product-trust { grid-template-columns: 1fr; }
  .product-accessories .products,
  .featured-products .products { grid-template-columns: repeat(2, 1fr); }

  /* — Panier : sidebar récap passe en dessous —
     IMPORTANT : `minmax(0, 1fr)` (pas `1fr`) — sinon les enfants ayant
     du contenu wide (cart-item avec image+nom+price) forcent la colonne
     au-delà du viewport, débordement horizontal sur mobile. */
  #cart .cart-grid, .cart-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 32px;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  #cart .cart-grid > * {
    min-width: 0 !important;
  }
  #cart .cart-grid-right, .cart-grid-right {
    position: static;
  }
  /* Tous les enfants Bootstrap (col-xs-* col-lg-*) doivent prendre 100%
     du parent sur mobile (sinon ils overflow le viewport).
     Cause root : les classes Bootstrap col-xs-12 col-lg-8 mal interprétées
     dans le grid PS donnaient des largeurs > viewport. */
  #cart .cart-grid > [class*="col-"],
  #cart .cart-grid-body,
  #cart .cart-grid-right {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  /* Cart-item et tous ses enfants : pas de débordement */
  #cart .cart-item,
  #cart .cart-item .product-line-grid,
  #cart .cart-item [class*="col-"],
  #cart .cart-summary,
  #cart .cart-overview,
  #cart .cart-items {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  #cart h1, .cart-grid h1 { font-size: 48px; }

  /* — Checkout : sidebar récap au-dessus, 1 col — */
  .checkout-page-layout,
  #checkout > .container > .row {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  #checkout .col-md-4 { position: static; order: -1; }
  #checkout h1 { font-size: 40px; }
  .ds-checkout-stepper { gap: 12px; }
  .ds-checkout-stepper__connector { display: none; }

  /* — Compte : sidebar au-dessus du contenu — */
  .ds-account-layout,
  #my-account #content > .row,
  #history #content > .row,
  #identity #content > .row,
  #addresses #content > .row,
  #address #content > .row,
  #order-detail #content > .row {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .ds-account-hero h1, .ds-account-hero .h1 { font-size: 40px; }
  .ds-account-content h2, .account-page .page-title { font-size: 28px; }
  #addresses .addresses-footer, #addresses .addresses-list {
    grid-template-columns: 1fr;
  }
  .address-selector { grid-template-columns: 1fr; }
  #identity .form-fields > div, #identity .row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  :root {
    --ds-pad-x: var(--ds-pad-x-mobile);
  }

  body { font-size: 14px; }

  /* Header mobile compact */
  #header .header-top { padding: 14px var(--ds-pad-x); }
  #header .logo { max-height: 40px; }

  /* Menu hamburger sur mobile (Bootstrap classic gère le toggle) */
  #_desktop_top_menu { display: none; }
  #_mobile_top_menu, #_mobile_logo { display: block; }

  /* Hero ajusté */
  .ds-hero { padding: 32px var(--ds-pad-x) 48px; }
  .ds-hero__title { font-size: clamp(36px, 11vw, 56px); line-height: 1; }
  .ds-hero__sub { font-size: 15px; }
  .ds-hero__photo { height: 280px; }
  .ds-hero__ctas { flex-direction: column; gap: 8px; }
  .ds-hero__ctas .btn,
  .ds-hero__ctas .ds-btn-whatsapp { width: 100%; justify-content: center; }
  .ds-hero__stats { gap: 16px 24px; padding-top: 24px; margin-top: 32px; }
  .ds-hero__stat-value { font-size: 24px; }

  /* Catégories : 1 colonne tout */
  .ds-categories { padding: 56px var(--ds-pad-x); }
  .ds-categories__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 16px;
  }
  .ds-categories__grid > * { height: 200px; }
  .ds-category-card--feature { grid-column: span 1; height: 280px; }
  .ds-category-card--feature .ds-category-card__name { font-size: 28px; }

  .ds-section-title { font-size: 32px; }
  .ds-section-header { margin-bottom: 32px; padding-bottom: 16px; }

  /* Trust strip : 2x2 */
  .ds-trust-strip { padding: 24px var(--ds-pad-x); }
  .ds-trust-strip__grid { grid-template-columns: 1fr 1fr; gap: 16px; }

  /* Best-sellers en 1 colonne pleine largeur sur mobile */
  .ds-bestsellers { padding: 0 var(--ds-pad-x) 56px; }
  .ds-bestsellers__grid { grid-template-columns: 1fr 1fr; gap: 16px; }

  /* Événements */
  .ds-events-banner { padding: 56px var(--ds-pad-x); }
  .ds-events-banner h2 { font-size: 28px; }
  .ds-events-banner__photo { height: 200px; }

  /* Témoignages */
  .ds-testimonials { padding: 56px var(--ds-pad-x); }
  .ds-testimonials h2 { font-size: 28px; margin-bottom: 32px; }

  /* Journal */
  .ds-journal { padding: 0 var(--ds-pad-x) 56px; }
  .ds-journal h2 { font-size: 28px; margin-bottom: 24px; }
  .ds-journal-card__title { font-size: 18px; }

  /* Footer en colonne */
  .footer-container, #footer { padding: 56px 0 24px; }
  #footer .row > [class*="col-"] {
    margin-bottom: 32px;
  }

  /* Page produit */
  #product .product-container,
  body#product .row {
    padding: 16px var(--ds-pad-x) 56px;
  }
  #product h1.h1, #product .product-title { font-size: 28px; }
  #product .current-price, #product .product-price { font-size: 24px; }
  #product .product-add-to-cart { padding: 16px 0; margin: 16px 0; }
  #product .product-quantity { flex-wrap: wrap; }
  #product .add-to-cart { width: 100%; }

  /* Page catégorie */
  #category .page-header { margin-bottom: 32px; padding-bottom: 16px; }
  #category h1 { font-size: 36px; }
  #products .products, .products, #category .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .products-sort-order .select-title { min-width: 0; width: 100%; }
  #js-product-list-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .pagination .page-list li a, .pagination .page-list li span {
    min-width: 36px; height: 36px; font-size: 13px;
  }

  /* Panier — layout flex (cf. 08-ds-cart.css), pas grid */
  #cart { padding: 24px 0 40px; }
  #cart .container { padding-left: var(--ds-pad-x); padding-right: var(--ds-pad-x); }
  #cart h1, #cart .cart-title { font-size: clamp(32px, 9vw, 44px); margin: 0 0 4px; }
  .ds-cart-eyebrow { margin-bottom: 20px; font-size: 11px; }

  /* Article : empile vertical (image + body + actions) */
  #cart .cart-item,
  .cart-items .cart-item,
  #cart .cart-item .product-line-grid {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 16px 0 !important;
  }
  #cart .cart-item .product-line-grid-left {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 200px;
    height: auto !important;
    aspect-ratio: 1;
    margin: 0 auto;
  }
  #cart .cart-item .product-line-grid-left img,
  #cart .cart-item .product-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }
  #cart .cart-item .product-line-info a,
  #cart .cart-item .product-line-info .label,
  #cart .cart-item .label { font-size: 18px !important; }

  /* Colonne droite (qty + total + remove) : passe en row pleine largeur */
  #cart .cart-item .product-line-grid-right {
    flex-direction: row !important;
    width: 100% !important;
    min-width: 0 !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: 12px;
    border-top: 1px solid var(--ds-gray-200);
    flex-wrap: wrap;
    gap: 12px !important;
  }
  #cart .cart-item .product-price,
  #cart .cart-item .price,
  #cart .cart-item .total { font-size: 18px !important; text-align: right; }

  /* Récap sidebar : padding réduit, prend toute la largeur */
  .cart-summary { padding: 20px !important; }
  .cart-summary .h3, .cart-summary h3, .cart-summary .card-title { font-size: 20px; margin-bottom: 16px; }
  .cart-summary-line { font-size: 13px; }
  .cart-summary-line.cart-total .value,
  .cart-total .value { font-size: 26px !important; }

  /* Boutons CTA */
  .cart-detailed-actions .btn-primary,
  .cart-detailed-actions a[href*="checkout"],
  .cart-detailed-actions button { padding: 14px 12px; font-size: 11px; }
  .ds-cart-whatsapp { padding: 12px; font-size: 11px; }

  /* Progress bar livraison */
  .ds-cart-progress { font-size: 11px; padding: 10px; }

  /* Code promo : input + bouton wrap si trop étroit */
  .block-promo .promo-code form,
  .promo-code form { flex-wrap: wrap; }
  .block-promo .promo-input,
  .promo-code form input[type="text"] { min-width: 0; }

  /* État panier vide */
  .ds-cart-empty { padding: 56px 24px !important; }
  .ds-cart-empty__message { font-size: 24px !important; }
  .ds-cart-empty__cta { padding: 14px 20px !important; font-size: 11px !important; }

  /* Checkout */
  #checkout .step,
  #checkout section.checkout-step { padding: 20px 16px; }
  #checkout .step-title { font-size: 22px; }
  #checkout h1 { font-size: 32px; margin-bottom: 24px; }
  .ds-checkout-stepper {
    flex-direction: column;
    gap: 8px;
    padding-bottom: 16px;
    margin-bottom: 24px;
  }
  .ds-checkout-stepper__item { width: 100%; }
  .checkout-step .form-row,
  .checkout-step .row { grid-template-columns: 1fr; gap: 12px; }
  .delivery-option, .payment-option { padding: 14px; flex-wrap: wrap; }
  .delivery-option .carrier-price, .delivery-option .price { margin-left: 0; }
  .checkout-step .step-actions,
  .checkout-step .btn-group { flex-direction: column; }
  .checkout-step .back-to-step { width: 100%; }
  #order-confirmation { padding: 80px 24px; }
  #order-confirmation h1 { font-size: 40px; }
  .ds-confirmation-star, #order-confirmation .icon-success {
    width: 72px; height: 72px; font-size: 36px;
  }

  /* Compte */
  .ds-account-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 16px;
  }
  .ds-account-hero h1 { font-size: 32px; }
  .ds-account-content h2 { font-size: 24px; margin-bottom: 24px; }
  #history-table tbody tr,
  .history-row {
    grid-template-columns: 60px 1fr;
    gap: 12px;
    padding: 16px 0;
  }
  #history-table tbody tr > div:nth-child(3),
  .history-row > div:nth-child(3) { grid-column: 1 / -1; text-align: left; }
  .history-row__action { width: 100%; justify-content: center; }
  #addresses .address, .address-item { padding: 20px; }
  #addresses .address h4, .address-item h4, .address-alias { font-size: 18px; }
  .ds-tracking-step { padding-bottom: 20px; }
  .ds-tracking-step__title { font-size: 16px; }

  /* Auth */
  #authentication .login-form,
  #registration .register-form,
  #password form { padding: 32px 24px; }
  #authentication h1, #registration h1, #password h1 { font-size: 28px; }

  /* Bouton WhatsApp flottant existant — taille adaptée */
  #ds-wa-btn {
    width: 56px !important;
    height: 56px !important;
    bottom: 16px !important;
    right: 16px !important;
  }
}

@media (max-width: 480px) {
  .ds-bestsellers__grid { grid-template-columns: 1fr; gap: 24px; }
  .ds-trust-strip__grid { grid-template-columns: 1fr; }
  #products .products, .products, #category .products { grid-template-columns: 1fr; }
  .product-accessories .products,
  .featured-products .products { grid-template-columns: 1fr; }
  .ds-product-trust { gap: 12px; }
}

/* ============================================================
   MOBILE BURGER MENU — 2026-05-08
   ============================================================ */
@media (max-width: 991px) {
  /* Burger button .ds-burger DÉSACTIVÉ (2026-05-10) — l'Elementor
     mega-menu rouge est conservé comme menu mobile principal. */
  .ds-burger,
  .ds-burger__lines {
    display: none !important;
  }

  /* ========================================================
     Header mobile — réorganisation ergonomique (2026-05-10)
     Ordre cible : [Logo] (en haut) puis bandeau icônes :
     Search → Cart → Currency → Menu rouge
     ======================================================== */

  /* Le wrap elementor passe en flex (wrap) pour accepter `order` sur les widgets.
     wrap: wrap permet au bandeau réassurance de garder sa ligne pleine en haut. */
  .elementor-element-b6632d6 > .elementor-widget-wrap,
  .elementor-element-b6632d6 .elementor-widget-wrap {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-around !important;
    gap: 8px !important;
    width: 100% !important;
  }

  /* Bandeau réassurance "Depuis 2016 au Sénégal..." : ligne pleine en haut */
  .elementor-element-1d2947b {
    flex: 0 0 100% !important;
    order: 0 !important;
    width: 100% !important;
  }

  /* Order : Search (1) · Cart (2) · Currency (3) · Menu rouge (4) ;
     les autres widgets (bandeau réassurance) restent en flex order par défaut. */
  .elementor-element-e365e15 { order: 1 !important; }   /* Search */
  .elementor-element-fac7e6d { order: 2 !important; }   /* Cart */
  .elementor-element-d8aaaed { order: 3 !important; }   /* Currency € */
  .elementor-element-420139e { order: 4 !important; }   /* Menu rouge */

  /* Tailles harmonisées des icônes pour un bandeau régulier */
  .elementor-element-e365e15,
  .elementor-element-fac7e6d,
  .elementor-element-d8aaaed,
  .elementor-element-420139e {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  /* Logo : centré ou à gauche bien visible dans la grid */
  .ds-header-grid {
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    gap: 8px !important;
    padding: 8px var(--ds-pad-x);
  }
  .ds-header-actions {
    display: none !important; /* Vide après suppression du burger : on cache la cellule */
  }
  .ds-burger-DISABLED {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--ds-ink, #1D1D1F);
    border-radius: 0;
    cursor: pointer;
    padding: 0;
    margin-right: 12px;
  }
  .ds-burger__lines {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
  }
  .ds-burger__lines span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--ds-ink, #1D1D1F);
    transition: transform 0.25s, opacity 0.25s;
  }
  .ds-burger.is-active .ds-burger__lines span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .ds-burger.is-active .ds-burger__lines span:nth-child(2) {
    opacity: 0;
  }
  .ds-burger.is-active .ds-burger__lines span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Menu nav : caché par défaut sur mobile */
  .ds-header-menu {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999;
    background: var(--ds-white, #fff);
    overflow-y: auto;
    padding: 80px 24px 32px;
  }
  .ds-header-menu#_desktop_top_menu.is-open,
  .ds-header-menu.is-open,
  body.ds-menu-open .ds-header-menu#_desktop_top_menu,
  body.ds-menu-open .ds-header-menu {
    display: block !important;
  }
  .ds-header-menu ul.top-menu {
    flex-direction: column !important;
    gap: 0 !important;
    align-items: flex-start !important;
  }
  .ds-header-menu ul.top-menu > li {
    width: 100%;
    border-bottom: 1px solid var(--ds-gray-200, #E5E5E5);
    padding: 16px 0;
  }
  .ds-header-menu ul.top-menu > li > a {
    font-size: 18px !important;
    font-family: var(--ds-font-display, 'Playfair Display', serif);
    font-style: italic;
    color: var(--ds-ink, #1D1D1F);
    display: block;
    padding: 0 !important;
    border: 0 !important;
  }
  /*
   * Sous-menus ps_mainmenu : sur desktop ils sont .popover.collapse avec
   * animation CSS de fade-out (keyframe) qui force opacity:0/visibility:hidden
   * en permanence. Sur mobile, on neutralise animation + transition + tous
   * les états masqués pour les afficher inline sous leur parent.
   */
  .ds-header-menu .sub-menu,
  .ds-header-menu .popover.sub-menu,
  .ds-header-menu ul.top-menu .sub-menu,
  .ds-header-menu ul.top-menu .sub-menu.collapse {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    position: static !important;
    height: auto !important;
    width: 100% !important;
    transform: none !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 8px 0 0 16px !important;
    background: transparent !important;
  }

  /* Sous-items : style propre en liste verticale */
  .ds-header-menu .sub-menu li {
    list-style: none;
    padding: 8px 0;
    border-bottom: none;
  }
  .ds-header-menu .sub-menu li a {
    font-family: var(--ds-font-body);
    font-size: 14px;
    font-style: normal;
    color: var(--ds-gray-700, #444);
    text-decoration: none;
    padding: 4px 0 !important;
    display: block;
  }
  .ds-header-menu .sub-menu li a:hover {
    color: var(--ds-coral, #F44051);
  }

  /* Lock body scroll when menu open */
  body.ds-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}

/* Sur desktop, le burger est masqué */
@media (min-width: 992px) {
  .ds-burger { display: none !important; }
}
