/* ============================================================
   EduCarette — Style Sheet Redesign
   A creative & unique open educational resource platform
   for French economics/management courses

   TABLE OF CONTENTS:
   1. CSS Variables (colors, typography, spacing, shadows)
   2. Reset & Base Styles
   3. Typography & Font Loading
   4. Layout & Grid System
   5. Header & Navigation
   6. Hero Section
   7. Section Layouts & Patterns
   8. Matière/Subject Cards
   9. Course Content Page
   10. Auth Modal
   11. Contact Page
   12. About Page (Qui suis-je)
   13. Footer
   14. Buttons & Interactive Elements
   15. Utility Classes
   16. Animations & Transitions
   17. Responsive Design
   ============================================================ */

/* ============================================================
   1. CSS VARIABLES
   ============================================================ */
:root {
  /* === BRAND COLORS === */
  --primary-dark:      #2E1065;
  --primary:           #4F46E5;
  --primary-light:     #7C3AED;
  --primary-lighter:   #A78BFA;

  --secondary:         #0EA5E9;
  --secondary-dark:    #0369A1;

  --accent-1:          #EC4899;
  --accent-2:          #F59E0B;
  --accent-3:          #10B981;
  --accent-4:          #06B6D4;

  /* === MATIÈRE COLORS (Subject-specific) === */
  --matiere-management:        #8B5CF6;
  --matiere-economie:          #3B82F6;
  --matiere-droit:             #EC4899;
  --matiere-sciences-gestion:  #F59E0B;
  --matiere-other:             #06B6D4;

  /* === SEMANTIC COLORS === */
  --success:           #10B981;
  --success-light:     #D1FAE5;
  --warning:           #F59E0B;
  --warning-light:     #FEF3C7;
  --error:             #EF4444;
  --error-light:       #FEE2E2;
  --info:              #0EA5E9;
  --info-light:        #CFF0FF;

  /* === NEUTRALS === */
  --white:             #FFFFFF;
  --off-white:         #F9FAFB;
  --gray-50:           #F9FAFB;
  --gray-100:          #F3F4F6;
  --gray-200:          #E5E7EB;
  --gray-300:          #D1D5DB;
  --gray-400:          #9CA3AF;
  --gray-500:          #6B7280;
  --gray-600:          #4B5563;
  --gray-700:          #374151;
  --gray-800:          #1F2937;
  --gray-900:          #111827;

  --text-primary:      #111827;
  --text-secondary:    #4B5563;
  --text-tertiary:     #9CA3AF;

  --bg-primary:        #FFFFFF;
  --bg-secondary:      #F9FAFB;
  --bg-tertiary:       #F3F4F6;

  /* === SHADOWS === */
  --shadow-xs:         0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm:         0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md:         0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg:         0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-xl:         0 12px 32px rgba(0, 0, 0, 0.18);
  --shadow-2xl:        0 20px 48px rgba(0, 0, 0, 0.2);

  --shadow-glow:       0 0 30px rgba(79, 70, 229, 0.15);
  --shadow-glow-accent: 0 0 30px rgba(124, 58, 237, 0.15);

  /* === TYPOGRAPHY === */
  --font-family-base:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-display: 'Sora', 'Space Grotesk', 'Inter', sans-serif;

  --font-size-xs:      0.75rem;
  --font-size-sm:      0.875rem;
  --font-size-base:    1rem;
  --font-size-lg:      1.125rem;
  --font-size-xl:      1.25rem;
  --font-size-2xl:     1.5rem;
  --font-size-3xl:     1.875rem;
  --font-size-4xl:     2.25rem;
  --font-size-5xl:     3rem;
  --font-size-6xl:     3.75rem;

  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold:  700;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-loose:  2;

  /* === SPACING === */
  --space-xs:          0.25rem;
  --space-sm:          0.5rem;
  --space-md:          1rem;
  --space-lg:          1.5rem;
  --space-xl:          2rem;
  --space-2xl:         3rem;
  --space-3xl:         4rem;
  --space-4xl:         6rem;
  --space-5xl:         8rem;

  /* === SIZING === */
  --container-sm:      640px;
  --container-md:      768px;
  --container-lg:      1024px;
  --container-xl:      1280px;
  --container-2xl:     1440px;

  /* === BORDER RADIUS === */
  --radius-sm:         0.375rem;
  --radius-md:         0.5rem;
  --radius-lg:         0.75rem;
  --radius-xl:         1rem;
  --radius-2xl:        1.5rem;
  --radius-full:       9999px;

  /* === TRANSITIONS === */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* === Z-INDEX === */
  --z-hide:            -1;
  --z-base:            0;
  --z-dropdown:        100;
  --z-sticky:          200;
  --z-fixed:           300;
  --z-modal-bg:        400;
  --z-modal:           500;
  --z-tooltip:         600;
}

/* ============================================================
   2. RESET & BASE STYLES
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  /* overflow-x retiré du body : sur iOS Safari, overflow:hidden sur body
     casse position:sticky (barre d'onglets chapitre.html → rectangle blanc).
     Le overflow-x:hidden sur html suffit à bloquer le scroll horizontal. */
}

main {
  min-height: calc(100vh - 200px);
}

/* ============================================================
   3. TYPOGRAPHY & FONT LOADING
   ============================================================ */
/* Fonts loaded via <link> in HTML — no @import needed */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.015em;
}

h3 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.01em;
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
}

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: var(--line-height-relaxed);
}

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

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

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

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

