/* TOPBAR FIXE EN HAUT */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #fff;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  z-index: 900;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  height: 100%;
}
.topbar-center {
  flex: 1;
  justify-content: center;
}
.topbar-right {
  gap: 18px;
}

/* Décale le contenu principal sous la topbar */

/* Layout principal : sidebar + contenu, topbar fixe en haut */
.app-container {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  /* margin-top: 60px;  supprimé pour éviter l'espace blanc sous la topbar */
}


main, .main-content, .content-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  padding: 84px 32px 24px 32px; /* 60px topbar + 24px espace, évite le chevauchement */
  background: #f8f9fa;
  min-height: calc(100vh - 60px);
  margin-left: 250px; /* Décale le contenu à droite de la sidebar */
  box-sizing: border-box;
}

/* Correction : la topbar ne doit jamais prendre toute la hauteur */
.topbar {
  height: 60px !important;
  min-height: 60px !important;
  max-height: 60px !important;
  width: auto;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .topbar {
    left: 0;
    padding: 0 10px;
  }
  .sidebar {
    width: 200px;
  }
}
/* GestionEPN - Style CSS Production Optimisé */
/* Date: 1 octobre 2025 - Version corrigée pour affichage pleine largeur */

/* 1. VARIABLES GLOBALES */

:root {
  --primary: #3498db;
  --primary-dark: #2980b9;
  --secondary: #2ecc71;
  --accent: #e74c3c;
  --warning: #f39c12;
  --light: #f8f9fa;
  --dark: #2c3e50;
  --gray: #7f8c8d;
  --gray-100: #f8f9fa;
  --gray-600: #6c757d;

.export-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.export-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.export-title {
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--dark);
}

.export-btn {
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.export-btn:hover {
  background: var(--primary-dark);
  text-decoration: none;
  color: white;
}
.topbar {
  position: fixed;
  top: 0;
  left: 250px;
  right: 0;
  height: 60px !important;
  min-height: 60px !important;
  max-height: 60px !important;
  background: #fff;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  z-index: 1200;
}

/* Maintenance actions */
.maintenance-actions {
  gap: 20px;
}

.action-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #e9ecef;
}

.action-card.warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border-color: #ffc107;
}

.action-card.danger {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border-color: #dc3545;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.action-card.warning .action-icon {
  color: #856404;
}

.action-card.danger .action-icon {
  color: #721c24;
}

.action-title {
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--dark);
}

/* System info */
.system-info {
  gap: 20px;
}

.info-item {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 1px solid #e9ecef;
}

.info-item h4 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1.1em;
}

.info-item p {
  margin: 0;
  color: var(--dark);
  font-weight: 500;
}

/* Settings grid */
.settings-grid {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.settings-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.settings-section.active {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.settings-section h3 {
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-200);
}

.settings-section h4 {
  color: var(--dark);
  margin: 20px 0 15px 0;
  font-size: 1.1em;
}

/* Chart container */
.chart-container {
  position: relative;
  height: 400px;
  margin-top: 20px;
}

.chart-options {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 20px;
}

/* Global body defaults (fixed malformed fragment) */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--gray-100);
  color: var(--dark);
  line-height: 1.6;
  overflow-x: hidden;
}

/* 3. LAYOUT GLOBAL - CORRECTION LARGEUR PLEINE */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 250px;
  height: 100vh;
  background: var(--dark);
  color: var(--light);
  padding: 20px;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
  top: 0;
  height: 100vh;
  z-index: 1000;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-header .logo {
  font-size: 1.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  list-style: none;
  margin-top: 20px;
  padding-left: 0;
}

