/*
  assets/css/style.css
  TSSR Notes — Feuille de styles principale
  Design professionnel IT/Réseau
  ─────────────────────────────────────────
  1.  Variables CSS
  2.  Reset & Base
  3.  Typographie
  4.  Layout global
  5.  Navigation (top fixe)
  6.  Sidebar
  7.  Cards & Modules
  8.  Badges
  9.  Boutons
  10. Formulaires & Recherche
  11. Tableaux (zebra stripes)
  12. Blocs de code
  13. Barre de progression
  14. Quiz
  15. Checklist
  16. Glossaire
  17. Ressources
  18. Alertes & Messages
  19. Footer
  20. Utilitaires
  21. Animations
  22. Responsive (mobile-first)
*/

/* ═══════════════════════════════════════════════════════════
   1. VARIABLES CSS
   ═══════════════════════════════════════════════════════════ */


:root {
  /* Accents violets — style Obsidian (Catppuccin Mocha) */
  --primary:        #cba6f7;
  --primary-dark:   #b4befe;
  --primary-light:  rgba(203,166,247,0.15);
  --primary-hover:  #d4b0ff;

  /* Fonds (du plus sombre au plus clair) */
  --bg:             #1e1e2e;
  --bg-secondary:   #181825;
  --bg-tertiary:    #313244;
  --surface:        #24243e;
  --surface-hover:  #2e2e50;

  /* Texte */
  --text:           #cdd6f4;
  --text-secondary: #bac2de;
  --text-muted:     #6c7086;
  --text-inverse:   #11111b;

  /* Statuts */
  --success:        #a6e3a1;
  --success-light:  rgba(166,227,161,0.15);
  --warning:        #f9e2af;
  --warning-light:  rgba(249,226,175,0.15);
  --danger:         #f38ba8;
  --danger-light:   rgba(243,139,168,0.15);
  --info:           #89dceb;
  --info-light:     rgba(137,220,235,0.15);

  /* Badges domaines */
  --badge-reseau:            #89b4fa;
  --badge-reseau-bg:         rgba(137,180,250,0.18);
  --badge-securite:          #f38ba8;
  --badge-securite-bg:       rgba(243,139,168,0.18);
  --badge-linux:             #fab387;
  --badge-linux-bg:          rgba(250,179,135,0.18);
  --badge-windows:           #89dceb;
  --badge-windows-bg:        rgba(137,220,235,0.18);
  --badge-virtualisation:    #cba6f7;
  --badge-virtualisation-bg: rgba(203,166,247,0.18);
  --badge-scripting:         #a6e3a1;
  --badge-scripting-bg:      rgba(166,227,161,0.18);
  --badge-stockage:          #9399b2;
  --badge-stockage-bg:       rgba(147,153,178,0.18);

  /* Code */
  --code-bg:      #11111b;
  --code-text:    #cdd6f4;
  --code-green:   #a6e3a1;
  --code-yellow:  #f9e2af;
  --code-blue:    #89b4fa;
  --code-red:     #f38ba8;
  --code-comment: #6c7086;
  --code-purple:  #cba6f7;
  --code-orange:  #fab387;

  /* Bordures */
  --border:        #313244;
  --border-strong: #45475a;
  --border-focus:  #cba6f7;

  /* Ombres (plus marquées sur fond sombre) */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.55);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.6);

  /* Transitions */
  --transition:      150ms ease;
  --transition-slow: 300ms ease;

  /* Radius */
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* Layout */
  --nav-height:     64px;
  --sidebar-width:  260px;
  --content-max:    1200px;
  --content-pad:    24px;

  /* Typographie */
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --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;
  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --leading-tight:   1.25;
  --leading-snug:    1.375;
  --leading-normal:  1.5;
  --leading-relaxed: 1.625;
}