code {
  font-family: 'Courier New', monospace;
  background-color: var(--bg-tertiary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.95em;
  color: var(--error);
}

ul, ol {
  margin-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

li {
  margin-bottom: var(--space-sm);
}

/* ============================================================
   4. LAYOUT & GRID SYSTEM
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.container-lg {
  max-width: var(--container-lg);
}

.container-md {
  max-width: var(--container-md);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-center {
  align-items: center;
  justify-content: center;
}

.flex-between {
  align-items: center;
  justify-content: space-between;
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.gap-xl {
  gap: var(--space-xl);
}

/* ============================================================
   5. HEADER & NAVIGATION
   ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all var(--transition-base);
}

header.scrolled {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  max-width: var(--container-2xl);
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
}

/* Fix iOS Safari : les gradients SVG url(#id) ne s'affichent pas toujours.
   On impose une couleur solide via CSS (priorité sur les attributs SVG). */
.logo svg text  { fill: #7B6DDE; }
.logo svg path  { fill: #7B6DDE; }
.logo svg line  { stroke: #7B6DDE; }

#main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

#main-nav a,
.nav-link {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  position: relative;
  text-decoration: none;
}

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

.nav-link.active {
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

#main-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width var(--transition-fast);
}

#main-nav a:hover::after {
  width: 100%;
}

.nav-auth {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  position: relative;
}

.auth-btn {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  border: none;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-sm);
}

.auth-btn.login {
  color: var(--primary);
  background: transparent;
  border: 1.5px solid var(--primary);
}

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

.auth-btn.register {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.auth-btn.register:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  align-items: center;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translateY(10px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-8px);
}

/* ============================================================
   6. HERO SECTION
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-lighter) 100%);
  padding: var(--space-5xl) var(--space-lg) var(--space-4xl);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, rgba(124, 58, 237, 0) 70%);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0) 70%);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite reverse;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero h1 {
  font-size: var(--font-size-6xl);
  margin-bottom: var(--space-lg);
  line-height: 1.1;
  color: var(--text-primary);
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent-1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  line-height: var(--line-height-relaxed);
}

.hero-cta {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3xl);
}

.btn {
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--font-size-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

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

.btn-sm {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-lg);
}

/* ============================================================
   7. SECTION LAYOUTS & PATTERNS
   ============================================================ */
section {
  padding: var(--space-4xl) var(--space-lg);
  position: relative;
}

section.alt-bg {
  background-color: var(--bg-secondary);
}

section.with-pattern {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(79, 70, 229, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header .subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
}

.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gray-300), transparent);
  margin: var(--space-3xl) 0;
}

/* ============================================================
   8. MATIÈRE/SUBJECT CARDS
   ============================================================ */
.matiere-card {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  border-top: 4px solid var(--primary);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.matiere-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: -100px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  transition: all var(--transition-base);
}

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

.matiere-card:hover::before {
  right: -50px;
}

.matiere-card.economie {
  border-top-color: var(--matiere-economie);
}

.matiere-card.economie::before {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
}

.matiere-card.droit {
  border-top-color: var(--matiere-droit);
}

.matiere-card.droit::before {
  background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
}

.matiere-icon {
  position: relative;
  z-index: 1;
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-md);
  width: 60px;
  height: 60px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.matiere-card.economie .matiere-icon {
  background: linear-gradient(135deg, var(--matiere-economie) 0%, #60A5FA 100%);
}

.matiere-card.droit .matiere-icon {
  background: linear-gradient(135deg, var(--matiere-droit) 0%, #F472B6 100%);
}

.matiere-title {
  position: relative;
  z-index: 1;
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.matiere-description {
  position: relative;
  z-index: 1;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  flex-grow: 1;
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.matiere-stats {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.matiere-stats strong {
  color: var(--primary);
  font-weight: var(--font-weight-bold);
}

.matiere-stats-separator {
  color: var(--text-tertiary);
}

.matiere-cta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.matiere-cta:hover {
  gap: var(--space-md);
}

/* ============================================================
   9. COURSE CONTENT PAGE
   ============================================================ */
.course-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-2xl);
  max-width: var(--container-2xl);
  margin: 0 auto;
}

.course-main {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-sm);
}

.course-header {
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 2px solid var(--gray-200);
}

.course-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.course-breadcrumb a {
  color: var(--primary);
}

.course-title {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.course-content {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.course-content h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--gray-200);
}

.course-content h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--primary);
}

.course-content p {
  margin-bottom: var(--space-md);
}

.course-sidebar {
  position: sticky;
  top: 100px;
}

.sidebar-card {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

.sidebar-card h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.toc-link {
  display: block;
  padding: var(--space-sm) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
  padding-left: var(--space-md);
}

.toc-link:hover,
.toc-link.active {
  color: var(--primary);
  border-left-color: var(--primary);
}

.course-download {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
  margin-bottom: var(--space-md);
}

.course-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

/* ============================================================
   10. AUTH MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-bg);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-base);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
  animation: slideUp var(--transition-base);
  position: relative;
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  font-size: var(--font-size-xl);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-header {
  margin-bottom: var(--space-xl);
  text-align: center;
}

.modal-header h2 {
  margin-bottom: var(--space-md);
}

.modal-tabs {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--gray-200);
}

.modal-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  padding-bottom: var(--space-md);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

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

.form-group {
  margin-bottom: var(--space-lg);
}

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  font-size: var(--font-size-sm);
}

.form-checkbox input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.modal-submit {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  margin-bottom: var(--space-md);
  transition: all var(--transition-base);
}

.modal-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.modal-footer {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.modal-footer a {
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

/* ============================================================
   11. CONTACT PAGE
   ============================================================ */
.contact-hero {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.contact-hero h1 {
  color: var(--primary);
  margin-bottom: var(--space-md);
}

.contact-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: start;
  max-width: var(--container-lg);
  margin: 0 auto;
}

.contact-form {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.info-block {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary);
  transition: all var(--transition-base);
}

.info-block:hover {
  transform: translateX(8px);
}

.info-block h3 {
  margin-bottom: var(--space-sm);
  color: var(--primary);
}

.info-block p {
  margin: 0;
  color: var(--text-secondary);
}

.info-block a {
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

/* ============================================================
   12. ABOUT PAGE (Qui suis-je)
   ============================================================ */
.about-hero {
  text-align: center;
  margin-bottom: var(--space-4xl);
}

.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
  max-width: var(--container-lg);
  margin: 0 auto;
}

.about-image {
  position: relative;
  width: 100%;
  min-height: 280px; /* Fallback iOS < 15 qui ne supporte pas aspect-ratio */
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-lighter), var(--secondary));
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-5xl);
}

.about-image::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.about-text h2 {
  margin-bottom: var(--space-lg);
  color: var(--primary);
}

.about-text p {
  margin-bottom: var(--space-lg);
  line-height: var(--line-height-loose);
}

.about-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.about-list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.about-list-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-sm);
  margin-top: 2px;
}

.about-list-text h3 {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.about-list-text p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ============================================================
   13. FOOTER
   ============================================================ */
footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: var(--space-3xl) var(--space-lg) var(--space-xl);
  margin-top: var(--space-5xl);
}

.footer-content {
  max-width: var(--container-2xl);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-3xl);
}

.footer-section h3 {
  color: white;
  margin-bottom: var(--space-md);
  font-size: var(--font-size-base);
}

