/* ========================================
   DASHBOARD AVEC SIDEBAR VERTICALE
   Bureau des Légendes - Style Moderne
   ======================================== */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --sidebar-bg: #1a1d29;
  --sidebar-bg-light: #252939;
  --sidebar-text: #a6b0cf;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #1e90ff;
  --sidebar-accent-hover: #4da6ff;
  --content-bg: #0d0d0d;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.1);
  --transition-speed: 0.3s;
}

/* ========================================
   RESET & BASE
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--content-bg);
  color: #fff;
  overflow-x: hidden;
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   SIDEBAR VERTICALE
   ======================================== */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform var(--transition-speed) ease, width var(--transition-speed) ease;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Logo Header */
.sidebar-header {
  padding: 25px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  font-size: 1.5rem;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sidebar-text-active);
  white-space: nowrap;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* Navigation Menu */
.sidebar-nav {
  padding: 20px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 10px;
}

.nav-section-title {
  padding: 10px 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-accent);
}

.nav-link.active {
  background: rgba(30, 144, 255, 0.1);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-accent);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--sidebar-accent);
  box-shadow: 0 0 10px var(--sidebar-accent);
}

.nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
}

.nav-badge {
  background: var(--sidebar-accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

/* Liens externes (Mon Profil, Guide, etc.) */
.nav-link-external {
  opacity: 0.9;
}

.nav-link-external:hover {
  opacity: 1;
}

/* Sidebar Footer avec bouton Déconnexion */
.sidebar-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ========================================
   CONTENT AREA
   ======================================== */

.dashboard-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  background: var(--content-bg);
  transition: margin-left var(--transition-speed) ease;
}

/* Topbar */
.topbar {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 999;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Bouton burger mobile */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--sidebar-text-active);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.topbar-title {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1e90ff, #4da6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-breadcrumb {
  font-size: 0.9rem;
  color: var(--sidebar-text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e90ff, #4da6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.topbar-user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-logout {
  padding: 10px 20px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Main Content */
.main-content {
  padding: 30px;
}

/* Section Pages */
.section-page {
  display: none;
}

.section-page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   CARDS & COMPONENTS
   ======================================== */

.page-header {
  margin-bottom: 30px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-description {
  font-size: 1rem;
  color: var(--sidebar-text);
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 25px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(30, 144, 255, 0.2);
  border-color: var(--sidebar-accent);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-icon {
  font-size: 1.5rem;
  opacity: 0.5;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--sidebar-text-active);
  line-height: 1;
  margin-bottom: 10px;
}

.stat-trend {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-trend.up {
  color: #10b981;
}

.stat-trend.down {
  color: #ef4444;
}

.content-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-badge {
  background: var(--sidebar-accent);
  color: white;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 992px) {
  /* Sidebar cachée par défaut sur mobile */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  }

  /* Sidebar visible quand menu burger cliqué */
  .sidebar.sidebar-mobile-open {
    transform: translateX(0);
  }

  /* Overlay pour fermer le menu en cliquant à côté */
  .sidebar.sidebar-mobile-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  /* Afficher le bouton burger sur mobile */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Contenu prend toute la largeur sur mobile */
  .dashboard-content {
    margin-left: 0;
  }

  /* Topbar plus compacte */
  .topbar {
    padding: 15px 20px;
  }

  .topbar-title {
    font-size: 1.3rem;
  }

  .topbar-breadcrumb {
    display: none;
  }

  .header-subtitle {
    display: none !important;
  }

  .topbar-user-name {
    display: none;
  }

  /* Content padding réduit */
  .main-content {
    padding: 20px 15px;
  }

  /* Stats en colonne unique */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Cards plus compactes */
  .content-card {
    padding: 20px 15px;
  }

  .page-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 576px) {
  .topbar {
    padding: 12px 15px;
  }

  .topbar-title {
    font-size: 1.1rem;
  }

  .main-content {
    padding: 15px 10px;
  }

  .stat-value {
    font-size: 2rem;
  }

  .page-title {
    font-size: 1.3rem;
  }
}

/* ========================================
   UTILITIES
   ======================================== */

.text-muted {
  color: var(--sidebar-text);
}

.text-primary {
  color: var(--sidebar-accent);
}

.text-success {
  color: #10b981;
}

.text-danger {
  color: #ef4444;
}

.text-warning {
  color: #f59e0b;
}

.mb-20 {
  margin-bottom: 20px;
}

.mb-30 {
  margin-bottom: 30px;
}