/* ── Light theme ── */
[data-theme="light"] {
  --primary:        #7c3aed;
  --primary-dark:   #5b21b6;
  --primary-light:  rgba(124,58,237,0.1);
  --primary-hover:  #6d28d9;

  --bg:             #f8f9fc;
  --bg-secondary:   #f1f3f8;
  --bg-tertiary:    #e4e7ef;
  --surface:        #ffffff;
  --surface-hover:  #f0f0f8;

  --text:           #1e1e2e;
  --text-secondary: #3a3a5c;
  --text-muted:     #7c7fa0;
  --text-inverse:   #ffffff;

  --success:        #16a34a;
  --success-light:  rgba(22,163,74,0.1);
  --warning:        #b45309;
  --warning-light:  rgba(180,83,9,0.1);
  --danger:         #dc2626;
  --danger-light:   rgba(220,38,38,0.1);
  --info:           #0369a1;
  --info-light:     rgba(3,105,161,0.1);

  --badge-reseau:            #1d4ed8;
  --badge-reseau-bg:         rgba(29,78,216,0.1);
  --badge-securite:          #be123c;
  --badge-securite-bg:       rgba(190,18,60,0.1);
  --badge-linux:             #c2410c;
  --badge-linux-bg:          rgba(194,65,12,0.1);
  --badge-windows:           #0369a1;
  --badge-windows-bg:        rgba(3,105,161,0.1);
  --badge-virtualisation:    #7c3aed;
  --badge-virtualisation-bg: rgba(124,58,237,0.1);
  --badge-scripting:         #15803d;
  --badge-scripting-bg:      rgba(21,128,61,0.1);
  --badge-stockage:          #475569;
  --badge-stockage-bg:       rgba(71,85,105,0.1);

  --code-bg:      #1e1e2e;
  --code-text:    #cdd6f4;

  --border:        #d1d5e8;
  --border-strong: #b0b7d4;
  --border-focus:  #7c3aed;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);
}

/* ── Bouton toggle thème ── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.08);
}

/* Touches clavier */
kbd, .key {
  background: #313244;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-bottom: 3px solid #585b70;
  border-radius: 5px;
  padding: 2px 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

/* ═══════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text);
  background-color: var(--bg-secondary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ═══════════════════════════════════════════════════════════
   3. TYPOGRAPHIE
   ═══════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text);
  letter-spacing: -0.015em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: 16px;
}

p:last-child { margin-bottom: 0; }

strong, b { font-weight: var(--weight-semibold); color: var(--text); }
em, i { font-style: italic; }

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

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Section titles avec accent */
.section-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.2em;
  background: var(--primary);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════
   4. LAYOUT GLOBAL
   ═══════════════════════════════════════════════════════════ */

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Zone principale sous la nav */
.main-container {
  display: flex;
  flex: 1;
  padding-top: var(--nav-height);
}

/* Contenu principal sans sidebar */
.main-content {
  flex: 1;
  padding: 32px var(--content-pad);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

/* Contenu principal avec sidebar */
.has-sidebar .main-content {
  margin-left: var(--sidebar-width);
  max-width: calc(var(--content-max) + var(--sidebar-width));
}

/* Grille de cards */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* Container centré */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad);
}

/* ═══════════════════════════════════════════════════════════
   5. NAVIGATION (TOP FIXE)
   ═══════════════════════════════════════════════════════════ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 100;
  display: flex;
  align-items: center;
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: calc(var(--content-max) + var(--sidebar-width) + var(--content-pad) * 2);
  margin: 0 auto;
  padding: 0 var(--content-pad);
  gap: 24px;
}

/* Logo */
.navbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--text);
  flex-shrink: 0;
  text-decoration: none;
}

.navbar__logo:hover { color: var(--primary); }

.navbar__logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}

.navbar__logo-text span {
  color: var(--primary);
}

/* Liens de navigation */
.navbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.navbar__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.navbar__link:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.navbar__link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: var(--weight-semibold);
}

.navbar__link-icon {
  font-size: 16px;
  opacity: 0.75;
}

/* Actions droite */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Menu burger (mobile) */
.navbar__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
}

.navbar__burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: var(--radius-full);
  transition: transform var(--transition), opacity var(--transition);
}

.navbar__burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar__burger.open span:nth-child(2) { opacity: 0; }
.navbar__burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu mobile */
.navbar__mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 12px var(--content-pad);
  z-index: 99;
  flex-direction: column;
  gap: 4px;
}

.navbar__mobile-menu.open { display: flex; }

.navbar__mobile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.navbar__mobile-link:hover,
.navbar__mobile-link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ═══════════════════════════════════════════════════════════
   6. SIDEBAR
   ═══════════════════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Groupe de liens */
.sidebar__group {
  margin-bottom: 24px;
}

.sidebar__group-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 16px 8px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar__link:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.sidebar__link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: var(--weight-semibold);
}

.sidebar__link-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar__link.active .sidebar__link-icon { opacity: 1; }