.footer-section a {
  display: block;
  color: var(--gray-400);
  text-decoration: none;
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.footer-section a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-size: var(--font-size-sm);
}

.footer-logo {
  color: white;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.social-links {
  display: flex;
  gap: var(--space-md);
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  margin: 0;
  transition: all var(--transition-fast);
}

.social-links a:hover {
  background: var(--primary);
  color: white;
}

/* ============================================================
   14. BUTTONS & INTERACTIVE ELEMENTS
   ============================================================ */
.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  padding: var(--space-sm);
}

.icon-button:hover {
  background: var(--gray-200);
  color: var(--primary);
}

.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

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

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

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

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

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

.tag {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--gray-300);
}

.card {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

/* ============================================================
   15. UTILITY CLASSES
   ============================================================ */
.text-center {
  text-align: center;
}

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

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

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

.text-secondary {
  color: var(--text-secondary);
}

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

.text-white {
  color: white;
}

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

.text-lg {
  font-size: var(--font-size-lg);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

.font-semibold {
  font-weight: var(--font-weight-semibold);
}

.font-medium {
  font-weight: var(--font-weight-medium);
}

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

.hidden { display: none !important; }
.visible { display: block !important; }

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

/* ============================================================
   16. ANIMATIONS & TRANSITIONS
   ============================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

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

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

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

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

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

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

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

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

.animate-slide-up {
  animation: slideUp var(--transition-base);
}

.animate-slide-down {
  animation: slideDown var(--transition-base);
}

.animate-scale-in {
  animation: scaleIn var(--transition-base);
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Scroll reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.reveal.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   17. MISSING ESSENTIALS (form states, skip-to-content, focus)
   ============================================================ */

/* --- Skip to content (accessibility) --- */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: var(--z-tooltip);
  background: var(--primary);
  color: white;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: var(--space-md);
}

/* --- Form input class (used by contact page) --- */
.form-input {
  width: 100%;
  padding: var(--space-md);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  background: var(--white);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
}

/* --- Form error messages --- */
.form-error {
  font-size: var(--font-size-xs);
  color: var(--error);
  margin-top: var(--space-xs);
  min-height: 1.2em;
}

/* --- Form feedback (success/error after submit) --- */
#form-feedback {
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-align: center;
}

#form-feedback.success {
  background: var(--success-light);
  color: #065F46;
  border: 1px solid var(--success);
}

#form-feedback.error {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid var(--error);
}

/* --- Focus visible for keyboard navigation --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.matiere-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Matiere card as link: hover & focus states --- */
a.matiere-card,
.matiere-card a {
  text-decoration: none;
  color: inherit;
}

.parcours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

/* --- Lesson page specific --- */
.lesson-page {
  padding-top: 0;
}

.lesson-header {
  position: sticky;
  top: 70px;
  z-index: var(--z-sticky);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--space-md) 0;
}

.lesson-header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-3));
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.step-counter {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: var(--font-weight-medium);
}

.lesson-content {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.step-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  margin-bottom: var(--space-xl);
}

/* --- Quiz options (dynamically generated) --- */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.quiz-option {
  display: block;
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  color: var(--text-primary);
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--primary-lighter);
  background: rgba(79, 70, 229, 0.04);
}

.quiz-option:disabled {
  cursor: default;
}

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

.quiz-option.incorrect {
  border-color: var(--error);
  background: var(--error-light);
  color: #991B1B;
}

.quiz-question {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
  line-height: var(--line-height-relaxed);
}

