/* =========================================================================
   BuroCash — Barre de navigation mobile « style application »
   Visible sous 992px uniquement. Jetons repris de la charte du site :
   #1b1b1b encre, #6b6b6b secondaire, #ececec filets, #f3d300 jaune de marque.
   ========================================================================= */

.bmnav-sprite{
  position:absolute;
  width:0;
  height:0;
  overflow:hidden;
}

.bmnav,
.bmnav-cat,
.bmnav-top-wrap{
  display:none;
}

@media (max-width: 991.98px){

  :root{
    --bmnav-h: 58px;
    --bmnav-top-h: 50px;     /* barre de recherche du haut */
    --bmnav-pills-h: 38px;   /* ligne de pastilles sous la recherche */
    --bmnav-kb: 0px;   /* écart clavier, mesuré en JS */
    --bmnav-ink: #1b1b1b;
    --bmnav-muted: #6b6b6b;
    --bmnav-line: #ececec;
    --bmnav-accent: #f3d300;
    --bmnav-sage-bg: #e9efe4;
    --bmnav-sage-ink: #4c6b43;
  }

  /* ---- Espace réservé sous le contenu : le pied de page reste atteignable */
  body:has(#bmnav),
  body.bmnav-on{
    padding-bottom: calc(var(--bmnav-h) + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ---- Espace réservé au-dessus : la barre de recherche + pastilles
     remplace le header Creative Elements, vidé sur mobile (custom.css). */
  body:has(#bmnav-top-wrap),
  body.bmnav-on{
    padding-top: calc(var(--bmnav-top-h) + var(--bmnav-pills-h) + env(safe-area-inset-top, 0px)) !important;
  }

  /* ---- La barre ------------------------------------------------------- */
  .bmnav{
    position:fixed;
    left:0;
    right:0;
    bottom: var(--bmnav-kb, 0px);
    z-index:1056;   /* au-dessus des surcouches : la barre reste nette */
    display:flex;
    align-items:stretch;
    height: calc(var(--bmnav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background:#fff;
    border-top:1px solid var(--bmnav-line);
    box-shadow:0 -2px 10px rgba(0,0,0,.05);
    transform:translateY(0);
    transition:transform .22s ease;
  }

  /* Repliée : méga-menu ouvert, ou clavier virtuel à l'écran */
  .bmnav.is-hidden{
    transform: translateY(calc(100% + 2px));
  }

  .bmnav__item{
    flex:1 1 0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    padding:6px 2px 4px;
    position:relative;
    color:var(--bmnav-muted);
    text-decoration:none;
    font-family:inherit;
    -webkit-tap-highlight-color:transparent;
  }

  .bmnav__item:hover,
  .bmnav__item:focus,
  .bmnav__item:visited{
    color:var(--bmnav-muted);
    text-decoration:none;
  }

  .bmnav__item:active{
    background:#f4f4f5;
  }

  .bmnav__item.is-active,
  .bmnav__item.is-active:hover,
  .bmnav__item.is-active:focus{
    color:var(--bmnav-ink);
  }

  /* Filet jaune au-dessus de l'onglet courant */
  .bmnav__item.is-active::before{
    content:"";
    position:absolute;
    top:-1px;
    left:50%;
    transform:translateX(-50%);
    width:28px;
    height:3px;
    border-radius:0 0 3px 3px;
    background:var(--bmnav-accent);
  }

  .bmnav__icon{
    position:relative;
    display:block;
    width:24px;
    height:24px;
  }

  .bmnav__icon svg{
    width:24px;
    height:24px;
    display:block;
    fill:none;
    stroke:currentColor;
    stroke-width:1.6;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .bmnav__item.is-active .bmnav__icon svg{
    stroke-width:1.9;
  }

  /* Onglet "Accueil" : icône remplacée par le logomark de marque (repère
     d'identité au même endroit qu'une icône maison sur une app installée).
     Le lien et le libellé restent inchangés — seul le glyphe visuel change. */
  .bmnav__item[data-bmnav-tab="home"] .bmnav__icon svg{
    display:none;
  }

  .bmnav__item[data-bmnav-tab="home"] .bmnav__icon::before{
    content:"B";
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:7px;
    background:var(--bmnav-ink);
    color:var(--bmnav-accent);
    font-family:inherit;
    font-size:12px;
    font-weight:800;
    line-height:1;
  }

  .bmnav__label{
    font-size:10.5px;
    line-height:1.1;
    letter-spacing:.01em;
    white-space:nowrap;
  }

  .bmnav__item.is-active .bmnav__label{
    font-weight:600;
  }

  /* ---- Pastilles ------------------------------------------------------ */
  .bmnav__badge{
    position:absolute;
    top:-5px;
    left:14px;
    min-width:17px;
    height:17px;
    padding:0 4px;
    border-radius:9px;
    background:var(--bmnav-accent);
    color:var(--bmnav-ink);
    font-size:10px;
    font-weight:700;
    line-height:17px;
    text-align:center;
    box-shadow:0 0 0 2px #fff;
  }

  .bmnav__badge[hidden]{
    display:none;
  }

  /* Bulle promo posée depuis le back-office sur un onglet (couleurs en ligne) */
  .bmnav__promo{
    position:absolute;
    top:-7px;
    left:13px;
    height:15px;
    padding:0 5px;
    border-radius:8px;
    font-size:9px;
    font-weight:800;
    line-height:15px;
    white-space:nowrap;
    pointer-events:none;
    box-shadow:0 0 0 2px #fff;
  }

  .bmnav__badge.is-bump{
    animation:bmnav-bump .35s ease;
  }

  @keyframes bmnav-bump{
    0%   { transform:scale(1); }
    45%  { transform:scale(1.35); }
    100% { transform:scale(1); }
  }

  /* ---- Barre du haut : recherche + pastilles --------------------------
     Remplace le header Creative Elements sur mobile (celui-ci est masqué
     dans custom.css, bloc "8. Header vidé sous 992px"). */
  .bmnav-top-wrap{
    display:block;
    position:fixed;
    top:0; left:0; right:0;
    z-index:1055;
    background:#fff;
    border-bottom:1px solid var(--bmnav-line);
    padding-top:env(safe-area-inset-top, 0px);
    transform:translateY(0);
    transition:transform .2s ease;
  }

  .bmnav-top-wrap.is-hidden{
    transform:translateY(-100%);
  }

  .bmnav-top{
    display:flex;
    align-items:center;
    gap:10px;
    height:var(--bmnav-top-h);
    padding:0 14px;
  }

  .bmnav-top__logo{
    flex:0 0 auto;
    width:26px;
    height:26px;
    border-radius:8px;
    background:var(--bmnav-ink);
    color:var(--bmnav-accent);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:800;
    font-size:13px;
    text-decoration:none;
  }

  .bmnav-top__search{
    flex:1 1 auto;
    min-width:0;
    display:flex;
    align-items:center;
    gap:8px;
    height:38px;
    padding:0 14px;
    border:1px solid var(--bmnav-line);
    border-radius:999px;
    background:#f4f4f5;
    transition:border-color .15s ease, background .15s ease;
  }

  .bmnav-top__search:focus-within{
    border-color:#d9d9d9;
    background:#fff;
  }

  .bmnav-top__search-icon{
    flex:0 0 auto;
    width:16px;
    height:16px;
    fill:none;
    stroke:var(--bmnav-muted);
    stroke-width:1.9;
  }

  .bmnav-top__search-input{
    flex:1 1 auto;
    min-width:0;
    height:100%;
    padding:0;
    border:0;
    background:transparent;
    color:var(--bmnav-ink);
    font-size:13.5px;
    outline:none;
  }

  .bmnav-top__search-input::placeholder{
    color:var(--bmnav-muted);
  }

  .bmnav-top__search-input::-webkit-search-cancel-button{
    display:none;
  }

  .bmnav-pills{
    display:flex;
    gap:7px;
    height:var(--bmnav-pills-h);
    align-items:center;
    padding:0 14px 10px;
    overflow-x:auto;
    scrollbar-width:none;
  }

  .bmnav-pills::-webkit-scrollbar{
    display:none;
  }

  .bmnav-pill{
    flex:0 0 auto;
    white-space:nowrap;
    padding:6px 12px;
    border-radius:999px;
    border:1px solid var(--bmnav-line);
    background:#fff;
    color:var(--bmnav-ink);
    font-size:12px;
    font-weight:700;
    text-decoration:none;
  }

  .bmnav-pill--sage{
    background:var(--bmnav-sage-bg);
    color:var(--bmnav-sage-ink);
    border-color:transparent;
  }

  .bmnav-pill--accent{
    background:var(--bmnav-accent);
    color:var(--bmnav-ink);
    border-color:transparent;
  }

  /* Le panneau "Nos services" (bmnav-tools) réutilise la mécanique de
     positionnement/transition de .bmnav-cat — seul le contenu diffère
     (liste verticale au lieu d'une grille de cartes), voir plus bas. */

  /* ---- Panneau catalogue --------------------------------------------- */
  .bmnav-cat{
    display:flex;
    flex-direction:column;
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom: calc(var(--bmnav-h) + env(safe-area-inset-bottom, 0px) + var(--bmnav-kb, 0px));
    z-index:1045;
    background:#fff;
    transform:translateY(100%);
    transition:transform .26s cubic-bezier(.22,.61,.36,1);
  }

  .bmnav-cat[hidden]{
    display:none;
  }

  .bmnav-cat.is-open{
    transform:translateY(0);
  }

  .bmnav-cat__head{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    height:52px;
    padding:0 8px 0 16px;
    border-bottom:1px solid var(--bmnav-line);
    padding-top: env(safe-area-inset-top, 0px);
  }

  .bmnav-cat__title{
    font-size:17px;
    font-weight:600;
    color:var(--bmnav-ink);
  }

  .bmnav-cat__close{
    display:flex;
    align-items:center;
    justify-content:center;
    width:38px;
    height:38px;
    padding:0;
    border:0;
    border-radius:50%;
    background:transparent;
    color:var(--bmnav-ink);
  }

  .bmnav-cat__close svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.7;
    stroke-linecap:round;
  }

  .bmnav-cat__scroll{
    flex:1 1 auto;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    padding:12px 12px 20px;
  }

  .bmnav-cat__grid{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:10px;
  }

  .bmnav-cat__card{
    display:flex;
    flex-direction:column;
    border:1px solid var(--bmnav-line);
    border-radius:12px;
    overflow:hidden;
    background:#fff;
    color:var(--bmnav-ink);
    text-decoration:none;
    box-shadow:0 2px 10px rgba(0,0,0,.05);
  }

  .bmnav-cat__card:hover,
  .bmnav-cat__card:focus{
    color:var(--bmnav-ink);
    text-decoration:none;
  }

  .bmnav-cat__card:active{
    transform:scale(.985);
  }

  .bmnav-cat__media{
    display:block;
    aspect-ratio:4 / 3;
    background:#f4f4f5;
    overflow:hidden;
  }

  .bmnav-cat__media img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
  }

  .bmnav-cat__name{
    display:block;
    padding:9px 10px 11px;
    font-size:13px;
    font-weight:600;
    line-height:1.25;
  }

  .bmnav-cat__all{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin-top:12px;
    padding:14px 16px;
    border-radius:12px;
    background:#f4f4f5;
    color:var(--bmnav-ink);
    font-size:14px;
    font-weight:600;
    text-decoration:none;
  }

  .bmnav-cat__all svg{
    width:18px;
    height:18px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  /* Flèche de retour, visible dès qu'on est descendu d'un niveau */
  .bmnav-cat__back{
    display:flex;
    align-items:center;
    justify-content:center;
    width:38px;
    height:38px;
    padding:0;
    margin-left:-8px;
    border:0;
    border-radius:50%;
    background:transparent;
    color:var(--bmnav-ink);
  }

  .bmnav-cat__back[hidden]{
    display:none;
  }

  .bmnav-cat__back svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.7;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .bmnav-cat__title{
    flex:1 1 auto;
    min-width:0;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
  }

  .bmnav-cat__head:has(.bmnav-cat__back[hidden]) .bmnav-cat__title{
    padding-left:8px;
  }

  /* Chevron sur les cartes qui ouvrent un niveau plutôt qu'une page */
  .bmnav-cat__card.has-children .bmnav-cat__name::after{
    content:"";
    display:inline-block;
    width:6px;
    height:6px;
    margin-left:6px;
    border-right:1.8px solid currentColor;
    border-bottom:1.8px solid currentColor;
    transform:rotate(-45deg) translateY(-1px);
    opacity:.5;
  }

  .bmnav-cat__loading{
    grid-column:1 / -1;
    margin:0;
    padding:28px 0;
    text-align:center;
    color:var(--bmnav-muted);
    font-size:14px;
  }

  /* ---- Panneau "Nos services" (liste, pas de grille) ------------------ */
  .bmnav-tools__list{
    list-style:none;
    margin:0;
    padding:0;
  }

  .bmnav-tools__item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 10px;
    border-radius:12px;
    color:var(--bmnav-ink);
    text-decoration:none;
  }

  .bmnav-tools__item:hover,
  .bmnav-tools__item:focus{
    color:var(--bmnav-ink);
    text-decoration:none;
    background:#f4f4f5;
  }

  .bmnav-tools__item:active{
    background:#ececec;
  }

  .bmnav-tools__icon{
    flex:0 0 auto;
    width:40px;
    height:40px;
    border-radius:11px;
    background:#f4f4f5;
    display:flex;
    align-items:center;
    justify-content:center;
  }

  .bmnav-tools__icon svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.7;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .bmnav-tools__text{
    flex:1 1 auto;
    min-width:0;
  }

  .bmnav-tools__text strong{
    display:block;
    font-size:14.5px;
    font-weight:600;
  }

  .bmnav-tools__text small{
    display:block;
    margin-top:2px;
    font-size:12.5px;
    color:var(--bmnav-muted);
  }

  .bmnav-tools__chevron{
    flex:0 0 auto;
    width:16px;
    height:16px;
    fill:none;
    stroke:var(--bmnav-muted);
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  /* Pas de défilement derrière un panneau ouvert */
  body.bmnav-locked{
    overflow:hidden;
  }

  /* ---- Header allégé : le méga-menu fait doublon avec la barre --------
     Conditionné à .bmnav-on, posée en JS : si la barre ne se charge pas,
     le menu du haut reste en place. */
  body.bmnav-on .ets_mm_megamenu{
    display:none !important;
  }
}

@media (prefers-reduced-motion: reduce){
  .bmnav,
  .bmnav-top-wrap,
  .bmnav__badge.is-bump{
    transition:none;
    animation:none;
  }
}