/* Sous-menu sidebar */
.sidebar__sub {
  padding-left: 28px;
}

.sidebar__sub .sidebar__link {
  font-size: var(--text-xs);
  padding: 6px 16px 6px 12px;
}

/* Indicateur de progression dans la sidebar */
.sidebar__progress {
  padding: 0 16px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.sidebar__progress-bar {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sidebar__progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.sidebar__progress-text {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   7. CARDS & MODULES
   ═══════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card--flat { box-shadow: none; }
.card--flat:hover { box-shadow: var(--shadow); }

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-secondary);
}

.card__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__body {
  padding: 20px;
}

.card__footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Card de module cours */
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition-slow), transform var(--transition-slow);
  display: flex;
  flex-direction: column;
}

.module-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-3px);
}

.module-card__accent {
  height: 5px;
  background: var(--primary);
}

/* Couleur d'accent par domaine */
.module-card[data-domain="reseau"] .module-card__accent { background: var(--badge-reseau); }
.module-card[data-domain="securite"] .module-card__accent { background: var(--badge-securite); }
.module-card[data-domain="linux"] .module-card__accent { background: var(--badge-linux); }
.module-card[data-domain="windows"] .module-card__accent { background: var(--badge-windows); }
.module-card[data-domain="virtualisation"] .module-card__accent { background: var(--badge-virtualisation); }
.module-card[data-domain="scripting"] .module-card__accent { background: var(--badge-scripting); }
.module-card[data-domain="stockage"] .module-card__accent { background: var(--badge-stockage); }

.module-card__header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.module-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.module-card__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: 4px;
  line-height: var(--leading-snug);
}

.module-card__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  padding: 0 20px 12px;
  flex: 1;
}

.module-card__meta {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.module-card__progress {
  padding: 0 20px 16px;
}

.module-card__progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Stat card (tableau de bord) */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card__icon--blue   { background: var(--primary-light);         color: var(--primary-dark); }
.stat-card__icon--green  { background: var(--success-light);         color: var(--success); }
.stat-card__icon--orange { background: var(--warning-light);         color: var(--warning); }
.stat-card__icon--red    { background: var(--danger-light);          color: var(--danger); }
.stat-card__icon--purple { background: var(--badge-virtualisation-bg); color: var(--badge-virtualisation); }

.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   8. BADGES
   ═══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Badges de domaine */
.badge--reseau        { background: var(--badge-reseau-bg);        color: var(--badge-reseau); }
.badge--securite      { background: var(--badge-securite-bg);      color: var(--badge-securite); }
.badge--linux         { background: var(--badge-linux-bg);         color: var(--badge-linux); }
.badge--windows       { background: var(--badge-windows-bg);       color: var(--badge-windows); }
.badge--virtualisation{ background: var(--badge-virtualisation-bg);color: var(--badge-virtualisation); }
.badge--scripting     { background: var(--badge-scripting-bg);     color: var(--badge-scripting); }
.badge--stockage      { background: var(--badge-stockage-bg);      color: var(--badge-stockage); }

/* Badges de statut */
.badge--success { background: var(--success-light); color: var(--success); }
.badge--warning { background: var(--warning-light); color: var(--warning); }
.badge--danger  { background: var(--danger-light);  color: var(--danger); }
.badge--info    { background: var(--info-light);    color: var(--info); }
.badge--neutral { background: var(--bg-tertiary);   color: var(--text-secondary); }

/* Badge outline */
.badge--outline {
  background: transparent;
  border: 1px solid currentColor;
  opacity: 0.85;
}

/* Badge taille large */
.badge--lg {
  font-size: var(--text-sm);
  padding: 5px 14px;
}

/* ═══════════════════════════════════════════════════════════
   9. BOUTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Variantes */
.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--primary:hover  { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn--primary:active { background: var(--primary-dark); }

.btn--secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover { background: var(--bg-tertiary); border-color: var(--border-strong); color: var(--text); }

.btn--ghost {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--primary-light); color: var(--primary-dark); }

.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn--danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; }

.btn--success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn--success:hover { background: #059669; border-color: #059669; color: #fff; }

.btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--outline:hover { background: var(--primary-light); color: var(--primary-dark); }

/* Tailles */
.btn--sm  { padding: 6px 12px; font-size: var(--text-xs); }
.btn--lg  { padding: 12px 24px; font-size: var(--text-base); }
.btn--xl  { padding: 14px 28px; font-size: var(--text-lg); }
.btn--icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
}
.btn--icon.btn--sm { width: 28px; height: 28px; padding: 4px; }