/* --- Vrai/Faux options --- */
.vf-options {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.vf-options .quiz-option {
  flex: 1;
  text-align: center;
  font-weight: var(--font-weight-semibold);
}

/* --- Feedback boxes --- */
.feedback-box {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  margin-top: var(--space-md);
  font-size: var(--font-size-sm);
}

.feedback-box.correct {
  background: var(--success-light);
  color: #065F46;
  border: 1px solid var(--success);
}

.feedback-box.incorrect {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid var(--error);
}

/* --- Step type badges --- */
.step-type-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.step-type-badge.theorie {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}

.step-type-badge.exercice {
  background: linear-gradient(135deg, var(--accent-2), #F97316);
  color: white;
}

/* --- Score bar (lesson complete) --- */
.score-bar-container {
  height: 10px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-bar-fill.excellent { background: linear-gradient(90deg, var(--success), #34D399); }
.score-bar-fill.good { background: linear-gradient(90deg, var(--info), #38BDF8); }
.score-bar-fill.medium { background: linear-gradient(90deg, var(--warning), #FBBF24); }
.score-bar-fill.poor { background: linear-gradient(90deg, var(--error), #F87171); }

.score-label {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* --- Lesson summary (lesson complete) --- */
.lesson-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.lesson-summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

/* --- Lesson complete styling --- */
.lesson-complete {
  text-align: center;
}

.complete-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
}

.complete-icon.gold { background: linear-gradient(135deg, #F59E0B, #FBBF24); color: white; }
.complete-icon.silver { background: linear-gradient(135deg, #6B7280, #9CA3AF); color: white; }
.complete-icon.green { background: linear-gradient(135deg, var(--success), #34D399); color: white; }
.complete-icon.blue { background: linear-gradient(135deg, var(--info), #38BDF8); color: white; }

/* ============================================================
   18. RESPONSIVE DESIGN
   ============================================================ */

/* Large Tablet / Small Desktop (1024px) */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: var(--font-size-5xl);
  }

  .hero {
    min-height: 85vh;
  }

  .parcours-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet (768px) */
@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-4xl);
  }

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

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

  .hero {
    min-height: 80vh;
    padding: var(--space-3xl) var(--space-lg);
  }

  .hero h1 {
    font-size: var(--font-size-4xl);
  }

  .hero-subtitle {
    font-size: var(--font-size-lg);
  }

  .hamburger {
    display: flex;
  }

  /* Le menu mobile ne doit s'appliquer qu'à la navigation principale.
     Sinon les autres <nav> (ex. fil d'Ariane) deviennent des panneaux fixes blancs. */
  #main-nav {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: white;
    padding: var(--space-lg);
    gap: var(--space-md);
    box-shadow: var(--shadow-md);
    z-index: var(--z-sticky);
  }

  #main-nav.open {
    display: flex;
  }

  #main-nav a {
    padding: 0.85rem var(--space-md);
    min-height: 44px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
  }

  #main-nav a::after {
    display: none;
  }

  .container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  section {
    padding: var(--space-2xl) var(--space-lg);
  }

  .course-container {
    grid-template-columns: 1fr;
  }

  .course-sidebar {
    position: static;
  }

  .contact-content,
  .about-content {
    grid-template-columns: 1fr;
  }

  .about-image {
    min-height: 220px; /* Fallback iOS < 15 */
    aspect-ratio: 1 / 1;
  }

  .nav-auth {
    display: none;
  }

  .lesson-header-inner {
    gap: var(--space-md);
  }

  .step-counter {
    display: none;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .parcours-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile (480px) */
@media (max-width: 480px) {
  h1 {
    font-size: var(--font-size-3xl);
  }

  h2 {
    font-size: var(--font-size-2xl);
  }

  h3 {
    font-size: var(--font-size-lg);
  }

  .hero {
    min-height: 60vh;
    padding: var(--space-2xl) var(--space-md);
  }

  .hero h1 {
    font-size: var(--font-size-3xl);
  }

  .hero-subtitle {
    font-size: var(--font-size-base);
  }

  .hero-cta {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .header-inner {
    padding: var(--space-sm) var(--space-md);
  }

  .logo svg {
    width: 120px;
    height: 31px;
  }

  .nav-auth {
    display: none;
  }

  .container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .matiere-card {
    padding: var(--space-lg);
  }

  .section-header {
    margin-bottom: var(--space-2xl);
  }

  .course-main {
    padding: var(--space-lg);
  }

  .course-title {
    font-size: var(--font-size-2xl);
  }

  .sidebar-card {
    padding: var(--space-lg);
  }

  .modal {
    max-width: 95%;
    padding: var(--space-lg);
  }

  .contact-form,
  .contact-info {
    padding: var(--space-lg);
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

/* ============================================================
   11. AUTH COMPONENTS (bouton header, modal, dropdown)
   ============================================================ */

/* --- Bouton "Se connecter" dans le header (non connecté) --- */
.btn-auth-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-base);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.25);
  white-space: nowrap;
}

.btn-auth-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

/* --- Badge utilisateur connecté --- */
.auth-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: rgba(79, 70, 229, 0.06);
  border: 1.5px solid rgba(79, 70, 229, 0.18);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  user-select: none;
}

.auth-user-badge:hover {
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.35);
}

.auth-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.auth-pseudo {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Dropdown menu utilisateur --- */
.auth-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px;
  min-width: 210px;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-fixed);
}

.auth-dropdown-email {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  padding: 4px 10px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--font-family-base);
  transition: background var(--transition-fast);
  text-align: left;
}

.auth-dropdown-btn:hover {
  background: var(--gray-50);
  color: var(--primary);
}

/* --- Overlay du modal --- */
#auth-modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.52);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal-bg);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

#auth-modal-overlay.open {
  display: flex;
  animation: fadeIn var(--transition-base);
}

/* --- Boîte du modal --- */
.auth-modal {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
  position: relative;
  animation: revealUp 0.22s ease;
}

/* --- Bouton fermer --- */
.auth-modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.auth-modal-close:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

/* --- Logo dans le modal --- */
.auth-modal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- Onglets Connexion / Inscription (style pilule) --- */
.auth-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: var(--space-xl);
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-base);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
  font-weight: var(--font-weight-semibold);
}

/* --- Label formulaire --- */
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

/* --- Messages d'erreur / succès --- */
.auth-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: var(--radius-lg);
  color: var(--error);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
  line-height: 1.45;
}

.auth-success {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: var(--radius-lg);
  color: var(--success);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
  line-height: 1.45;
}

/* --- Liens et texte de bascule --- */
.auth-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: inherit;
  font-family: var(--font-family-base);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  transition: color var(--transition-fast);
}

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

.auth-switch-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: center;
  margin-top: var(--space-md);
  margin-bottom: 0;
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .auth-modal {
    padding: var(--space-xl);
  }
}

/* ============================================================
   18. MATIÈRE CARD — LINE CLAMP (descriptions uniformes)
   ============================================================ */
.matiere-description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}


/* ============================================================
   20. ONGLETS CHAPITRE (barre sticky Cours / Exercices)
   ============================================================ */

/* — Barre d'onglets — */
.chapitre-tabs-bar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  /* Toujours sticky : pas de toggle JS position:relative ↔ sticky
     qui provoquait un rectangle blanc sur iOS Safari (bug de recompositing). */
  position: sticky;
  top: 72px; /* hauteur du header desktop (sticky) */
  z-index: var(--z-sticky);
  transition: box-shadow var(--transition-base);
}

.chapitre-tabs-bar.is-sticky {
  /* is-sticky = hero hors viewport → ajoute l'ombre portée */
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.chapitre-tabs {
  display: flex;
  gap: 0;
}

.chapitre-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: var(--font-family-base);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  bottom: -1px; /* recouvre la bordure du bas */
}

.chapitre-tab:hover {
  color: var(--primary);
  background: var(--gray-50);
}

.chapitre-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: none;
}

.chapitre-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.4rem;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.chapitre-tab-badge:empty { display: none; }

/* — Panneaux — */
.chapitre-panel {
  padding: 3rem 0 4rem;
  min-height: 50vh;
}

/* — Hero chapitre simplifié (sans actions) — */
.chapitre-hero {
  background: -webkit-linear-gradient(315deg, var(--primary) 0%, var(--primary-light) 100%);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 2.5rem 0 3rem;
  position: relative;
  z-index: 1;
  /* Note: pas de transform ici — évite que le fond se fige avant le chargement JS */
}

.chapitre-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.chapitre-breadcrumb-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.chapitre-breadcrumb-link:hover { color: white; }
.chapitre-breadcrumb-sep { opacity: 0.5; }
.chapitre-breadcrumb-current { color: white; font-weight: 600; }

.chapitre-theme-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.5rem;
}

.chapitre-title {
  font-family: var(--font-family-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  color: white;
  margin-bottom: 0.65rem;
}

.chapitre-desc {
  font-size: 1rem;
  color: rgba(255,255,255,0.92);
  max-width: 580px;
  margin-bottom: 1.25rem;
}

.chapitre-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.chapitre-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  opacity: 0.9;
}

/* — Blocs cours — */
.cours-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cours-bloc {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2rem 2.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  line-height: 1.8;
}

.cours-h1 {
  font-family: var(--font-family-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--matiere-economie);
}

.cours-h2 {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--matiere-economie);
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
}

.cours-h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1.25rem;
  margin-bottom: 0.45rem;
}