.nav-links li a {
  display: block;
  padding: 10px;
  color: var(--light);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-links li a:hover,
.nav-links li a.active {
  background: var(--primary);
  color: var(--light);
}

/* CORRECTION CRITIQUE: Largeur complète du contenu principal */
.main-content {
  margin-left: 250px;
  padding: 84px 20px 20px 20px; /* 60px topbar + 20px espace, évite le chevauchement */
  /* min-height: 100vh; supprimé pour éviter le scroll inutile */
  width: calc(100% - 250px);
  background: var(--gray-100);
  transition: margin-left 0.3s ease, width 0.3s ease;
  overflow-x: auto;
  overflow-y: visible;
}

.main-content.sidebar-collapsed {
  margin-left: 0;
  width: 100%;
}

/* Responsive: ensure sidebar is hidden by default on small screens and main content fills width.
   Use .sidebar.active (or .sidebar.open) to show the sidebar as an overlay when needed. */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 280px;
    background: var(--dark);
    color: var(--light);
    z-index: 1400;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: transform 260ms ease;
    will-change: transform;
  }

  .sidebar.active, .sidebar.open, .sidebar.collapsed == false {
    transform: translateX(0);
  }

  /* When sidebar is open it overlays the content; main always takes full width underneath */
  .main-content,
  main,
  .content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Topbar should span full width on mobile */
  .topbar {
    left: 0 !important;
    right: 0 !important;
    padding: 0 12px !important;
  }

  /* Small helper: show a visible outline for focused sidebar links on mobile */
  .sidebar a:focus,
  .sidebar a:focus-visible {
    outline: 3px solid rgba(102,126,234,0.18);
    outline-offset: 2px;
  }

  /* Prevent horizontal overflow when sidebar is toggled */
  html, body {
    overflow-x: hidden;
  }
}

/* Content wrapper pour les pages */
.content-wrapper {
  max-width: 100%;
  margin: 0 auto;
}

/* 4. HEADER */
  .header,
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -20px -20px 8px -20px; /* Réduit l'espace sous le header */
    padding: 18px 30px 10px 30px; /* Réduit le padding bas */
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-bottom: 1px solid var(--gray-200);
  }
}

/* DESKTOP LAYOUT (≥ 769px) */
@media (min-width: 769px) {
  .page-header {
    justify-content: space-between;
  }
  
  .page-title {
    flex: 1;
    text-align: center;
    margin: 0;
  }
  
  #darkModeToggle {
    order: 2;
  }
  
  #menuToggle {
    display: none !important;
  }
}

.page-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--dark);
}

/* Optimisation pour les contenus larges */
.table-responsive {
  overflow-x: auto;
  margin: 0 -10px;
}

.table-responsive table {
  min-width: 100%;
}

/* Cards et grilles responsive */
.stats-grid,
.dashboard-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 8px 30px 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.search-box i {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-600);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  background: var(--primary);
  color: var(--light);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* 5. CARDS */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--box-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.card-header {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

/* 6. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--gray);
  color: #fff;
}

.btn-success {
  background: var(--secondary);
  color: #fff;
}

.btn-danger {
  background: var(--accent);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
  background-color: var(--gray);
  cursor: not-allowed;
}

#menuToggle {
  display: none !important;
}

/* Bouton de basculement de thème moderne */
.theme-toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.theme-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 26px;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  border-radius: 13px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(99, 102, 241, 0.2);
}

.toggle-switch.dark {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 15px rgba(124, 58, 237, 0.3);
  border: 2px solid rgba(124, 58, 237, 0.4);
}

.toggle-icons {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 6px;
  z-index: 1;
}

.sun-icon, .moon-icon {
  font-size: 12px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
  color: #f59e0b;
  opacity: 1;
  transform: rotate(0deg) scale(1);
  text-shadow: 0 0 5px rgba(245, 158, 11, 0.6);
}

.moon-icon {
  color: #64748b;
  opacity: 0.8;
  transform: rotate(180deg) scale(0.9);
  text-shadow: 0 0 3px rgba(100, 116, 139, 0.5);
}

.toggle-switch.dark .sun-icon {
  opacity: 0.7;
  transform: rotate(-180deg) scale(0.8);
  color: #fbbf24;
  text-shadow: 0 0 3px rgba(251, 191, 36, 0.4);
}

