/* =====================================================
   VARIABLES CSS AMÉLIORÉES - Design System
===================================================== */

:root {
  /* ===== COULEURS - Mode Sombre (défaut) ===== */
  --color-bg-dark: #000000;
  --color-bg-darker: #0a0a0a;
  --color-surface-1: #0f0f0f;
  --color-surface-2: #141414;
  --color-surface-3: #1a1a1a;
  --color-surface-4: #202020;
  
  /* Palette Primaire */
  --color-primary: #dc2626;
  --color-primary-50: #fef2f2;
  --color-primary-100: #fee2e2;
  --color-primary-200: #fecaca;
  --color-primary-300: #fca5a5;
  --color-primary-400: #f87171;
  --color-primary-500: #ef4444;
  --color-primary-600: #dc2626;
  --color-primary-700: #b91c1c;
  --color-primary-800: #991b1b;
  --color-primary-900: #7f1d1d;
  
  /* Palette Secondaire */
  --color-secondary: #6366f1;
  --color-secondary-600: #4f46e5;
  --color-secondary-700: #4338ca;
  
  /* Statut Couleurs */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Texte */
  --color-text: #f5f5f5;
  --color-text-secondary: #d4d4d4;
  --color-text-muted: #a3a3a3;
  --color-text-subtle: #737373;
  --color-text-disabled: #525252;
  
  /* Borders & Dividers */
  --color-border: #1f1f1f;
  --color-border-light: #2a2a2a;
  --color-divider: #262626;
  
  /* ===== TYPO ===== */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-display: 'Inter', sans-serif;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Font Weight */
  --fw-light: 300;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  
  /* Line Height */
  --lh-tight: 1.25;
  --lh-snug: 1.375;
  --lh-normal: 1.5;
  --lh-relaxed: 1.625;
  --lh-loose: 2;
  
  /* ===== ESPACEMENTS ===== */
  --spacing-0: 0;
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-7: 1.75rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;
  --spacing-14: 3.5rem;
  --spacing-16: 4rem;
  --spacing-20: 5rem;
  --spacing-24: 6rem;
  
  /* ===== BORDER RADIUS ===== */
  --radius-none: 0;
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-base: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* ===== TRANSITIONS & ANIMATIONS ===== */
  --transition-fast: 75ms ease-in-out;
  --transition-base: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Easing Functions */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* ===== OMBRES ===== */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  
  /* Glow Effects */
  --glow-primary: 0 0 15px rgba(220, 38, 38, 0.2);
  --glow-primary-strong: 0 0 30px rgba(220, 38, 38, 0.4);
  --glow-secondary: 0 0 15px rgba(99, 102, 241, 0.2);
  --glow-success: 0 0 15px rgba(16, 185, 129, 0.2);
  
  /* ===== Z-INDEX ===== */
  --z-hide: -1;
  --z-auto: auto;
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 500;
  --z-fixed: 1000;
  --z-header: 1000;
  --z-modal-backdrop: 1400;
  --z-modal: 1500;
  --z-popover: 1600;
  --z-tooltip: 1700;
  --z-notification: 1800;
  
  /* ===== LAYOUT ===== */
  --container-max-width: 1280px;
  --container-padding: var(--spacing-6);
  --sidebar-width: 280px;
  --header-height: 64px;
  
  /* ===== COULEURS RGB (pour alpha) ===== */
  --header-bg-rgb: 0, 0, 0;
  --color-bg: var(--color-bg-dark);
  --color-surface: var(--color-surface-1);
}

/* ===== MODE CLAIR ===== */
:root.light-mode {
  --color-bg-dark: #ffffff;
  --color-bg-darker: #f9fafb;
  --color-surface-1: #ffffff;
  --color-surface-2: #f9fafb;
  --color-surface-3: #f3f4f6;
  --color-surface-4: #e5e7eb;
  
  --color-text: #111827;
  --color-text-secondary: #374151;
  --color-text-muted: #6b7280;
  --color-text-subtle: #9ca3af;
  --color-text-disabled: #d1d5db;
  
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  --color-divider: #f0f0f0;
  
  --color-primary-50: #fef2f2;
  --color-primary-600: #b91c1c;
  --color-primary-700: #991b1b;
  
  --glow-primary: 0 0 15px rgba(185, 28, 28, 0.15);
  --glow-primary-strong: 0 0 30px rgba(185, 28, 28, 0.25);
  
  --header-bg-rgb: 255, 255, 255;
  --color-bg: var(--color-bg-dark);
  --color-surface: var(--color-surface-1);
}