.cours-p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.cours-p strong { color: var(--text-primary); }
.cours-p:last-child { margin-bottom: 0; }

.cours-list {
  margin: 0.5rem 0 1rem 1.25rem;
  color: var(--text-secondary);
}
.cours-list li { margin-bottom: 0.35rem; }
.cours-list li::marker { color: var(--matiere-economie); }

/* Tableaux */
.cours-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.cours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.cours-table th {
  background: var(--matiere-economie);
  color: white;
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
}
.cours-table th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.cours-table th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
.cours-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: top;
  color: var(--text-secondary);
  line-height: 1.6;
}
.cours-table tr:last-child td { border-bottom: none; }
.cours-table tr:nth-child(even) td { background: var(--gray-50); }

/* — Cartes exercices — */
.exercices-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exo-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--gray-200);
}
.exo-card.answered { border-color: var(--gray-300); }

.exo-number {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: #EEF2FF;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.85rem;
}

.exo-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.exo-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.exo-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.exo-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: #EEF2FF;
  color: var(--primary);
}
.exo-option.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: #065F46;
  font-weight: 600;
}
.exo-option.incorrect {
  border-color: var(--error);
  background: var(--error-light);
  color: #991B1B;
}
.exo-option:disabled { cursor: default; }

/* Vrai/Faux */
.exo-options-vf {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
}
.exo-options-vf .exo-option {
  flex: 1;
  text-align: center;
  font-weight: 600;
}

/* Texte à trou */
.exo-fillblank-sentence {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 2.4;
  margin-bottom: 1rem;
}
.exo-blank-input {
  display: inline-block;
  border: none;
  border-bottom: 2px solid var(--primary);
  padding: 0.1rem 0.5rem;
  font-size: 1rem;
  color: var(--primary);
  background: transparent;
  outline: none;
  width: 140px;
  text-align: center;
  transition: border-color var(--transition-fast);
}
.exo-blank-input:focus { border-color: var(--primary-light); }
.exo-blank-input.correct { border-color: var(--success); color: #065F46; }
.exo-blank-input.incorrect { border-color: var(--error); color: #991B1B; }

.exo-validate-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 0.75rem;
}
.exo-validate-btn:hover { background: var(--primary-light); transform: translateY(-1px); }

/* Feedback */
.exo-feedback-box {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  margin-top: 0.75rem;
  line-height: 1.55;
}
.exo-feedback-box.correct {
  background: var(--success-light);
  color: #065F46;
  border-left: 3px solid var(--success);
}
.exo-feedback-box.incorrect {
  background: var(--error-light);
  color: #991B1B;
  border-left: 3px solid var(--error);
}

.static-course-progress-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: var(--shadow-sm);
}

.static-course-progress-card[data-state="in_progress"] {
  border-color: rgba(14, 165, 233, 0.24);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.static-course-progress-card[data-state="completed"] {
  border-color: rgba(16, 185, 129, 0.24);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.98));
}

.static-course-progress-copy {
  min-width: 0;
}

.static-course-progress-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.static-course-progress-card[data-state="in_progress"] .static-course-progress-badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0369A1;
}