.toggle-switch.dark .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #fbbf24;
  text-shadow: 0 0 5px rgba(251, 191, 36, 0.6);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-switch.dark .toggle-slider {
  transform: translateX(26px);
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 2px 12px rgba(251, 191, 36, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dark);
  transition: color 0.3s ease;
  user-select: none;
}

.theme-toggle-btn:hover .toggle-label {
  color: var(--primary);
}

/* Animation de clic */
.theme-toggle-btn:active .toggle-switch {
  transform: scale(0.95);
}

.theme-toggle-btn:active .toggle-switch.dark {
  transform: scale(0.95) translateX(26px);
}

/* 7. TABLES */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table th {
  background: rgba(52, 152, 219, 0.1);
  color: var(--primary);
}

table tr:hover {
  background: rgba(52, 152, 219, 0.03);
}

/* 8. BADGES */
.badge {
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--badge-success-bg);
  color: var(--secondary);
}

.badge-warning {
  background: var(--badge-warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--badge-danger-bg);
  color: var(--accent);
}

.badge-info {
  background: var(--badge-info-bg);
  color: var(--primary);
}

/* 9. NOTIFICATIONS */
.notification {
  position: relative;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.notification.error {
  background: var(--accent);
  color: var(--card-bg);
}

.notification.success {
  background: var(--secondary);
  color: var(--card-bg);
}

.notification.warning {
  background-color: #fff3cd;
  color: var(--warning);
  border: 1px solid #ffeaa7;
}

.close-notification {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

/* 10. LOGIN PAGE */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--gray-100);
  margin: 0;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--card-bg);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--card-bg);
  padding: 25px 20px;
  text-align: center;
}

.login-header h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.login-header p {
  opacity: 0.8;
}

.login-body {
  padding: 25px;
}

.login-footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--gray);
}

/* 11. FORMULAIRES */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark);
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--light);
  color: var(--dark);
  font-size: 1rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

/* Checkbox group styles */
.checkbox-group {
  padding: 15px;
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 1px solid #ffc107;
  border-radius: 8px;
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  color: #856404;
  margin-bottom: 5px;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 10px;
  transform: scale(1.2);
  accent-color: #ff6b35;
}

.form-text {
  color: #856404;
  font-size: 0.85em;
  font-style: italic;
  margin-left: 30px;
}

/* 12. SWITCHES */
.toggle-switch,
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input,
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider,
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-slider:before,
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider,
.switch input:checked + .slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before,
.switch input:checked + .slider:before {
  transform: translateX(26px);
}

/* 13. ACTIONS */
.actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edit-btn {
  background: var(--primary);
}

.edit-btn:hover {
  filter: brightness(0.9);
}

.delete-btn {
  background: var(--accent);
}

.delete-btn:hover {
  filter: brightness(0.9);
}

/* 14. RESPONSIVE DESIGN - CORRECTION MOBILE */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .sidebar {
    width: 280px;
    position: fixed;
    top: 0;
    left: -280px;
    height: 100%;
    transition: left 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 15px;
    width: 100% !important;
    min-height: 100vh;
  }
  
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
  }
  
  .page-title {
    font-size: 1.5rem;
    margin: 0;
  }
  
  #menuToggle {
    display: block !important;
    order: -1;
  }
  
  #paiementsTable th:nth-child(4),
  #paiementsTable td:nth-child(4),
  #paiementsTable th:nth-child(5),
  #paiementsTable td:nth-child(5),
  #reservationsTable th:nth-child(3),
  #reservationsTable td:nth-child(3),
  #reservationsTable th:nth-child(4),
  #reservationsTable td:nth-child(4) {
    display: none;
  }
  .modal-content {
    width: 95%;
    margin: 10px auto;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 10px;
  }
  
  .page-title {
    font-size: 1.3rem;
  }
  
  .sidebar {
    width: 100vw;
    left: -100vw;
  }
  
  .card {
    padding: 15px;
    margin-bottom: 15px;
  }
  
  .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }
  
  #paiementsTable th:nth-child(4),
  #paiementsTable td:nth-child(4),
  #paiementsTable th:nth-child(5),
  #paiementsTable td:nth-child(5),
  #reservationsTable th:nth-child(3),
  #reservationsTable td:nth-child(3),
  #reservationsTable th:nth-child(4),
  #reservationsTable td:nth-child(4),
  .mobile-hidden {
    display: none;
  }
  
  .modal-content {
    width: 98%;
    margin: 5px auto;
    padding: 15px;
  }
  
  .table-container {
    margin: 0 -10px;
    padding: 0 10px;
  }
  
  table th,
  table td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }
}