/* Groupe de boutons */
.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-group--tight {
  gap: 0;
}

.btn-group--tight .btn {
  border-radius: 0;
  border-right-width: 1px;
}

.btn-group--tight .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group--tight .btn:last-child  { border-radius: 0 var(--radius) var(--radius) 0; border-right-width: 2px; }

/* ═══════════════════════════════════════════════════════════
   10. FORMULAIRES & RECHERCHE
   ═══════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239CA3AF' d='M1.41 0L6 4.58 10.59 0 12 1.41 6 7.41 0 1.41z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Barre de recherche */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar__icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-bar .form-input {
  padding-left: 38px;
}

.search-bar__clear {
  position: absolute;
  right: 10px;
  padding: 4px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  display: none;
}

.search-bar__clear:hover { color: var(--text); }
.search-bar .form-input:not(:placeholder-shown) ~ .search-bar__clear { display: block; }

/* Filtres rapides */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.filter-chip:hover { background: var(--bg-tertiary); color: var(--text); }

.filter-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: var(--weight-semibold);
}

/* ═══════════════════════════════════════════════════════════
   11. TABLEAUX (ZEBRA STRIPES)
   ═══════════════════════════════════════════════════════════ */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

/* En-tête */
thead tr {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-strong);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  white-space: nowrap;
  user-select: none;
}

/* Tri */
thead th.sortable {
  cursor: pointer;
}

thead th.sortable:hover { color: var(--primary); }

thead th.sort-asc::after  { content: ' ↑'; color: var(--primary); }
thead th.sort-desc::after { content: ' ↓'; color: var(--primary); }

/* Corps */
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: rgba(255,255,255,0.03); }
tbody tr:hover { background: var(--primary-light); }

tbody td {
  padding: 11px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td:first-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

/* Code dans les tableaux */
tbody td code {
  font-size: var(--text-xs);
}

/* Pied de tableau */
tfoot tr {
  background: var(--bg-secondary);
  border-top: 2px solid var(--border);
}

tfoot td {
  padding: 10px 16px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

/* ═══════════════════════════════════════════════════════════
   12. BLOCS DE CODE
   ═══════════════════════════════════════════════════════════ */

.code-block {
  background: var(--code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin: 16px 0;
  border: 1px solid rgba(255,255,255,.06);
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.code-block__lang {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--code-comment);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-block__dots {
  display: flex;
  gap: 6px;
}

.code-block__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-block__dot--red    { background: #FF5F57; }
.code-block__dot--yellow { background: #FFBD2E; }
.code-block__dot--green  { background: #28C840; }

.code-block__copy {
  font-size: var(--text-xs);
  color: var(--code-comment);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  font-family: var(--font-sans);
}

.code-block__copy:hover {
  color: var(--code-text);
  background: rgba(255,255,255,.08);
}

.code-block__copy.copied { color: var(--code-green); border-color: var(--code-green); }

/* Corps du code */
.code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.code-block pre::-webkit-scrollbar { height: 6px; }
.code-block pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.code-block code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--code-text);
  background: none;
  border: none;
  padding: 0;
  display: block;
  white-space: pre;
}

/* Numéros de ligne */
.code-block--lined code {
  counter-reset: line;
}

.code-block--lined .line {
  counter-increment: line;
  display: block;
  padding-left: 48px;
  position: relative;
}

.code-block--lined .line::before {
  content: counter(line);
  position: absolute;
  left: 0;
  width: 36px;
  text-align: right;
  color: var(--code-comment);
  font-size: var(--text-xs);
  user-select: none;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.08);
}

/* Coloration syntaxique (classes CSS) */
.token-keyword  { color: var(--code-purple); font-weight: var(--weight-medium); }
.token-string   { color: var(--code-green); }
.token-number   { color: var(--code-orange); }
.token-comment  { color: var(--code-comment); font-style: italic; }
.token-function { color: var(--code-blue); }
.token-variable { color: var(--code-yellow); }
.token-operator { color: var(--code-red); }
.token-param    { color: var(--code-orange); }
.token-command  { color: var(--code-green); font-weight: var(--weight-medium); }
.token-flag     { color: var(--code-yellow); }
.token-path     { color: var(--code-blue); text-decoration: underline; text-underline-offset: 2px; }
.token-ip       { color: var(--code-orange); }

/* Ligne surlignée */
.line--highlight {
  background: rgba(37, 99, 235, 0.15);
  margin: 0 -20px;
  padding: 0 20px;
}

/* Terminal inline */
.code-inline-term {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--code-bg);
  color: var(--code-green);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.08);
}

.code-inline-term::before { content: '$'; color: var(--code-comment); }

/* ═══════════════════════════════════════════════════════════
   13. BARRE DE PROGRESSION
   ═══════════════════════════════════════════════════════════ */

.progress {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress--sm { height: 4px; }
.progress--lg { height: 12px; }
.progress--xl { height: 16px; }

.progress__bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 600ms cubic-bezier(.4, 0, .2, 1);
  position: relative;
}

/* Animation shimmer */
.progress__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,.25) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
}

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

