/**
 * Menu mobile BDEGL Premium
 * Breakpoint : < 992px
 */

@media (max-width: 991px) {

  /* ── Masquer les éléments PC ── */
  .BDEAC__section-hero .BDEAC__logo      { display: none !important; }
  .BDEAC__navigation .cobac-main-nav     { display: none !important; }

  /* ── Barre mobile : réserve 56px en haut ── */
  .BDEAC { padding-top: 56px; }

  /* Quand le menu est ouvert : bloquer scroll SANS décalage de contenu */
  body.bdegl-menu-open {
    overflow: hidden;
    /* scrollbar-gutter est la solution propre (support 2022+) */
    scrollbar-gutter: stable;
  }

  /* Conteneur invisible (ne prend pas de hauteur dans le flux) */
  .bdegl-mobile-menu {
    height: 0;
    overflow: visible;
  }

  /* ════════════════════════════════════════
     BARRE FIXE (logo gauche + hamburger droite)
     ════════════════════════════════════════ */
  .bdegl-mobile-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1002;
    height: 56px;
    background: var(--clr-primary-dark, #1e2a6b);
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
  }

  .bdegl-mobile-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
  }

  .bdegl-mobile-bar__logo {
    display: flex;
    align-items: center;
    height: 40px;
  }
  .bdegl-mobile-bar__logo img {
    max-height: 100%;
    width: auto;
    max-width: 150px;
    object-fit: contain;
  }

  /* Bouton hamburger */
  .bdegl-mobile-bar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    flex-shrink: 0;
  }
  .bdegl-mobile-bar__toggle .line {
    position: absolute;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: transform .22s ease, opacity .22s ease;
  }
  .bdegl-mobile-bar__toggle .line1 { transform: translateY(-6px); }
  .bdegl-mobile-bar__toggle .line3 { transform: translateY(6px); }

  /* Animation → croix */
  #bdegl-menu-check:checked ~ .bdegl-mobile-bar .line1 { transform: translateY(0) rotate(45deg); }
  #bdegl-menu-check:checked ~ .bdegl-mobile-bar .line2 { opacity: 0; }
  #bdegl-menu-check:checked ~ .bdegl-mobile-bar .line3 { transform: translateY(0) rotate(-45deg); }

  /* Checkbox caché */
  #bdegl-menu-check {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0; height: 0;
  }

  /* ════════════════════════════════════════
     OVERLAY PLEIN ÉCRAN
     ════════════════════════════════════════ */
  .bdegl-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    overflow: hidden;    /* le panneau intérieur scrolle, pas l'overlay */
  }
  #bdegl-menu-check:checked ~ .bdegl-mobile-overlay { display: flex; }

  /* Fond sombre semi-transparent derrière le panneau */
  .bdegl-mobile-overlay .bg-dropdown {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 0;
  }

  /* ════════════════════════════════════════
     PANNEAU DE NAVIGATION (glisse depuis la gauche)
     ════════════════════════════════════════ */
  .bdegl-mobile-overlay .bdegl-mobile-nav {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 56px 0 32px;
    list-style: none;
    background: #f0f2fb;
    width: min(84vw, 340px);
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: 3px 0 20px rgba(0,0,0,.18);
  }

  /* ── Niveau 1 : items principaux ── */
  .bdegl-mobile-nav > li {
    border-bottom: 1px solid rgba(30,42,107,.1);
  }
  .bdegl-mobile-nav .BDEAC__responsive-link,
  .bdegl-mobile-nav .bdegl-nav-toggle {
    display: block;
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: 700;
    color: #1e2a6b;
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
    letter-spacing: .01em;
  }
  /* Flèche de déploiement */
  .bdegl-mobile-nav .bdegl-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .bdegl-mobile-nav .bdegl-nav-toggle::after {
    content: "\203A";     /* › */
    font-size: 1.4rem;
    font-weight: 400;
    transition: transform .2s ease;
    flex-shrink: 0;
    margin-left: 8px;
  }
  .bdegl-mobile-nav .bdegl-nav-toggle[aria-expanded="true"]::after {
    transform: rotate(90deg);
  }

  /* ── Sous-menus (niveaux 2+) ── */
  .bdegl-mobile-nav .BDEAC__child-menu {
    display: none;
    padding: 0;
    margin: 0;
    list-style: none;
    background: rgba(30,42,107,.05);
  }
  .bdegl-mobile-nav .bdegl-nav-toggle[aria-expanded="true"] + .BDEAC__child-menu,
  .bdegl-mobile-nav > li.open > .BDEAC__child-menu {
    display: block;
  }
  .bdegl-mobile-nav .BDEAC__child-menu li {
    border-bottom: 1px solid rgba(30,42,107,.07);
  }

  /* Bouton niveau 2 */
  .bdegl-mobile-nav .bdegl-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 20px 12px 30px;
    font-size: .95rem;
    font-weight: 600;
    color: #1e2a6b;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
  }
  .bdegl-mobile-nav .bdegl-sub-toggle::after {
    content: "\203A";
    font-size: 1.2rem;
    font-weight: 400;
    transition: transform .2s ease;
    flex-shrink: 0;
    margin-left: 8px;
  }
  .bdegl-mobile-nav .bdegl-sub-toggle[aria-expanded="true"]::after { transform: rotate(90deg); }

  /* Sous-sous-menus niveau 3 */
  .bdegl-mobile-nav .BDEAC__child-menu .BDEAC__child-menu {
    display: none;
    background: rgba(30,42,107,.04);
  }
  .bdegl-mobile-nav .BDEAC__child-menu li.open > .BDEAC__child-menu { display: block; }

  /* Liens finaux */
  .bdegl-mobile-nav .BDEAC__menu-item a {
    display: block;
    padding: 10px 20px 10px 38px;
    font-size: .9rem;
    color: #2a3a8a;
    text-decoration: none;
    line-height: 1.45;
  }
  .bdegl-mobile-nav .BDEAC__child-menu .BDEAC__child-menu .BDEAC__menu-item a {
    padding-left: 48px;
    font-size: .88rem;
  }

  /* États actifs */
  .bdegl-mobile-nav .BDEAC__responsive-link:active,
  .bdegl-mobile-nav .bdegl-nav-toggle:active,
  .bdegl-mobile-nav .bdegl-sub-toggle:active,
  .bdegl-mobile-nav .BDEAC__menu-item a:active {
    background: rgba(30,42,107,.1);
  }

} /* fin @media (max-width: 991px) */