/* 15. MODE SOMBRE */
body.dark {
  --primary: #4a90e2;
  --primary-dark: #357ABD;
  --secondary: #27ae60;
  --accent: #e74c3c;
  --warning: #f39c12;
  --light: #2a2a2a;
  --dark: #fafafa;
  --gray: #555555;
  --gray-100: #1e1e1e;
  --gray-600: #a3a3a3;
  --border-color: #444444;
  --card-bg: #1e1e1e;
  --box-shadow: 0 8px 20px rgba(0,0,0,0.7);
  --badge-info-bg: rgba(74,144,226,0.3);
  --badge-success-bg: rgba(39,174,96,0.3);
  --badge-warning-bg: rgba(243,156,18,0.3);
  --badge-danger-bg: rgba(231,76,60,0.3);
}

/* 16. STYLES VARIABLES */
body {
  background: var(--gray-100);
  color: var(--dark);
  font-family: 'Segoe UI', Arial, sans-serif;
}
.card {
  background: var(--card-bg);
  border-color: var(--border-color);
  box-shadow: var(--box-shadow);
}
.notification.error {
  background: var(--accent);
  color: var(--card-bg);
}
.notification.success {
  background: var(--secondary);
  color: var(--card-bg);
}
.notification.warning {
  background-color: #fff3cd;
  color: var(--warning);
  border-color: #ffeaa7;
}
.badge-info { background-color: var(--badge-info-bg); color: var(--primary); }
.badge-success { background-color: var(--badge-success-bg); color: var(--secondary); }
.badge-warning { background-color: var(--badge-warning-bg); color: var(--warning); }
.badge-danger { background-color: var(--badge-danger-bg); color: var(--accent); }
.form-control {
  background-color: var(--light);
  color: var(--dark);
  border-color: var(--border-color);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}
.sidebar {
  background: var(--dark);
  color: var(--light);
}
th {
  background-color: var(--gray-100);
  color: var(--primary);
}
tr:hover {
  background-color: var(--gray-600);
}
.nav-links li a:hover,
.nav-links li a.active {
  background: var(--primary);
  color: var(--light);
}
.user-avatar {
  background: var(--primary);
  color: var(--light);
}

/* 17. BOUTON MODE SOMBRE */
.btn-toggle-darkmode {
  background: var(--primary);
  border: none;
  color: white;
  border-radius: 5px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.2s ease;
  user-select: none;
}
.btn-toggle-darkmode:hover,
.btn-toggle-darkmode:focus {
  background: var(--primary-dark);
  outline: none;
  transform: scale(1.1);
}
.btn-toggle-darkmode:active {
  transform: scale(0.95);
}
.user-menu > .btn-toggle-darkmode {
  margin-left: 15px;
  flex-shrink: 0;
}