/* Couleurs de progression */
.progress__bar--success { background: var(--success); }
.progress__bar--warning { background: var(--warning); }
.progress__bar--danger  { background: var(--danger); }

/* Progression avec label */
.progress-labeled {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-labeled .progress { flex: 1; }

.progress-labeled__value {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}

/* Barre de progression de page (top) */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  z-index: 200;
  transition: width 200ms linear;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
}

/* Cercle de progression */
.progress-circle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-circle svg {
  transform: rotate(-90deg);
}

.progress-circle__track {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 5;
}

.progress-circle__fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms cubic-bezier(.4, 0, .2, 1);
}

.progress-circle__label {
  position: absolute;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════
   14. QUIZ
   ═══════════════════════════════════════════════════════════ */

.quiz-container {
  max-width: 740px;
  margin: 0 auto;
}

.quiz-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.quiz-header__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.quiz-question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.quiz-question__number {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.quiz-question__text {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--text);
  line-height: var(--leading-snug);
  margin-bottom: 20px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.quiz-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--text);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: var(--weight-medium);
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.quiz-option__indicator {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-option.selected .quiz-option__indicator {
  background: var(--primary);
  border-color: var(--primary);
}

.quiz-option.selected .quiz-option__indicator::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

/* Explication */
.quiz-explanation {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--info-light);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--primary);
  display: none;
}

.quiz-explanation.visible { display: block; }

/* Résultat final */
.quiz-result {
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.quiz-result__score {
  font-size: 64px;
  font-weight: var(--weight-bold);
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.quiz-result__label {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════
   15. CHECKLIST
   ═══════════════════════════════════════════════════════════ */

.checklist {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.checklist__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.checklist__title {
  font-weight: var(--weight-semibold);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}

.checklist__item:last-child { border-bottom: none; }
.checklist__item:hover { background: var(--bg-secondary); }

.checklist__item.done {
  background: rgba(166,227,161,0.08);
}

.checklist__item.done .checklist__item-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checklist__checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-top: 1px;
  transition: background var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checklist__item.done .checklist__checkbox {
  background: var(--success);
  border-color: var(--success);
}

.checklist__item.done .checklist__checkbox::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: var(--weight-bold);
  line-height: 1;
}

.checklist__item-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  flex: 1;
}

.checklist__item-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Checklist inline dans les sections de cours ── */

.section-checklist { }

.checklist-progress {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checklist-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--bg-secondary); }

/* Cacher la checkbox native */
.checklist-checkbox { display: none; }

/* Case custom */
.checkmark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  background: var(--surface);
}

/* État coché */
.checklist-checkbox:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checklist-checkbox:checked + .checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}

/* Texte barré quand coché */
.checklist-checkbox:checked ~ .checklist-text {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.7;
}

.checklist-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  flex: 1;
  transition: color var(--transition), opacity var(--transition);
}


/* ═══════════════════════════════════════════════════════════
   16. GLOSSAIRE
   ═══════════════════════════════════════════════════════════ */

.glossary-index {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 24px;
}

.glossary-letter {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.glossary-letter:hover { background: var(--bg-tertiary); color: var(--text); }
.glossary-letter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.glossary-letter.disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.glossary-section {
  margin-bottom: 32px;
}

.glossary-section__letter {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  margin-bottom: 12px;
}

.glossary-entry {
  padding: 14px 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  border-left: 3px solid transparent;
}

.glossary-entry:hover {
  background: var(--bg-secondary);
  border-left-color: var(--primary);
}

.glossary-entry__term {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.glossary-entry__def {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   17. RESSOURCES
   ═══════════════════════════════════════════════════════════ */

.resource-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--transition), border-color var(--transition);
  text-decoration: none;
  color: inherit;
}

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

.resource-card__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.resource-card__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: 3px;
}

