/* ===== Header Global (Style Admin Panel) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card, #151a21);
  background-image: 
    linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--border, #1e2530);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
  position: relative;
  overflow: visible;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
  animation: headerShine 10s ease-in-out infinite;
  pointer-events: none;
}

@keyframes headerShine {
  0% {
    left: -100%;
  }
  50%, 100% {
    left: 100%;
  }
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--brand, #6366f1);
  transition: var(--transition, all 0.2s cubic-bezier(0.4, 0, 0.2, 1));
}

.logo:hover {
  color: var(--brand-hover, #818cf8);
  transform: translateY(-1px);
}

/* Navigation */
.nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-root {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-root > li > a,
.dd-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius, 12px);
  color: var(--text-secondary, #9ca3af);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
}

.nav-root > li > a:hover,
.dd-label:hover {
  background: var(--bg-card, #151a21);
  color: var(--text-primary, #e8ecf0);
}

.nav-root > li > a.active {
  background: var(--brand-light, rgba(99, 102, 241, 0.1));
  color: var(--brand, #6366f1);
}

/* Dropdown */
.has-dropdown {
  position: relative;
  z-index: 1002;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-elevated, #0f1419);
  border: 1px solid var(--border, #1e2530);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
  padding: 8px;
  display: none;
  z-index: 1003;
  max-height: min(80vh, 420px);
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.has-dropdown:hover > .dropdown,
.has-dropdown > .dropdown:hover {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Délai pour éviter la fermeture trop rapide */
.has-dropdown::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 12px;
  z-index: 1002;
}

.has-dropdown:hover::before {
  display: block;
}

.dropdown a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-primary, #e8ecf0);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: var(--transition);
}

.dropdown a:hover {
  background: var(--bg-card, #151a21);
  color: var(--brand, #6366f1);
}

/* Toggle mobile */
.dd-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Actions */
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Theme Toggle Switch */
.theme-toggle {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.theme-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 32px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  padding: 4px;
}

.theme-toggle-slider:before {
  content: '';
  position: absolute;
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 3px;
  background-color: var(--text-primary);
  border-radius: 50%;
  transition: var(--transition);
  z-index: 2;
}

.theme-toggle-input:checked + .theme-toggle-slider {
  background-color: var(--brand);
  border-color: var(--brand);
}

.theme-toggle-input:checked + .theme-toggle-slider:before {
  transform: translateX(24px);
  background-color: white;
}

.theme-toggle-icon {
  position: absolute;
  font-size: 16px;
  transition: var(--transition);
  z-index: 1;
}

.theme-toggle-icon:first-child {
  left: 8px;
  opacity: 1;
}

.theme-toggle-icon:last-child {
  right: 8px;
  opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-slider .theme-toggle-icon:first-child {
  opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-slider .theme-toggle-icon:last-child {
  opacity: 1;
}

.theme-toggle:hover .theme-toggle-slider {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

/* Burger menu mobile */
.nav-toggle {
  display: none;
}

.burger {
  width: 32px;
  height: 32px;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
}

.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary, #e8ecf0);
  border-radius: 2px;
  transition: var(--transition);
}

/* Responsive */
@media (max-width: 980px) {
  .burger {
    display: flex;
  }

  .nav {
    position: fixed;
    inset: 60px 16px auto 16px;
    background: var(--bg-elevated, #0f1419);
    border: 1px solid var(--border, #1e2530);
    border-radius: var(--radius, 12px);
    padding: 12px;
    display: none;
    z-index: 1002;
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
  }

  .nav-root {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .nav-root > li > a {
    display: none;
  }

  .dd-label {
    display: block;
  }

  .has-dropdown .dropdown {
    position: relative;
    top: 0;
    left: 0;
    box-shadow: none;
    border: none;
    padding: 0;
    margin-top: 8px;
    display: none;
  }

  .dd-toggle:checked ~ .dropdown {
    display: block;
  }

  .nav-toggle:checked ~ .nav {
    display: block;
  }

  .nav-toggle:checked + .burger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle:checked + .burger span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle:checked + .burger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
}