/* Styles moved from src/views/dashboard_user_view.php (user dashboard specific) */
/* Dashboard utilisateur — styles spécifiques */
.dashboard-user-welcome {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.dashboard-user-welcome h1 { color: white; margin: 0 0 0.5rem 0; font-size: 2rem; }
.dashboard-user-welcome p { margin: 0; opacity: 0.95; font-size: 1.1rem; }
.notification-badge { background: #ff4757; color: white; padding: 0.25rem 0.6rem; border-radius: 20px; font-size: 0.85rem; font-weight: bold; margin-left: 0.5rem; display: inline-block; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.quick-action-btn { background: white; border: 2px solid #e1e8ed; border-radius: 10px; padding: 1.5rem; text-align: center; cursor: pointer; transition: all 0.3s ease; text-decoration: none; color: #2c3e50; }
.quick-action-btn:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); border-color: #667eea; }
.quick-action-btn i { font-size: 2.5rem; margin-bottom: 0.5rem; color: #667eea; display: block; }
.quick-action-btn span { display: block; font-weight: 600; color: #2c3e50; }
.dashboard-section { background: white; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: relative; opacity: 1; transform: none; max-height: none; overflow: visible; transition: none; }
.dashboard-section h2 { margin: 0 0 1rem 0; color: #2c3e50; font-size: 1.4rem; display: flex; align-items: center; gap: 0.5rem; }
.dashboard-section h2 i { color: #667eea; }
.badge-construction { background: #ffa502; color: white; padding: 0.2rem 0.6rem; border-radius: 5px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; margin-left: 0.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.stat-card { background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); border-radius: 10px; padding: 1.5rem; text-align: center; }
.stat-card.primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.stat-card.success { background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%); color: white; }
.stat-card.warning { background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%); color: white; }
.stat-card.info { background: linear-gradient(135deg, #0093e9 0%, #80d0c7 100%); color: white; }
.stat-card .stat-number { font-size: 2.5rem; font-weight: bold; margin: 0.5rem 0; }
.stat-card .stat-label { font-size: 0.9rem; opacity: 0.9; }
.stat-card i { font-size: 2rem; opacity: 0.8; }
.timeline-item { border-left: 3px solid #667eea; padding-left: 1rem; margin-bottom: 1rem; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; background: #667eea; border-radius: 50%; border: 2px solid white; }
.timeline-item .timeline-date { color: #95a5a6; font-size: 0.85rem; margin-bottom: 0.3rem; }
.timeline-item .timeline-content { color: #2c3e50; font-weight: 500; }
.empty-state { text-align: center; padding: 2rem; color: #95a5a6; }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.user-panel { margin-top: 1.5rem; }
.user-panel ul { list-style: none; padding: 0; margin: 0; }
.user-panel li { background: white; border: 2px solid #e1e8ed; border-radius: 8px; padding: 1rem 1.5rem; margin-bottom: 0.75rem; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 1rem; }
.user-panel li:hover { border-color: #667eea; background: #f8f9ff; transform: translateX(5px); }
.user-panel li i { color: #667eea; font-size: 1.3rem; min-width: 25px; text-align: center; }
.notification-box { background: #fff3cd; border-left: 4px solid #ffc107; padding: 1rem; margin-bottom: 1rem; border-radius: 5px; }
.notification-box.info { background: #d1ecf1; border-color: #0dcaf0; }
.notification-box.success { background: #d1e7dd; border-color: #198754; }
.notification-box.warning { background: #fff3cd; border-color: #ffc107; }
.notification-box.danger { background: #f8d7da; border-color: #dc3545; }
.document-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border: 1px solid #e1e8ed; border-radius: 8px; margin-bottom: 0.75rem; transition: all 0.2s ease; }
.document-item:hover { background: #f8f9ff; border-color: #667eea; }
.document-item .doc-info { display: flex; align-items: center; gap: 1rem; }
.document-item .doc-info i { font-size: 2rem; color: #667eea; }
.document-item .doc-details h4 { margin: 0 0 0.25rem 0; color: #2c3e50; }
.document-item .doc-details p { margin: 0; color: #95a5a6; font-size: 0.85rem; }
.btn-download { background: #667eea; color: white; padding: 0.5rem 1rem; border-radius: 5px; text-decoration: none; transition: all 0.2s ease; }
.btn-download:hover { background: #5568d3; transform: scale(1.05); }

/* Sidebar navigation styles and accessibility (moved from view) */
#sidebar a:focus, #sidebar a:focus-visible { outline: 3px solid rgba(102,126,234,0.25); outline-offset: 2px; background: #f1f5ff; }
#sidebar a:hover { background: #f8f9ff; color: #1f2d3d; }

/* Mobile behaviour for sidebar (moved from view) */
@media (max-width: 900px) {
  .sidebar { display: none; position: fixed; left: 0; top: 0; height: 100%; width: 280px; background: #fff; z-index: 1100; box-shadow: 0 6px 30px rgba(0,0,0,0.12); padding: 1rem; overflow-y: auto; }
  .sidebar.open { display: block; }
  .app-container { padding-left: 0; }
  .topbar { position: sticky; top: 0; z-index: 1200; }
}

/* Helper class to hide construction badges when server-side flag is disabled */
.hide-construction-badges .badge-construction { display: none !important; }

/* Compact mode helpers for dashboard_user_view sections (moved from view) */
/* Mode compact : affiche uniquement la section active */
.app-container.compact .main-content .container .dashboard-section { 
    display: none; 
}
.app-container.compact .main-content .container .dashboard-section.active { 
    display: block; 
}
.app-container.compact .main-content .container #quick-actions { 
    display: none; 
}
.app-container.compact .main-content .container #quick-actions.active { 
    display: grid; 
}

/* Mode normal : affiche toutes les sections par défaut */
.main-content .container .dashboard-section { 
    display: block; 
}
.main-content .container #quick-actions { 
    display: grid; 
}

/* Profile subsections styling */
.profile-subsection {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e1e8ed;
}

.profile-subsection h3 {
  margin: 0 0 1rem 0;
  color: #2c3e50;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-subsection h3 i {
  color: #667eea;
}

/* Sidebar submenu styles for 'Accès rapides' */
.sidebar .nav-item.has-submenu { position: relative; }
.sidebar .submenu-toggle {
  background: transparent;
  border: none;
  color: inherit;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.sidebar .submenu-toggle .submenu-caret { margin-left: auto; opacity: 0.7; }
.sidebar .submenu { list-style: none; margin: 0; padding: 0.25rem 0 0.25rem 0.6rem; }
.sidebar .submenu li { margin: 0; }
.sidebar .nav-sublink {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--dark);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.18s ease, transform 0.18s ease;
  font-size: 0.94rem;
}
.sidebar .nav-sublink:hover { background: rgba(102,126,234,0.06); transform: translateX(4px); }
.sidebar .nav-link { padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.6rem; }

/* Accessibility: focus styles for submenu links */
.sidebar .nav-sublink:focus, .sidebar .submenu-toggle:focus { outline: 3px solid rgba(102,126,234,0.18); outline-offset: 2px; }

/* Small animation for expand/collapse using max-height (graceful degradation) */
.sidebar .submenu { max-height: 0; overflow: hidden; transition: max-height 220ms ease; }
.sidebar .has-submenu .submenu[aria-hidden="false"], .sidebar .has-submenu .submenu.open { max-height: 400px; }

@media (max-width: 900px) {
  /* On mobile, keep submenu collapsed by default but make it visually nested */
  .sidebar .nav-sublink { padding-left: 1.4rem; }
}

/* Cards pour données dynamiques */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.data-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e1e8ed;
    transition: all 0.3s ease;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header i {
    font-size: 1.5rem;
    color: #667eea;
}

.card-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.card-status.success {
    background: #d4edda;
    color: #155724;
}

.card-status.warning {
    background: #fff3cd;
    color: #856404;
}

.card-status.info {
    background: #d1ecf1;
    color: #0c5460;
}

.card-status.danger {
    background: #f8d7da;
    color: #721c24;
}

.card-content h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.card-content p {
    margin: 0.5rem 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.card-content p strong {
    color: #2c3e50;
}

.card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.card-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.section-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

.section-info i {
    color: #667eea;
    margin-right: 0.5rem;
}

.section-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions button {
        width: 100%;
    }
}