.static-course-progress-card[data-state="completed"] .static-course-progress-badge {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.static-course-progress-title {
  margin: 0.75rem 0 0.3rem;
  font-size: 1rem;
  color: var(--text-primary);
}

.static-course-progress-detail {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.static-course-progress-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

.static-course-progress-btn,
.static-course-progress-link,
.static-course-progress-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  font-family: var(--font-family-base);
}

.static-course-progress-btn {
  padding: 0.7rem 1.1rem;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: transform var(--transition-fast), filter var(--transition-fast), opacity var(--transition-fast);
}

.static-course-progress-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.static-course-progress-btn:disabled {
  background: var(--gray-200);
  color: var(--text-secondary);
  cursor: default;
}

.static-course-progress-link {
  padding: 0.7rem 1.1rem;
  background: var(--success);
  color: white;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.static-course-progress-link:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.static-course-progress-secondary {
  padding: 0.7rem 0.95rem;
  color: var(--primary);
}

.static-course-progress-secondary:hover {
  text-decoration: underline;
}

.chapitre-loading {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-secondary);
}
.chapitre-empty {
  color: var(--text-secondary);
  font-style: italic;
  padding: 1rem 0;
}

/* — Responsive — */
@media (max-width: 768px) {
  .chapitre-tabs-bar { top: 56px; }

  .static-course-progress-card,
  .static-course-progress-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chapitre-tabs {
    width: 100%;
  }

  .chapitre-tab {
    flex: 1;
    justify-content: center;
    padding: 0.85rem 0.75rem;
    font-size: 0.88rem;
    min-height: 44px;
  }

  /* iOS : empêche le zoom auto sur les inputs */
  input, select, textarea {
    font-size: 16px;
  }
}

/* ============================================================
   SECTION 21 — CALLOUTS COLORÉS + SÉPARATEURS (chapitre.html)
   ============================================================ */

/* Base callout */
.callout {
  position: relative;
  border-left: 4px solid;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.9rem 1.1rem 0.9rem 1.2rem;
  margin: 1.25rem 0;
}
.callout p { margin: 0; font-size: 0.93rem; line-height: 1.65; }

.callout-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Définition — bleu */
.callout-def { background: rgba(59,130,246,0.07); border-color: #3B82F6; }
.callout-def .callout-label { color: #1d4ed8; background: rgba(59,130,246,0.15); }

/* À retenir — vert */
.callout-retenir { background: rgba(16,185,129,0.07); border-color: #10B981; }
.callout-retenir .callout-label { color: #065f46; background: rgba(16,185,129,0.15); }

/* Exemple — ambre */
.callout-exemple { background: rgba(245,158,11,0.07); border-color: #F59E0B; }
.callout-exemple .callout-label { color: #92400e; background: rgba(245,158,11,0.15); }

/* Attention ! — rouge */
.callout-attention { background: rgba(239,68,68,0.07); border-color: #EF4444; }
.callout-attention .callout-label { color: #991b1b; background: rgba(239,68,68,0.15); }

/* Méthode — violet */
.callout-methode { background: rgba(139,92,246,0.07); border-color: #8B5CF6; }
.callout-methode .callout-label { color: #5b21b6; background: rgba(139,92,246,0.15); }

/* Default (info) */
.callout-default { background: rgba(79,70,229,0.06); border-color: var(--primary); }

/* Séparateur de section */
.cours-sep { border: none; border-top: 2px solid var(--border-light); margin: 2rem 0; }

/* ============================================================
   SECTION 22 — GRAPHIQUES / CHARTS dans le cours
   ============================================================ */

.chart-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem 1rem;
  margin: 1.5rem 0;
}
.chart-title {
  font-family: var(--font-family-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chart-wrap svg {
  display: block;
  width: 100%;
  max-width: 560px;
  /* min-width: 480px retiré — forçait les SVG à 480px sur mobile (<390px),
     créant un débordement horizontal source du rectangle blanc sur iOS.
     Le chart-wrap a déjà overflow-x:auto pour permettre le scroll horizontal
     si nécessaire sur tablette. */
  margin: 0 auto;
  overflow: visible;
}
.chart-legend {
  font-size: 0.79rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0.65rem 0 0;
  font-style: italic;
}

/* ============================================================
   SECTION 23 — MODULE CARDS & LEÇON ITEMS (page parcours détail)
   ============================================================ */

/* Carte de module */
.module-card {
  background: var(--bg-primary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* En-tête du module : titre + badge sur la même ligne */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.module-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-family-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.module-title svg {
  flex-shrink: 0;
  color: var(--primary);
}

/* Badges de statut module */
.badge-available {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-locked {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Liste des leçons */
.module-card > div {
  padding: 0.5rem 0;
}

/* Carte de leçon */
.lecon-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease, color 0.15s ease;
}

.lecon-item:last-child {
  border-bottom: none;
}

.lecon-item:hover:not(.locked) {
  background: rgba(79, 70, 229, 0.04);
}

.lecon-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.lecon-item.completed .lecon-titre {
  color: var(--success);
}

.lecon-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.lecon-titre {
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lecon-item:hover:not(.locked) .lecon-titre {
  color: var(--primary);
}

.lecon-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lecon-meta svg {
  color: var(--text-muted);
}

.lecon-arrow {
  flex-shrink: 0;
  color: var(--primary);
  opacity: 0.6;
  transition: opacity 0.15s, transform 0.15s;
}

.lecon-item:hover:not(.locked) .lecon-arrow {
  opacity: 1;
  transform: translateX(3px);
}

@media (max-width: 480px) {
  .module-header { padding: 0.85rem 1rem; }
  .lecon-item { padding: 0.85rem 1rem; }
}

/* ============================================================
   SECTION 24 — MOBILE & TOUCH OPTIMISATIONS
   ============================================================ */

/* Tous les SVG inline (graphiques cours) : responsifs */
.cours-content svg,
.cours-bloc svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Graphiques : permettre le scroll horizontal si trop larges */
.chart-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Boutons principaux : supprimer le flash de tap iOS */
.btn,
.exo-option,
.exo-validate-btn,
.chapitre-tab,
.nav-link,
.quiz-option,
.parcours-card,
.lecon-card,
.matiere-card,
.association-item,
.classement-item,
.lesson-prev-btn,
.lesson-next-btn,
.lesson-validate-btn,
.nav-hamburger,
.auth-dropdown-btn,
.modal-close {
  -webkit-tap-highlight-color: rgba(79, 70, 229, 0.12);
}

/* Supprimer le délai de 300ms sur mobile (tous les éléments interactifs) */
a, button, [role="button"],
.quiz-option, .exo-option,
.parcours-card, .lecon-card, .matiere-card,
.association-item, .classement-item,
.lesson-prev-btn, .lesson-next-btn, .lesson-validate-btn {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

/* Hero : désactiver les animations coûteuses sur mobile (performance) */
@media (max-width: 768px) {
  .hero::before,
  .hero::after {
    animation: none;
    opacity: 0.5;
  }

  /* Hero stats section */
  .hero-stats {
    gap: var(--space-lg);
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Cards matières : meilleure lisibilité */
  .matiere-card {
    padding: 1.25rem;
  }

  .matiere-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  /* Breadcrumb chapitre : wrap si long */
  .chapitre-breadcrumb {
    font-size: 0.78rem;
  }

  /* Module card sur mobile */
  .module-card {
    border-radius: var(--radius-lg);
  }

  .lecon-item {
    min-height: 56px;
  }

  .lecon-titre {
    font-size: 0.88rem;
  }

  /* Section parcours : padding réduit */
  .parcours-detail {
    padding: var(--space-xl) 0;
  }
}

/* ============================================================
   Section 24b — Overrides mobiles pour sections 20-23
   (doivent impérativement venir APRÈS les règles de base)
   ============================================================ */

/* Tablette (768px) — chapitre, cours, exercices */
@media (max-width: 768px) {
  .cours-bloc {
    padding: 1.25rem 1.25rem;
  }

  .exo-card {
    padding: 1.25rem 1.25rem;
  }

  .exo-options-vf {
    flex-direction: row;
    gap: 0.6rem;
  }

  .exo-option {
    min-height: 48px;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .exo-validate-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    font-size: 1rem;
  }

  /* Tables scrollables dans les blocs cours
     Fix iPhone / Chrome iOS : on empile les lignes en cartes pour
     supprimer le scroll horizontal interne, source probable du rectangle blanc. */
  .cours-table-wrap {
    margin: 1rem 0;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .cours-table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  .cours-table thead {
    display: none;
  }

  .cours-table tbody {
    display: block;
  }

  .cours-table tr {
    display: block;
    margin-bottom: 0.9rem;
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .cours-table tr:last-child {
    margin-bottom: 0;
  }

  .cours-table td {
    display: grid;
    grid-template-columns: minmax(96px, 42%) 1fr;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--gray-100);
    background: white !important;
    word-break: break-word;
  }

  .cours-table td:last-child {
    border-bottom: none;
  }

  .cours-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
  }

  /* SVG graphiques : s'adaptent à la largeur */
  .cours-bloc svg,
  .chart-wrap svg {
    max-width: 100%;
    height: auto;
  }
}

/* Mobile (480px) — chapitre, cours, exercices */
@media (max-width: 480px) {
  .chapitre-tabs-bar {
    top: 54px; /* header plus petit sur petit mobile */
  }

  .chapitre-hero {
    padding: 1.5rem 0 2rem;
  }

  /* Réduit l'espace blanc entre la barre d'onglets et le premier bloc cours */
  .chapitre-panel {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
  }

  .chapitre-title {
    font-size: 1.35rem;
  }

  .chapitre-desc {
    font-size: 0.92rem;
  }

  .chapitre-meta {
    gap: 0.85rem;
  }

  .chapitre-tab {
    font-size: 0.9rem;
    padding: 0.8rem 0.5rem;
  }

  .chapitre-tab svg {
    display: none;
  }

  .cours-bloc {
    padding: 1rem 1rem;
    border-radius: var(--radius-lg);
  }

  .cours-bloc h2 {
    font-size: 1.1rem;
  }

  .cours-bloc h3 {
    font-size: 1rem;
  }

  .exo-card {
    padding: 1rem 1rem;
    border-radius: var(--radius-lg);
  }

  .exo-question {
    font-size: 0.97rem;
  }

  .exo-blank-input {
    width: 110px;
    font-size: 0.95rem;
  }

  .callout {
    padding: 0.75rem 0.9rem 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

/* Très petits écrans (moins de 360px : vieux Android / iPhone SE) */
@media (max-width: 360px) {
  .header-inner {
    padding: var(--space-sm) var(--space-sm);
  }

  .logo svg {
    width: 110px;
    height: 28px;
  }

  .chapitre-title {
    font-size: 1.15rem;
  }

  .cours-bloc,
  .exo-card {
    padding: 0.85rem 0.85rem;
  }
}

/* ============================================================
   SECTION 25 — CORRECTIONS FINALES MOBILE / iOS SAFARI
   ============================================================ */

/* Fix iOS Safari : 100vh inclut la barre d'adresse → hero trop grand.
   On utilise -webkit-fill-available comme hauteur maximale. */
@supports (-webkit-touch-callout: none) {
  .hero {
    min-height: -webkit-fill-available;
  }
}

/* Menu mobile : fond semi-transparent + ombre améliorés */
@media (max-width: 768px) {
  nav#main-nav {
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }

  /* Séparateur visuel entre chaque lien */
  nav#main-nav a + a {
    border-top: 1px solid var(--gray-100);
  }

  nav#main-nav a {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
  }

  nav#main-nav a.active,
  nav#main-nav a[aria-current="page"] {
    color: var(--primary);
    font-weight: 600;
    background: rgba(79, 70, 229, 0.06);
  }

  /* Hamburger : centrer les barres */
  .hamburger {
    padding: 10px;
  }

  /* Espacement correct entre logo et hamburger */
  .header-inner {
    gap: 0;
  }
}

/* Pages de chapitre sur mobile :
   iOS Safari gère mal deux éléments sticky empilés (header + tabs).
   Fix : le header passe en relative (non sticky) sur les pages chapitre,
   et la barre d'onglets prend le relai en sticky top:0.
   IMPORTANT : la classe .has-chapitre-tabs doit être dans le HTML (pas via JS)
   pour que le fix s'applique dès le premier paint, avant le chargement JS.
   Aucun hack (transform, will-change, contain) : ce sont eux qui
   provoquaient le rectangle blanc sur iOS en créant un nouveau
   containing block / stacking context incompatible avec sticky. */
@media (max-width: 768px) {
  body.has-chapitre-tabs header {
    position: relative;
    top: auto;
    z-index: auto;
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    transition: none;
  }

  body.has-chapitre-tabs header.scrolled {
    background: #fff;
    box-shadow: none;
  }

  body.has-chapitre-tabs .chapitre-tabs-bar {
    top: 0;
    background: #fff;
  }
}

/* Cartes de matières : espacement mobile */
@media (max-width: 480px) {
  .section-header h2 {
    font-size: 1.4rem;
  }

  .section-header .subtitle {
    font-size: 0.9rem;
  }

  /* Boutons CTA du hero : centrés et pleine largeur */
  .hero-cta .btn {
    width: 100%;
    justify-content: center;
    font-size: 0.95rem;
    padding: var(--space-md) var(--space-lg);
  }

  /* Hero title : taille lisible */
  .hero h1 {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
    line-height: 1.15;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    padding: 0 var(--space-sm);
  }

  /* Footer links : plus faciles à taper */
  .footer-section a {
    display: block;
    padding: 6px 0;
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  /* Contact form : champs lisibles */
  .form-group label {
    font-size: 0.9rem;
    font-weight: 600;
  }

  /* Parcours page : padding réduit */
  .parcours-hero,
  .parcours-detail {
    padding: 1.5rem 0 2rem;
  }
}

/* ============================================================
   SECTION 27 — PAGES LÉGALES
   ============================================================ */

.legal-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.legal-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem 2rem;
}

.legal-card h2 {
  font-family: var(--font-family-display);
  font-size: 1.2rem;
  margin-bottom: 0.85rem;
}

.legal-card h3 {
  font-size: 1rem;
  margin: 1rem 0 0.5rem;
  color: var(--text-primary);
}

.legal-card p,
.legal-card li {
  color: var(--text-secondary);
  line-height: 1.75;
}

.legal-card ul {
  margin: 0.75rem 0 0 1.25rem;
}

.legal-card strong {
  color: var(--text-primary);
}

.legal-note {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.legal-note a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.legal-note a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .legal-card {
    padding: 1.35rem 1.15rem;
  }
}

/* ============================================================
   PROGRESSION — Page dédiée de suivi des leçons
   ============================================================ */

/* Hero */
.progression-hero {
  background: linear-gradient(135deg, #f8f7ff 0%, #eef2ff 100%);
  padding: var(--space-3xl) 0 var(--space-2xl);
  border-bottom: 1px solid var(--border);
}

.progression-hero h1 {
  font-family: var(--font-family-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: var(--space-xs);
}

.progression-hero .subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

/* Cartes de stats */
.prog-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

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

.prog-stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.prog-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prog-stat-body {}

.prog-stat-value {
  font-family: var(--font-family-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.prog-stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.prog-stat-note {
  margin-top: 6px;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* Section matières */
.progression-subjects {
  padding: var(--space-3xl) 0;
}

.prog-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.prog-toolbar-copy {
  min-width: 0;
}

.progression-subjects-title {
  font-family: var(--font-family-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.prog-toolbar-caption {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.prog-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.prog-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: white;
  color: var(--text-secondary);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.prog-filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.prog-filter-chip.active {
  border-color: rgba(79, 70, 229, 0.18);
  background: #eef2ff;
  color: #3730A3;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12);
}

.prog-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: inherit;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* Carte par matière */
.prog-subject-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.prog-subject-card:hover {
  box-shadow: var(--shadow-md);
}

.prog-subject-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}

.prog-subject-main {
  flex: 1;
  min-width: 0;
}

.prog-subject-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.prog-subject-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.prog-subject-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.prog-subject-meta {
  margin: 8px 0 12px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.prog-subject-ratio {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.prog-subject-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Barre de progression */
.prog-subject-bar-wrap {
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}

.prog-subject-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}

/* Bouton Continuer */
.prog-continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-family-base);
  color: white;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}
.prog-continue-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.prog-continue-btn.done {
  background: var(--gray-200) !important;
  color: var(--text-secondary);
  cursor: default;
}
.prog-continue-btn.done:hover {
  filter: none;
  transform: none;
}

/* Liste de leçons */
.prog-lessons-list {
  padding: var(--space-md) var(--space-lg);
}

.prog-module-section + .prog-module-section {
  margin-top: var(--space-lg);
}

.prog-lesson-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-sm);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}
.prog-lesson-row:hover {
  background: var(--gray-50);
}

.prog-lesson-row.in-progress {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0.02));
}

/* Bouton toggle ✓ / ○ */
.prog-lesson-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.prog-lesson-check:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}
.prog-lesson-check.completed {
  background: var(--success);
  border-color: var(--success);
}
.prog-lesson-check.completed:hover {
  background: var(--error);
  border-color: var(--error);
}

.prog-lesson-check.in-progress {
  color: var(--info);
  border-color: rgba(14, 165, 233, 0.3);
  background: rgba(14, 165, 233, 0.08);
}

.prog-lesson-check.in-progress:hover {
  border-color: var(--info);
  background: rgba(14, 165, 233, 0.14);
}

/* Titre + durée */
.prog-lesson-info {
  flex: 1;
  min-width: 0;
}
.prog-lesson-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.prog-lesson-title:hover { color: var(--primary); }
.prog-lesson-row.done .prog-lesson-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
}

.prog-lesson-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.prog-lesson-duration {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.prog-lesson-status,
.prog-lesson-activity {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  font-size: 0.72rem;
  line-height: 1;
}

.prog-lesson-status {
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 700;
}

.prog-lesson-status.not_started {
  background: rgba(148, 163, 184, 0.12);
  color: #475569;
}

.prog-lesson-status.in_progress {
  background: rgba(14, 165, 233, 0.12);
  color: #0369A1;
}

.prog-lesson-status.completed {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.prog-lesson-activity {
  color: var(--text-tertiary);
}

/* Lien "Reprendre" par leçon */
.prog-lesson-link {
  font-size: var(--font-size-xs);
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.prog-lesson-row:hover .prog-lesson-link { opacity: 1; }
.prog-lesson-row.done .prog-lesson-link { display: none; }

/* Séparateur de module */
.prog-module-section {
  padding: var(--space-md);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.65) 0%, rgba(255, 255, 255, 0.92) 100%);
}

.prog-module-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: 10px;
}

.prog-module-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  margin: 0 0 4px;
}

.prog-module-meta {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.prog-module-ratio {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.prog-module-bar-wrap {
  height: 5px;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.prog-module-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .6s ease;
}

/* État vide / non connecté */
.prog-not-logged {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-secondary);
}
.prog-not-logged h2 {
  font-family: var(--font-family-display);
  font-size: 1.4rem;
  margin-bottom: var(--space-sm);
}

/* Message de chargement / erreur */
.prog-loading-msg, .prog-error-msg {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-secondary);
}

.prog-empty-filter-state {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.prog-empty-filter-state h2 {
  margin-bottom: 8px;
  font-family: var(--font-family-display);
  font-size: 1.3rem;
}

.prog-empty-filter-state p {
  margin: 0;
  color: var(--text-secondary);
}

.prog-reset-wrap {
  text-align: center;
  margin-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.prog-reset-trigger {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 18px;
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.prog-reset-trigger:hover {
  color: var(--error);
  border-color: var(--error);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .prog-toolbar,
  .prog-subject-header,
  .prog-subject-side,
  .prog-module-header {
    flex-direction: column;
    align-items: stretch;
  }

  .prog-filter-group {
    justify-content: flex-start;
  }

  .prog-subject-side {
    gap: 10px;
  }

  .prog-continue-btn,
  .prog-subject-ratio {
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .prog-filter-chip {
    width: 100%;
    justify-content: space-between;
  }

  .prog-stat-card,
  .prog-module-section {
    padding: var(--space-md);
  }

  .prog-lessons-list {
    padding: var(--space-sm);
  }

  .prog-lesson-row {
    align-items: flex-start;
  }

  .prog-lesson-link {
    opacity: 1;
    padding-top: 2px;
  }
}

/* ============================================================
   PROGRESSION — Panneau de suivi des leçons dans le dropdown (legacy, conservé)
   ============================================================ */

/* Dropdown élargi quand il contient la progression */
.auth-dropdown.with-progression {
  min-width: 300px;
}

/* En-tête "Ma progression" */
.prog-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  padding: 6px 10px 4px;
}

/* Liste scrollable des leçons */
.prog-list {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.prog-list::-webkit-scrollbar { width: 4px; }
.prog-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Bloc matière */
.prog-matiere {
  margin-bottom: 4px;
}

/* En-tête matière : pastille couleur + nom + compteur */
.prog-matiere-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 3px;
}

.prog-matiere-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.prog-matiere-name {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.prog-matiere-count {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Ligne de leçon */
.prog-lecon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 22px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.prog-lecon:hover {
  background: var(--gray-50);
}

/* Bouton toggle ✓ / ○ */
.prog-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  padding: 0;
  color: white;
}
.prog-check:hover {
  border-color: var(--primary);
}
.prog-check.completed {
  background: var(--success);
  border-color: var(--success);
}
.prog-check.completed:hover {
  background: var(--error);
  border-color: var(--error);
}

/* Titre de la leçon (lien) */
.prog-lecon-title {
  font-size: .78rem;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.prog-lecon-title:hover {
  color: var(--primary);
}
.prog-lecon.done .prog-lecon-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
}

/* État vide ou chargement */
.prog-empty {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  padding: 8px 10px;
  text-align: center;
}

/* Bouton réinitialiser */
.prog-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-lg);
  border: none;
  background: none;
  font-family: var(--font-family-base);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  margin-top: 2px;
}
.prog-reset-btn:hover {
  background: var(--gray-50);
  color: var(--error);
}

/* ============================================================
   END OF STYLE SHEET
   ============================================================ */
