/* Univers category mobile nav: hidden by default (desktop) */
.univers-page .uv-cat-band .cat-current,
.univers-page .uv-cat-band .cat-mobile-bottom{ display:none; }
/* Mobile accordion panels: ensure closed panels are fully hidden without padding */
@media (max-width: 1200px) {
  .home .products-slider[hidden] {
    display: none !important;
    padding-top: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
  }
}
/* Responsive navigation and layout overrides (<=1200px)
   Centralizes mobile header and spacing rules. */

@media (max-width: 1200px) {
  /* Home first section: make cat-grid full-bleed when still inside container */
  .section.bg-light.no-padding > .container > .cat-grid{
    margin-left: -30px; margin-right: -30px;
    width: calc(100% + 60px);
  }

  .filters-advanced-toggle,
  .sep-dash{
    display:block;
  }

  /* Global container padding */
  .container, .container-960 {
    padding-left: 30px;
    padding-right: 30px;
  }

  /* Header base */
  .site-header { background:#fff; }

  /* Layout: logo | icons | burger */
  .header-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    min-height: 80px;
  }
  .logo { grid-column: 1; position: static; }
  .header-cta { grid-column: 2; justify-self: end; display:block !important; }
  .nav-toggle { grid-column: 3; }

  /* Hide full nav and original nav-middle; we'll move search into icons cluster via JS */
  .main-nav { display: none !important; }
  .nav-middle { display: none !important; }

  /* Mini header when scrolled: shrink header and logo */
  .site-header.logo-mini .header-grid { min-height: 50px; }
  .site-header.logo-mini .logo img { height: auto; width: auto; }

  /* Right-side icons cluster */
  .header-cta p { display: none !important; }
  .icons-cluster { display:flex; align-items:center; gap:10px; }
  .icons-cluster .search-bar { border:0; padding:0; margin:0; }
  .icons-cluster .search-bar input { display:none; }
  .icons-cluster .search-bar__icon { width:22px; height:22px; color:var(--color-primary); cursor:pointer; }
  .icons-cluster .user-icons { display:inline-flex; gap:10px; align-items:center; }
  .icons-cluster .search-trigger svg{ color: var(--color-primary); display:block; }
  /* Remove button appearance for mobile search trigger */
  .icons-cluster .search-trigger{
    background: transparent !important;
    border: 0 !important;
    padding: 0;
    margin: 0;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    -webkit-appearance: none;
            appearance: none;
  }

  /* Turn the login button into a profile icon on mobile */
  #loginTrigger {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 28px; height: 28px;
    padding: 0; margin: 0;
    border: 0; background: transparent;
    color: var(--color-primary);
    font-size: 0; line-height: 0; /* hide text */
    border-radius: 999px;
    cursor: pointer;
    position: relative;
  }
  #loginTrigger::before {
    content: "";
    display: block;
    width: 22px; height: 22px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4' fill='%23000'/%3E%3Cpath d='M4 20a8 8 0 0 1 16 0' fill='%23000'/%3E%3C/svg%3E") center/contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4' fill='%23000'/%3E%3Cpath d='M4 20a8 8 0 0 1 16 0' fill='%23000'/%3E%3C/svg%3E") center/contain no-repeat;
  }

  /* Burger: 3 span bars turning into a cross on open */
  .nav-toggle {
    display: inline-flex !important;
    position: relative;
    width: 44px; height: 44px;
    background: transparent !important;
    color: #000; border: 0;
    border-radius: 8px;
    align-items: center; justify-content: center;
    overflow: hidden;
  }
  .nav-toggle .bar{
    position: absolute;
    width: 24px; height: 2px;
    background: #000;
    transition: transform .2s ease, opacity .2s ease;
  }
  .nav-toggle .bar:nth-child(1){ transform: translateY(-8px); }
  .nav-toggle .bar:nth-child(2){ transform: translateY(0); }
  .nav-toggle .bar:nth-child(3){ transform: translateY(8px); }
  .nav-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

  /* Expanded (cross) */
  .nav-toggle[aria-expanded="true"] .bar:nth-child(1){ transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(2){ opacity: 0; transform: scaleX(0); }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(3){ transform: rotate(-45deg); }

  /* Drawer basic mobile spacing */
  .drawer { padding: 20px 30px 0; }
  #searchDrawer{ padding: 20px 30px; }
  /* Keep drawers visible on scroll: fixed under header */
  .drawer {
    position: fixed;
    left: 0; right: 0;
    top: var(--drawer-top, 100px);
    z-index: 14000;
    max-height: calc(100vh - var(--drawer-top, 100px));
    overflow: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    background: #dfeedc; /* requested drawer background */
    border-bottom: 0 !important; /* remove bottom border on drawer */
  }
  .drawer[hidden] { display: none !important; }
  .drawer.drawer--search { border-top:1px solid var(--color-border); }
  .drawer.drawer--search .search-bar{ padding:.5rem 0; background:white; }
  .drawer.drawer--search .search-bar input{ display:block; width:100%; }

  /* Hide top bars globally on mobile, but show when inside drawer */
  .top-bar { display:none !important; }
  .drawer .top-bar { display:flex !important; position: static !important; inset:auto !important; }
  .drawer .top-bar.is-fixed { position: static !important; }
  .drawer .drawer-topbars {
    display:flex; flex-direction:column; gap:0px; margin-top:10px;
    /* make top bars full-bleed within the drawer (remove 30px side padding) */
    margin-left: -30px; margin-right: -30px;
    width: calc(100% + 60px);
  }
  /* Remove container padding and width constraints inside top bars in drawer */
  .drawer .drawer-topbars .container{
    padding-left: 0 !important; padding-right: 0 !important; max-width: none; width: 100%;
  }
  /* Each top bar: left align and inner padding */
  .drawer .drawer-topbars .top-bar{
    text-align: left;
    padding: 10px 30px 10px 30px;
  }
  /* Stack message then phone/contact in column */
  .drawer .drawer-topbars .top-bar .container{
    display:flex; flex-direction: column; align-items: flex-start!important; gap:8px;
  }

  /* Drawer accordion navigation */
  .drawer .nav-list.vertical{ gap:0; }
  /* remove per-item separators */
  .drawer-btn{ display:flex; align-items:center; gap:8px; width:100%; background:none; border:0; padding:12px 0; cursor:pointer; color:inherit; text-align:left; font-weight:600; }
  /* Arrow icons before submenu items */
  .drawer-btn::before{
    content: "";
    display: inline-block;
    width: 12px; height: 12px;
    background: url('/assets/img/Fleche_gauche_PICTO.png') center/contain no-repeat;
    flex: 0 0 12px;
    transition: transform .2s ease;
  }
   .drawer-btn.is-open::before{
    transform: rotate(90deg);
   }
  .is-connected > .drawer-btn::before{
    background-image: url('/assets/img/Fleche_gauche_PICTO_vert.png');
  }
  /* Rotate arrow when expanded */
  .drawer li[aria-expanded="true"] > .drawer-btn::before{ transform: rotate(90deg); }
  /* removed arrow indicator */
  .drawer-sub{ display:none; padding-left:14px; padding-bottom:10px; }
  .drawer-link{ display:inline-block; padding:8px 12px; font-weight:600; color:#1d1f1e; text-decoration:none; }
  .drawer-link.produits{ background:var(--color-primary); color:#fff !important; border-radius:0; padding:5px 1em; }
  .drawer-link.produits:hover{ background:var(--color-primary-dark); }
  .is-connected > .drawer-btn .drawer-label{ color:var(--color-primary); }
  .drawer-btn .drawer-label{ color:#005d32; }
  /* Submenu links (from mega templates) */
  .drawer .mega-links a{ color:#005d32; text-decoration:none; display:block; padding:6px 0; }
  .drawer-commande{
    display: flex; flex-direction: column; gap:8px;
  }
  .drawer .mega-links a.btn,  .drawer .drawer-commande a.btn{ color:#fff; padding:8px; display:inline-block; }
  .drawer .mega-links a.btn.no-radius,  .drawer .drawer-commande a.btn.no-radius{ border-radius:0; }
  .drawer .mega-subhead{ margin:.5rem 0 .25rem; font-weight:700; color:#1d1f1e; }
  .drawer li[aria-expanded="true"] .drawer-sub{ display:block; }

  /* Footer: stack columns */
  .footer-nav-grid { grid-template-columns: 1fr !important; }
  .footer-bottom-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer-legal { flex-direction: row; align-items: flex-start; gap: 6px; }

  /* Produits: mobile filters behavior */
  .produits-page .filters-advanced { display: none; }
  .produits-page .filters-advanced.is-open { display: block; }
  .produits-page .filters-advanced-toggle { width: 100%; margin: 10px 0; padding: 10px 12px; border: 1px solid #005d32; background: #fff; font-weight: 700; color: #005d32; text-align: center; text-transform:uppercase; }
  .produits-page .filters-my { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
  .produits-page .filters-my .chk { margin: 0; }
  .produits-page .filters-my .sep-dash { white-space: nowrap; }
  .produits-page .product-main-row{width:100%;}

  /* Fiche produit: tabs accordion on mobile */
  .fiche-produit-page .fp-tablist{ display:flex; flex-direction:column; gap:0; }
  .fiche-produit-page .fp-tablist button{ width:100%; text-align:center; padding:12px 0; border:0; border-top:1px solid #c6c6c6; color:#c6c6c6; font-weight:700; }
  .fiche-produit-page .fp-tablist button.is-active{ color: var(--color-primary); }
  .fiche-produit-page .fp-tabpanel{ padding-top:8px; display:block !important; overflow:hidden; max-height:0; transition:max-height .25s ease; }

  .fiche-produit-page .fp-tablist button::before,
  .fiche-produit-page .fp-tablist button::after{ background-color: transparent !important; }
  .fiche-produit-page .fp-tablist button.is-active::before{ background: var(--color-primary) !important; }

  /* Mobile accordion arrow on tab buttons */
  .fiche-produit-page .fp-tablist button{ position: relative;}
  .fiche-produit-page .fp-tablist button::after{
    content: "";
    position: absolute;
    right: 12px; top: 50%;
    width: 14px; height: 14px;
    transform: translateY(-50%) rotate(90deg);
    background-image: url('/assets/img/Fleche_gauche_PICTO_vert.png') !important;
    background-repeat: no-repeat; background-position: center; background-size: contain;
    transition: transform .2s ease;
  }
  .fiche-produit-page .fp-tablist button[aria-expanded="true"]::after{
    transform: translateY(-50%) rotate(-90deg);
  }

  /* Fiche produit: center MEA blocks visually */
  .fiche-produit-page .fp-mea{ justify-content:center; }
  .fiche-produit-page .fp-mea-item{ margin-left:auto; margin-right:auto; align-items:center; }

  /* Home: tabs accordion on mobile (reuse fiche_produit visuals) */
  .home .ps-tabs{ display:flex; flex-direction:column; gap:0; }
  .home .ps-tabs .ps-tab{ width:100%; text-align:center; padding:12px 0; border:0; border-top:1px solid #c6c6c6; color:#c6c6c6; font-weight:700; }
  .home .ps-tabs .ps-tab.is-active{ color: var(--color-primary); }
  .home .products-slider{transition:max-height .25s ease;max-width: 100%;}
  .home .products-slider:not(.cat-wide-slider, .needs-slider, .usp-slider){ padding-top:8px; display:block !important; overflow:hidden; max-height:0; transition:max-height .25s ease;max-width: 100%; }

  .cat-wide-slider .ps-page, .cat-wide-slider, .usp-slider{padding:0;margin:0;}
  .cat-wide-slider .ps-prev{left:25px;background-image: url(/assets/img/Fleche_gauche_PICTO_blanc.svg);}
  .cat-wide-slider .ps-next{right:25px;background-image: url(/assets/img/Fleche_droite_PICTO_blanc.svg);}

  #catalogueModal .login-actions{
    flex-direction: column!important; gap: 8px;
  }
  /* CMS widgets: stack feature grid columns on mobile */
  .uv-feature-grid{ grid-template-columns: 1fr !important; }
  /* Aide page: invert order so image appears above text */
  body.aide-page .uv-feature-grid{ display:flex !important; flex-direction: column; }
  body.aide-page .uv-feature-grid .uv-feature-col.image{ order: 0; }
  body.aide-page .uv-feature-grid .uv-feature-col.text{ order: 1; }
  /* A propos page: force text above image (image below) */
  body.apropos-page .uv-feature-grid, body.univers-page .uv-feature-grid{ display:flex !important; flex-direction: column; }
  body.apropos-page .uv-feature-grid .uv-feature-col.text, body.univers-page .uv-feature-grid .uv-feature-col.text{ order: 0; }
  body.apropos-page .uv-feature-grid .uv-feature-col.image, body.univers-page .uv-feature-grid .uv-feature-col.image{ order: 1; }
  .contact-grid{ grid-template-columns: 1fr !important; }
  .cat-grid {grid-template-columns: 1fr !important;}
  .uv-cat-band .container{padding-left:0;padding: 0;}
  .catalog.catalog--reverse {grid-template-columns: 1fr !important;}

  .access-blocks .ab-grid{ flex-direction:column; gap:20px !important;}
  .institution-partners .ip-grid{ flex-direction:column; gap:20px !important;}

      .near-office-img {
        max-width: 100%;
        aspect-ratio: 16 / 10;
        object-fit: cover;
    }

  /* Ensure slider arrows stay vertically centered on mobile */
  .products-slider .ps-prev,
  .products-slider .ps-next{
    top:50% !important;
    bottom:auto !important;
    translate:0 -50% !important;
  }
      .login-col {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
    }
}

/* Footer: mobile simplified layout and accordion (<=900px) */
@media (max-width: 900px) {
  /* Univers pages: show current cat under header, others fixed at bottom */
  .univers-page .uv-cat-band .cat-grid{ display:none; }
  .univers-page .uv-cat-band .cat-current{ display:block; position: fixed; left:0; right:0; top: var(--fixed-header-offset, 0px); z-index: 800; }
  .univers-page .uv-cat-band .cat-current .cat-block{ display:block; width:100%; padding:12px 16px; text-align:center; font-size:18px; font-weight:700; }
  .univers-page .uv-cat-band .cat-mobile-bottom{ position: fixed; left:0; right:0; bottom:0; z-index: 800; display:flex; flex-direction:column; }
  .univers-page .uv-cat-band .cat-mobile-bottom .cat-block{ display:block; width:100%; padding:12px 16px; text-align:center; font-size:16px; font-weight:700; line-height:1.2; border-top:1px solid rgba(255,255,255,.25); }
  /* Ensure content isn't hidden behind bottom stack */
  body.univers-page{ padding-top: calc(var(--fixed-header-offset, 0px)); padding-bottom: 180px; }
  .site-footer.footer-mobile-simplified .footer-nav-grid{
    display: flex;
    gap: 20px;
    align-items: flex-start;
  }
  .site-footer.footer-mobile-simplified .footer-nav-grid > .f-brand{
    flex: 0 0 50%;
    max-width: 50%;
  }
  .site-footer.footer-mobile-simplified .footer-nav-grid > .f-mobile-menu{
    flex: 0 0 50%;
    max-width: 50%;
  }
  .site-footer.footer-mobile-simplified .footer-nav-grid > .f-col:not(.f-brand):not(.f-mobile-menu){
    display: none !important;
  }
  .f-mobile-menu .fm-head{
    width: 100%;
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
    font-weight: 700;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    cursor: pointer;
  }
  .f-mobile-menu .fm-links{
    list-style: none;
    margin: 0 0 10px 0;
    padding: 0;
  }
  .f-mobile-menu .fm-links a{
    display: block;
    padding: 2px 0;
    text-decoration: none;
    color: #005d32;
  }

  .conditions-cta-actions{
    flex-direction: column; gap:8px;
  }

  .fiche-produit-page .fp-thumbs{
    justify-content: center;
  }

  #fpMobileIntro h2{
    margin:15px 0!important;
  }
   #fpMobileIntro .fp-indications,
  #fpMobileIntro h4{
      margin:0 !important;
    }
}

/* Generic responsive tables: stack rows into cards (<=900px) */
@media (max-width: 900px) {
  /* Target known tables and an opt-in class */
  table.conditions-table,
  table.pourquoi-dayang-table,
  table.responsive-table {
    display: block;
    width: 100%;
    border: 0;
  }
  table.conditions-table thead,
  table.pourquoi-dayang-table thead,
  table.responsive-table thead {
    display: none;
  }
  table.conditions-table tbody,
  table.pourquoi-dayang-table tbody,
  table.responsive-table tbody {
    display: block;
    width: 100%;
  }
  table.conditions-table tr,
  table.pourquoi-dayang-table tr,
  table.responsive-table tr {
    display: block;
    width: 100%;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
  }
  table.conditions-table td,
  table.pourquoi-dayang-table td,
  table.responsive-table td,
  table.conditions-table th[scope="row"],
  table.pourquoi-dayang-table th[scope="row"],
  table.responsive-table th[scope="row"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border: 0;
  }
  /* Header label before each cell (filled via JS data-label) */
  table.conditions-table td::before,
  table.pourquoi-dayang-table td::before,
  table.responsive-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--color-primary);
    flex: 0 0 auto;
    margin-right: 8px;
  }
  /* First column (row header) appears as title */
  table.conditions-table th[scope="row"],
  table.pourquoi-dayang-table th[scope="row"],
  table.responsive-table th[scope="row"] {
    font-weight: 700;
    color: #1d1f1e;
    padding-top: 0;
  }

  .faq-cats{display: none;}
  .faq-qa.is-all .faq-cat-block:not(:first-child){padding-top:50px!important;}
}

/* Two-column conditions table mobile view */
@media (max-width: 900px) {
  .conditions-table-mobile{ display:block; }
  .conditions-table-mobile .ctm-title{
    margin: 10px 0 6px; font-weight:700; color: var(--color-primary-dark); font-size:20px;
  }
  .conditions-table-mobile .ctm-list{ list-style:none; margin:0 0 14px 0; padding:0; }
  .conditions-table-mobile .ctm-item{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:6px 0; border-bottom:1px solid #eee; }
  .conditions-table-mobile .ctm-item:last-child{ border-bottom:0; }
  .conditions-table-mobile .ctm-label{ font-weight:700; color:#000; font-size:14px; }
  .conditions-table-mobile .ctm-value{ text-align:left; color: var(--color-primary-dark); font-weight:700; }
  .conditions-table-mobile .ctm-value a{ color: inherit; }
  /* Hide label when empty to avoid stray gaps */
  .conditions-table-mobile .ctm-label:empty{ display:none; }
  /* Apply the same check icon as desktop pourquoi-dayang-table to mobile values */
  .conditions-table-mobile .ctm-value{ position:relative; padding-left:56px; }
  .conditions-table-mobile .ctm-value::before{
    content:""; position:absolute; left:10px; top:50%; width:35px; height:35px; transform:translateY(-50%);
    background:url('/assets/img/Check_valide_PICTO.svg') no-repeat center/contain;
  }
}