.resource-card__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
  margin: 0;
}

.resource-card__meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-card__url {
  font-size: var(--text-xs);
  color: var(--primary);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* ═══════════════════════════════════════════════════════════
   18. ALERTES & MESSAGES
   ═══════════════════════════════════════════════════════════ */

.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: var(--text-sm);
  margin: 16px 0;
}

.alert__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.alert__title {
  font-weight: var(--weight-semibold);
  margin-bottom: 2px;
}

.alert__body { color: inherit; opacity: 0.85; }

.alert--info    { background: var(--info-light);    border-color: var(--info);    color: var(--info); }
.alert--success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.alert--warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.alert--danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger); }

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  animation: toast-in 300ms cubic-bezier(.4, 0, .2, 1);
  max-width: 360px;
}

.toast--success { background: var(--success); }
.toast--danger  { background: var(--danger); }
.toast--warning { background: #D97706; }

@keyframes toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(16px); opacity: 0; }
}

.toast.hiding { animation: toast-out 300ms cubic-bezier(.4, 0, .2, 1) forwards; }

/* ═══════════════════════════════════════════════════════════
   19. FOOTER
   ═══════════════════════════════════════════════════════════ */

.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 24px var(--content-pad);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer__links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer__link {
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer__link:hover { color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   19b. AUTHENTIFICATION — Avatar, dropdown, modal
   ═══════════════════════════════════════════════════════════ */

/* ── Slot auth dans la navbar ── */
.navbar__auth-slot {
  position: relative;
  display: flex;
  align-items: center;
}

/* ── Avatar ── */
.user-avatar-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: border-color var(--transition);
}

.user-avatar-btn:hover,
.user-avatar-btn[aria-expanded="true"] {
  border-color: var(--primary);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  user-select: none;
}

.user-avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Dropdown ── */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 230px;
  z-index: 500;
  overflow: hidden;
  display: none;
  animation: dropdown-in 0.12s ease;
}

.user-dropdown.open { display: block; }

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-dropdown__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.user-dropdown__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  line-height: 1.3;
}

.user-dropdown__email {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
  word-break: break-all;
}

.user-dropdown__divider {
  height: 1px;
  background: var(--border);
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.user-dropdown__item:hover { background: var(--bg-secondary); color: var(--text); }

.user-dropdown__item--danger { color: var(--danger); }
.user-dropdown__item--danger:hover { background: var(--danger-light); color: var(--danger); }

/* ── Modal d'authentification ── */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.auth-modal.open { display: flex; }

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.auth-modal__card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  margin: 16px;
  padding: 32px;
  z-index: 1;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.auth-modal__close:hover { color: var(--text); background: var(--bg-secondary); }

.auth-modal__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-modal__brand {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.auth-modal__brand strong { color: var(--primary); }

/* ── Onglets ── */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  gap: 0;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 8px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.auth-tab:hover { color: var(--text); }

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Formulaire ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-submit {
  width: 100%;
  padding: 11px;
  font-size: var(--text-base);
  margin-top: 4px;
}

.auth-error {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: var(--text-sm);
  padding: 10px 14px;
  margin-bottom: 4px;
  line-height: 1.4;
}

.auth-switch {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 16px;
  margin-bottom: 0;
}

.auth-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-link:hover { color: var(--primary-dark); }

.auth-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-normal);
}

/* ═══════════════════════════════════════════════════════════
   20. UTILITAIRES
   ═══════════════════════════════════════════════════════════ */

