/* Menu mobile moderne - Style ChatGPT appliqué */

/* Variables CSS modernes */
:root {
  --bg: #0a0a0c;
  --fg: #f1f1f3;
  --muted: #aaa;
  --accent: #e22e47;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --panel-opacity: 0.88;
  --title-gradient: linear-gradient(90deg, #7a0a12, #b82032, #7a0a12);
  --link-hover-bg: rgba(255, 255, 255, 0.07);
}

/* Bouton hamburger (caché en desktop) */
#mobileMenuToggle {
  display: none;
}
#mobileSidebars {
  display: none;
}
#mobileMenuToggle .bar {
  display: block;
  width: 24px;
  height: 2px;
  margin: 5px 0;
  background: #000;
}

@media (max-width: 992px) {
  /* Header moderne avec glassmorphism - logo intact */
  #top_0 {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(
      90deg,
      rgba(10, 10, 12, 0.9),
      rgba(10, 10, 12, 0.7)
    );
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
    z-index: 1001;
  }

  /* Logo original - ne pas toucher */
  #titre {
    filter: brightness(0) invert(1);
  }

  /* Bouton hamburger moderne */
  #mobileMenuToggle {
    display: inline-block;
    background: none;
    border: none;
    color: var(--fg);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 8px;
  }
  #mobileMenuToggle .bar {
    background: var(--fg);
  }

  /* Menu drawer - style exact du test */
  #top2 {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: rgba(20, 20, 24, 0.88);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 6px 0 20px rgba(0, 0, 0, 0.6);
    transition: left 0.35s ease;
    z-index: 999;
    /* Pas d'espace haut: le décalage est géré par top quand ouvert */
    padding: 0 1rem 2rem;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  #top2::-webkit-scrollbar {
    display: none;
  }
  #top2.is-open {
    left: 0;
  }

  /* Contenu du menu */
  #mobileMenuContent {
    padding: 0;
    margin: 0;
  }

  /* Ajuster le contenu principal pour qu'il ne soit pas caché par le header */
  #principal {
    padding-top: 120px;
  }

  /* Forcer l'espacement pour le bloc d'accueil */
  .column_in_accueil {
    margin-top: 15px !important;
    padding-top: 10px !important;
  }

  /* Forcer la position du menu avec style critique */
  #top2.is-open {
    left: 0 !important;
    top: 60px !important;
    position: fixed !important;
    height: calc(100vh - 60px) !important;
    padding-top: 0 !important; /* aucun espace au-dessus du contenu */
  }

  /* Annuler tout margin/padding haut éventuel dans le contenu du menu */
  #mobileMenuContent {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  #top2 #menutop2 {
    margin-top: 0 !important;
  }

  /* Backdrop - style exact du test */
  #mobileBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 998;
  }
  #mobileBackdrop.is-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  /* Contenu du menu - style exact du test */
  #mobileMenuContent {
    padding: 0;
    margin: 0;
  }

  /* Menu principal - style exact du test */
  #top2 #menutop2 {
    display: none !important; /* supprimé sur mobile: on ne garde que le bloc Navigation */
    margin-bottom: 0.8rem !important;
    padding: 0 !important;
    background: var(--card) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 18px !important;
    padding: 0.85rem 0.9rem !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
  }

  /* Titre "Menu principal" - style exact du test */
  #top2 #menutop2 h3 {
    display: block !important;
    margin: 0 0 0.7rem 0 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    background: var(--title-gradient) !important;
    padding: 0.55rem 0.7rem !important;
    border-radius: 12px !important;
    letter-spacing: 0.2px !important;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.4) !important;
  }
  #top2 #menutop2 ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }
  #top2 #menutop2 li {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important; /* aligné sur Navigation */
  }
  #top2 #menutop2 li + li {
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  }
  #top2 #menutop2 li a {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.35rem 0.5rem !important; /* même padding que Navigation */
    border-radius: 6px !important;
    line-height: 1.4 !important;
    transition: color 0.2s ease, background 0.25s ease !important; /* pas d'animation de déplacement */
    color: var(--fg) !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
    font-size: 0.9rem !important; /* même taille que Navigation */
    box-sizing: border-box !important;
  }
  #top2 #menutop2 li a::before {
    content: "›" !important;
    opacity: 0.55 !important;
    font-weight: 700 !important;
    transition: opacity 0.2s ease !important;
  }
  #top2 #menutop2 li a:hover {
    background: var(
      --link-hover-bg
    ) !important; /* uniquement couleur, pas de déplacement */
    color: #fff !important;
  }
  #top2 #menutop2 li a:hover::before {
    opacity: 1 !important;
    color: #fff !important;
  }

  /* Sidebars - style exact du test */
  #mobileSidebars {
    margin: 0 !important;
    display: block !important;
    padding: 0 !important;
  }
  #mobileSidebars .menuleft,
  #mobileSidebars .menuright {
    float: none !important;
    width: 100% !important;
    margin: 0 0 0.8rem 0 !important;
    padding: 0 !important;
    background: var(--card) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 18px !important;
    padding: 0.85rem 0.9rem !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
    overflow: hidden !important;
  }

  /* Espace sous le header pour le 1er bloc du menu */
  #mobileSidebars > .menuleft:first-of-type,
  #mobileSidebars > .menuright:first-of-type {
    margin-top: 0.8rem !important;
  }

  /* Titres avec rouge bordeaux élégant - style exact du test */
  #mobileSidebars .menuleft li.header,
  #mobileSidebars .menuright li.header {
    display: block !important;
    margin: 0 0 0.7rem 0 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    background: var(--title-gradient) !important;
    padding: 0.55rem 0.7rem !important;
    border-radius: 12px !important;
    letter-spacing: 0.2px !important;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.4) !important;
    text-transform: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  #mobileSidebars .menuleft ul,
  #mobileSidebars .menuright ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }
  #mobileSidebars .menuleft li,
  #mobileSidebars .menuright li {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.12rem 0 !important;
    color: var(--fg) !important; /* rendre le texte lisible (Statistiques) */
  }
  #mobileSidebars .menuleft li + li,
  #mobileSidebars .menuright li + li {
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  }
  #mobileSidebars .menuleft a,
  #mobileSidebars .menuright a {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.35rem 0.5rem !important;
    border-radius: 10px !important;
    transition: background 0.25s ease, transform 0.15s ease !important;
    color: var(--fg) !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
    font-size: 0.9rem !important;
  }
  #mobileSidebars .menuleft a::before,
  #mobileSidebars .menuright a::before {
    content: "›" !important;
    opacity: 0.55 !important;
    font-weight: 700 !important;
    transition: opacity 0.2s ease !important;
  }
  #mobileSidebars .menuleft a:hover,
  #mobileSidebars .menuright a:hover {
    background: var(--link-hover-bg) !important;
    color: #fff !important;
  }
  #mobileSidebars .menuleft a:hover::before,
  #mobileSidebars .menuright a:hover::before {
    opacity: 1 !important;
    color: #fff !important;
  }
  /* Afficher la première section des sidebars (renommée en Menu principal) */

  /* Supprimer tout élément indésirable */
  #mobileSidebars .box,
  #mobileSidebars .widget {
    background: transparent !important;
    border: 0 !important;
  }

  /* Supprimer tout carré blanc ou élément indésirable */
  #top2 .box_small,
  #top2 .box,
  #top2 .widget,
  #top2 .column,
  #top2 .column_in,
  #top2 .column_in_accueil {
    background: transparent !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Masquer tous les éléments sauf le menu principal et les sidebars */
  #top2 > *:not(#mobileMenuContent) {
    display: none !important;
  }
  #mobileMenuContent > *:not(#menutop2):not(#mobileSidebars) {
    display: none !important;
  }

  /* Tag Cloud - style exact du test */
  #mobileSidebars .cloudTagX {
    background: var(--card) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 18px !important;
    padding: 0.85rem 0.9rem !important;
    margin: 0 0 0.8rem 0 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
  }
  #mobileSidebars .cloudTagX .chips {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  #mobileSidebars .cloudTagX a {
    display: inline-block !important;
    padding: 0.35rem 0.6rem !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--fg) !important;
    font-size: 0.85rem !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
  }
  #mobileSidebars .cloudTagX a:hover {
    background: var(--accent) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
  }

  /* Bouton fermer moderne */
  #mobileClose {
    position: sticky;
    top: 0;
    margin-left: auto;
    display: block;
    background: transparent;
    border: 0;
    color: var(--fg);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
  }
  #mobileClose:hover {
    background: var(--link-hover-bg);
  }
  #mobileClose:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}