/* =====================================================
   RESET & BASE
===================================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg-dark);
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* =====================================================
   TYPOGRAPHIE
===================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
}

h2 {
  font-size: var(--text-3xl);
  font-weight: 700;
}

h3 {
  font-size: var(--text-2xl);
  font-weight: 600;
}

h4 {
  font-size: var(--text-xl);
  font-weight: 600;
}

h5 {
  font-size: var(--text-lg);
  font-weight: 600;
}

h6 {
  font-size: var(--text-base);
  font-weight: 600;
}

p {
  line-height: var(--lh-relaxed);
  color: var(--color-text-secondary);
}

small {
  font-size: var(--text-sm);
}

code, pre {
  font-family: var(--font-mono);
  background-color: var(--color-surface-3);
  border-radius: var(--radius-sm);
}

/* =====================================================
   COMPOSANTS RÉUTILISABLES
===================================================== */

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-4);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn--primary:hover:not(:disabled) {
  background: var(--color-primary-700);
  box-shadow: var(--glow-primary-strong);
  transform: translateY(-2px);
}

.btn--secondary {
  background: var(--color-secondary);
  color: white;
}

.btn--secondary:hover:not(:disabled) {
  background: var(--color-secondary-700);
  transform: translateY(-2px);
}

.btn--success {
  background: var(--color-success);
  color: white;
}

.btn--danger {
  background: var(--color-error);
  color: white;
}

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

.btn--outline:hover:not(:disabled) {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.btn--sm {
  padding: var(--spacing-1) var(--spacing-2);
  font-size: var(--text-xs);
}

.btn--lg {
  padding: var(--spacing-3) var(--spacing-6);
  font-size: var(--text-base);
}

.btn--block {
  width: 100%;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-4);
}

label {
  font-weight: var(--fw-medium);
  color: var(--color-text);
  font-size: var(--text-sm);
}

input,
textarea,
select {
  padding: var(--spacing-2) var(--spacing-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface-2);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

input::placeholder {
  color: var(--color-text-subtle);
}

/* Cards */
.card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--color-border-light);
  box-shadow: var(--shadow-md);
}

.card--elevated {
  box-shadow: var(--shadow-md);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  background-color: var(--color-surface-3);
  color: var(--color-text);
}

.badge--primary {
  background-color: rgba(220, 38, 38, 0.15);
  color: var(--color-primary);
}

.badge--success {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
}

/* Alerts */
.alert {
  padding: var(--spacing-4);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--spacing-3);
  align-items: flex-start;
  margin-bottom: var(--spacing-4);
}

.alert--info {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-info);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.alert--success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert--warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert--error {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =====================================================
   ANIMATIONS
===================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-fade-in {
  animation: fadeIn var(--transition-slow);
}

.animate-slide-up {
  animation: slideInUp var(--transition-slow);
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* =====================================================
   ACCESSIBILITÉ
===================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: light) {
  :root:not(.dark-mode) {
    color-scheme: light;
  }
}

/* Focus visible pour accessibilité */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* =====================================================
   UTILITAIRES
===================================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: var(--spacing-2); }
.gap-4 { gap: var(--spacing-4); }

.mt-2 { margin-top: var(--spacing-2); }
.mt-4 { margin-top: var(--spacing-4); }
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-4 { margin-bottom: var(--spacing-4); }
.p-4 { padding: var(--spacing-4); }
.p-6 { padding: var(--spacing-6); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 768px) {
  :root {
    --text-4xl: 1.875rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
    --container-padding: var(--spacing-4);
  }
  
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
  
  .sidebar {
    width: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: var(--z-modal);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: var(--spacing-4);
  }
}

@media (max-width: 480px) {
  :root {
    --text-2xl: 1.125rem;
    --text-xl: 1rem;
    --container-padding: var(--spacing-3);
  }
  
  .btn {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--text-xs);
  }
  
  .card {
    padding: var(--spacing-4);
  }
}

/* =====================================================
   PRINT STYLES
===================================================== */

@media print {
  body {
    background: white;
    color: black;
  }
  
  .no-print {
    display: none !important;
  }
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media screen and (min-width: 1024px) {
  .container {
    padding: 0 3rem;
  }
}