/* Affichage */
.hidden  { display: none !important; }
.visible { display: block !important; }
.flex    { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-1  { flex: 1; }
.gap-4   { gap: 4px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-24  { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }

/* Espacement */
.mt-4  { margin-top:    4px;  }
.mt-8  { margin-top:    8px;  }
.mt-16 { margin-top:   16px;  }
.mt-24 { margin-top:   24px;  }
.mt-32 { margin-top:   32px;  }
.mb-4  { margin-bottom:  4px; }
.mb-8  { margin-bottom:  8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16  { padding: 16px; }
.p-20  { padding: 20px; }
.p-24  { padding: 24px; }

/* Texte */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-lg      { font-size: var(--text-lg); }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.font-mono    { font-family: var(--font-mono); }
.font-medium  { font-weight: var(--weight-medium); }
.font-bold    { font-weight: var(--weight-bold); }
.truncate     { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bordures & arrondis */
.rounded    { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.border     { border: 1px solid var(--border); }

/* Ombres */
.shadow    { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }

/* Fond */
.bg-surface   { background: var(--surface); }
.bg-secondary { background: var(--bg-secondary); }

/* Séparateur avec label */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: 24px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-wave {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton--text  { height: 14px; }
.skeleton--title { height: 24px; }
.skeleton--card  { height: 180px; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb__item { display: flex; align-items: center; gap: 6px; }
.breadcrumb__sep  { opacity: 0.4; }
.breadcrumb__link { color: var(--text-muted); transition: color var(--transition); }
.breadcrumb__link:hover { color: var(--primary); }
.breadcrumb__current { color: var(--text); font-weight: var(--weight-medium); }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 2px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: var(--weight-semibold);
}

/* Accordion */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion__item { border-bottom: 1px solid var(--border); }
.accordion__item:last-child { border-bottom: none; }

.accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition);
  text-align: left;
}

.accordion__trigger:hover { background: var(--bg-secondary); }
.accordion__trigger.open  { background: var(--primary-light); color: var(--primary-dark); }

.accordion__chevron {
  transition: transform var(--transition-slow);
  flex-shrink: 0;
  opacity: 0.6;
}

.accordion__trigger.open .accordion__chevron { transform: rotate(180deg); }

.accordion__body {
  display: none;
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.accordion__body.open { display: block; }

/* ═══════════════════════════════════════════════════════════
   21. ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

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

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}

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

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

.animate-fade-in    { animation: fadeIn    300ms ease forwards; }
.animate-fade-in-up { animation: fadeInUp  300ms ease forwards; }
.animate-scale-in   { animation: scaleIn   200ms ease forwards; }
.animate-pulse      { animation: pulse   1.5s ease infinite; }
.animate-spin       { animation: spin    1s linear infinite; }

/* Délais en cascade pour les grilles */
.stagger > *:nth-child(1) { animation-delay:  0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay:120ms; }
.stagger > *:nth-child(4) { animation-delay:180ms; }
.stagger > *:nth-child(5) { animation-delay:240ms; }
.stagger > *:nth-child(6) { animation-delay:300ms; }

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 36px; height: 36px; border-width: 4px; }

/* Réduction des animations pour l'accessibilité */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:   0.01ms !important;
    transition-duration:  0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   22. RESPONSIVE (MOBILE-FIRST)
   ═══════════════════════════════════════════════════════════ */

/* ── Tablette / Mobile : 768px ── */
@media (max-width: 768px) {
  /* Réduction globale du padding latéral */
  :root { --content-pad: 16px; }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  /* Navigation */
  .navbar__nav { display: none; }
  .navbar__burger { display: flex; }

  /* Sidebar cachée, remplacée par le menu mobile */
  .sidebar { display: none; }
  .has-sidebar .main-content { margin-left: 0; }

  /* Grilles */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }

  /* Cards — désactive le lift au hover (pas de hover sur touch) */
  .card:hover { transform: none; }
  .module-card:hover { transform: none; }

  /* Tableaux */
  table { font-size: var(--text-xs); }
  thead th, tbody td { padding: 8px 10px; }

  /* Code */
  .code-block code { font-size: var(--text-xs); }

  /* Boutons groupés → colonne sur petits écrans */
  .btn-group { flex-wrap: wrap; }
  .btn-group .btn { flex: 1 1 auto; justify-content: center; }

  /* Footer */
  .footer__inner { flex-direction: column; text-align: center; }
  .footer__links { justify-content: center; }

  /* Toast */
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: 100%; }
}

/* ── Mobile étroit : 480px ── */
@media (max-width: 480px) {
  .navbar__logo-text { display: none; }
  .filter-bar { gap: 6px; }
  .filter-chip { font-size: 11px; padding: 4px 10px; }
  .tabs { gap: 0; }
  .tab { padding: 8px 12px; font-size: var(--text-xs); }
  .quiz-question__text { font-size: var(--text-base); }
}

/* ── Desktop large : 1024px+ ── */
@media (min-width: 1024px) {
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ── Desktop XL : 1280px+ ── */
@media (min-width: 1280px) {
}
