 /* -------------------------------------------------------------------
   * Design System & Variables (Nouveau Thème)
   * ------------------------------------------------------------------- */
 :root {
     --navbar-height: 64px;
     --sidebar-width: 260px;
     --sidebar-collapsed-width: 80px;
     --transition-speed: 0.3s;

     /* Nouvelle palette de couleurs "Night & Cyan" */
     --cyan-accent: #08d9d6;
     /* Cyan vif pour les accents et les éléments actifs */
     --bg-dark-primary: #1a1a2e;
     /* Bleu nuit profond pour le fond principal */
     --bg-dark-secondary: #16213e;
     /* Bleu nuit plus clair pour les composants */
     --bg-hover: #0f3460;
     /* Bleu pour les survols */
     --border-color: #2a3b5e;
     /* Couleur subtile pour les bordures */

     --text-primary: #eaeaea;
     /* Blanc cassé pour le texte principal */
     --text-muted: #a9a9a9;
     /* Gris clair pour le texte secondaire */

     /* Remplacement de la variable Bootstrap pour une cohérence parfaite */
     --bs-primary: var(--cyan-accent);
     --bs-primary-rgb: 8, 217, 214;
 }

 /* -------------------------------------------------------------------
   * Styles de base
   * ------------------------------------------------------------------- */
 body {
     font-family: 'Poppins', sans-serif;
     background-color: var(--bg-dark-primary);
     color: var(--text-primary);
     /* Couleur de texte par défaut */
     overflow-x: hidden;
 }

 /* -------------------------------------------------------------------
   * Barre de navigation (Navbar)
   * ------------------------------------------------------------------- */
 .navbar {
     height: var(--navbar-height);
     background-color: var(--bg-dark-secondary) !important;
     border-bottom: 1px solid var(--border-color);
     box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
     z-index: 1031;
     /* Z-index légèrement supérieur pour être au-dessus */
 }

 .logo-brand {
     font-weight: 600;
     font-size: 1.5rem;
     color: var(--text-primary);
 }

 .navbar .btn {
     color: var(--text-muted);
     background-color: transparent;
     border: 1px solid var(--border-color);
 }

 .navbar .btn:hover {
     color: var(--text-primary);
     background-color: var(--bg-hover);
     border-color: var(--bg-hover);
 }

 .navbar .dropdown-menu {
     background-color: var(--bg-dark-secondary);
     border: 1px solid var(--border-color);
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
 }

 .navbar .dropdown-item {
     color: var(--text-muted);
 }

 .navbar .dropdown-item:hover {
     color: var(--text-primary);
     background-color: var(--bg-hover);
 }

 .navbar .dropdown-item.text-danger {
     color: #f44336 !important;
 }

 .navbar .dropdown-item.text-danger:hover {
     background-color: rgba(244, 67, 54, 0.2);
     color: #fff !important;
 }

 .navbar .dropdown-divider {
     border-color: var(--border-color);
 }


 /* -------------------------------------------------------------------
   * Barre latérale (Sidebar)
   * ------------------------------------------------------------------- */
 #sidebar {
     width: var(--sidebar-width);
     height: 100vh;
     position: fixed;
     top: 0;
     left: 0;
     z-index: 1030;
     background-color: var(--bg-dark-secondary);
     border-right: 1px solid var(--border-color);
     transition: all var(--transition-speed) ease;
     transform: translateX(0);
     overflow-y: auto;
     overflow-x: hidden;
     padding-top: var(--navbar-height);
 }

 #sidebar.collapsed {
     width: var(--sidebar-collapsed-width);
 }

 #sidebar .nav-link {
     display: flex;
     align-items: center;
     padding: 12px 20px;
     margin: 4px 10px;
     border-radius: 8px;
     color: var(--text-muted);
     font-weight: 500;
     white-space: nowrap;
     transition: all 0.2s ease;
 }

 #sidebar .nav-link:hover {
     background-color: var(--bg-hover);
     color: var(--text-primary);
 }

 #sidebar .nav-link.active {
     background-color: var(--bs-primary);
     color: var(--bg-dark-primary) !important;
     /* Texte plus foncé pour le contraste */
     font-weight: 600;
     box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb), 0.3);
 }

 #sidebar .nav-link .bi {
     font-size: 1.2rem;
     min-width: 30px;
     text-align: center;
     margin-right: 15px;
     transition: margin var(--transition-speed) ease;
 }

 #sidebar .nav-link .submenu-arrow {
     margin-left: auto;
     transition: transform var(--transition-speed) ease;
 }

 #sidebar .nav-link[aria-expanded="true"] .submenu-arrow {
     transform: rotate(-180deg);
 }

 #sidebar .collapse .nav-link {
     padding-left: 65px;
     /* Aligné avec le texte parent */
     font-size: 0.9rem;
     font-weight: 400;
     color: var(--text-muted);
 }

 #sidebar .collapse .nav-link:hover {
     color: var(--text-primary);
 }

 #sidebar .collapse .nav-link.active {
     font-weight: 600;
     color: var(--bs-primary) !important;
     background: none;
     box-shadow: none;
 }

 #sidebar.collapsed .nav-link span,
 #sidebar.collapsed .submenu-arrow,
 #sidebar.collapsed .collapse {
     display: none;
 }

 #sidebar.collapsed .nav-link {
     justify-content: center;
 }

 #sidebar.collapsed .nav-link .bi {
     margin-right: 0;
 }

 /* -------------------------------------------------------------------
   * Contenu principal & Pied de page
   * ------------------------------------------------------------------- */
 .page-wrapper {
     margin-left: var(--sidebar-width);
     padding-top: var(--navbar-height);
     transition: margin-left var(--transition-speed) ease;
 }

 main {
     padding: 1.5rem;
     min-height: calc(100vh - var(--navbar-height) - 80px);
     /* 80px = hauteur footer */
 }

 #sidebar.collapsed~.page-wrapper {
     margin-left: var(--sidebar-collapsed-width);
 }

 footer {
     height: 80px;
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: center;
     background-color: var(--bg-dark-secondary);
     /* Fond cohérent */
     border-top: 1px solid var(--border-color);
     /* Bordure cohérente */
     color: var(--text-muted);
 }

 footer a.text-primary {
     color: var(--bs-primary) !important;
 }


 /* -------------------------------------------------------------------
   * Responsive (Mobile)
   * ------------------------------------------------------------------- */
 @media (max-width: 992px) {
     #sidebar {
         transform: translateX(-100%);
         /* CORRECTION : padding-top et height sont maintenant globaux, 
         donc inutiles de les redéfinir ici. */
     }

     #sidebar.show {
         transform: translateX(0);
         box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
     }

     .page-wrapper {
         margin-left: 0 !important;
     }

     .sidebar-overlay {
         position: fixed;
         top: 0;
         left: 0;
         width: 100%;
         height: 100%;
         background-color: rgba(0, 0, 0, 0.5);
         z-index: 1029;
         opacity: 0;
         visibility: hidden;
         transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
     }

     .sidebar-overlay.show {
         opacity: 1;
         visibility: visible;
     }
 }