/* PRATINIUM — v121 mobile header stable centering
 * Corrige la régression v120 :
 * - état fermé du menu mobile inchangé et stable ;
 * - panneau Devise / Contactez-nous entièrement lisible ;
 * - panneau, CTA et recherche centrés sur le même axe ;
 * - aucune modification desktop.
 */
@media (min-width: 768px){
  #header .pf-mobile-extra-panel{ display:none!important; }
}

@media (max-width: 767.98px){
  #header,
  #header .header-nav,
  #header .header-top,
  #header .pf-header-top-global,
  #header .pf-header-top-global > .container,
  #header .header-top > .container{
    overflow: visible !important;
  }

  /* Neutralise les marges négatives Bootstrap responsables des décalages mobile. */
  #header .header-top .container,
  #header .pf-header-top-global > .container{
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    box-sizing: border-box !important;
  }

  #header .pf-header-row-global,
  #header .header-top .container .row.pf-header-row-global{
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
  }

  /* Logo : conserve l'amélioration mobile premium, sans décaler les blocs suivants. */
  #header #_desktop_logo,
  #header .pf-header-logo-global{
    order: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto 2px !important;
    padding: 0 !important;
    transform: none !important;
  }

  /* Panneau hamburger : dans le flux, centré, jamais en absolu. */
  #header .pf-mobile-extra-panel{
    order: 2 !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    float: none !important;
    clear: both !important;
    width: min(332px, calc(100vw - 36px)) !important;
    max-width: min(332px, calc(100vw - 36px)) !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    z-index: 4 !important;
  }

  #header .pf-mobile-extra-panel:not(.is-open){
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  #header .pf-mobile-extra-panel.is-open{
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    width: min(332px, calc(100vw - 36px)) !important;
    max-width: min(332px, calc(100vw - 36px)) !important;
    margin: 0 auto 0 !important;
    padding: 5px 12px 6px !important;
    text-align: center !important;
    background: rgba(255,255,255,.88) !important;
    border: 1px solid rgba(205,218,232,.72) !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 22px rgba(15,42,70,.07), inset 0 1px 0 rgba(255,255,255,.92) !important;
  }

  #header .pf-mobile-extra-panel.is-open,
  #header .pf-mobile-extra-panel.is-open *{
    color: #4c5563 !important;
    font-size: 13px !important;
    line-height: 1.18 !important;
    font-weight: 550 !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }

  #header .pf-mobile-extra-panel.is-open .pf-mobile-currency,
  #header .pf-mobile-extra-panel.is-open .pf-mobile-contact{
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
    text-align: center !important;
  }

  #header .pf-mobile-extra-panel.is-open .pf-mobile-contact a{
    color: #1c5fa8 !important;
    font-weight: 700 !important;
  }

  /* CTA + recherche : même largeur et même axe que le panneau ouvert. */
  #header .pf-header-centerline{
    order: 3 !important;
    position: static !important;
    float: none !important;
    clear: both !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    width: min(332px, calc(100vw - 36px)) !important;
    max-width: min(332px, calc(100vw - 36px)) !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
  }

  #header .pf-header-ctas,
  #header .pf-header-centerline .pf-header-ctas{
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #header .pf-header-centerline #search_widget,
  #header .pf-header-centerline #_desktop_search,
  #header .pf-header-centerline .search-widget,
  #header .pf-header-centerline #search_widget form,
  #header .pf-header-centerline #_desktop_search form,
  #header .pf-header-centerline .search-widget form{
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  /* On conserve la lisibilité v118 : pas de filtre trois traits dans la recherche mobile. */
  #header .pf-header-centerline #search_widget form::after,
  #header .pf-header-centerline #_desktop_search form::after,
  #header .pf-header-centerline .search-widget form::after{
    content: none !important;
    display: none !important;
  }

  #header .pf-header-centerline input[type="text"],
  #header .pf-header-centerline input[type="search"],
  #header .search-widget input[type="text"],
  #header .search-widget input[type="search"]{
    padding-right: 18px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  /* Empêche le wrapper PrestaShop caché de venir créer un décalage ou un chevauchement. */
  #header #mobile_top_menu_wrapper,
  #header #mobile_top_menu_wrapper .js-top-menu,
  #header #mobile_top_menu_wrapper .js-top-menu-bottom{
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
}
