/* ═══════════════════════════════════════════════════
   cours.acadenice.fr — Thème AcadéNice
   Light theme (style acadenice.fr) + Dark mode toggle
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Variables — Light Theme (défaut) ── */
:root {
  /* Brand AcadéNice */
  --an-teal: #24947a;
  --an-teal-light: #4cccb8;
  --an-teal-soft: rgba(36, 148, 122, 0.08);
  --an-teal-glow: rgba(36, 148, 122, 0.15);
  --an-navy: #0e2656;
  --an-navy-soft: rgba(14, 38, 86, 0.06);
  --an-purple: #9b51e0;
  --an-purple-soft: rgba(155, 81, 224, 0.08);
  --an-orange: #fda100;
  --an-orange-soft: rgba(253, 161, 0, 0.08);

  /* Surfaces */
  --bg-body: #ffffff;
  --bg-section: #f7f7f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f7f5;
  --bg-input: #f0f2f5;
  --bg-navbar: rgba(255, 255, 255, 0.95);
  --bg-sidebar: #fafbfc;
  --bg-code: #f6f8fa;
  --bg-code-block: #1e2a3a;

  /* Text */
  --text: #2d3748;
  --text-heading: #0e2656;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-on-accent: #ffffff;

  /* Borders */
  --border: #e2e8f0;
  --border-hover: rgba(36, 148, 122, 0.4);

  /* Accent aliases */
  --accent: var(--an-teal);
  --accent-soft: var(--an-teal-soft);
  --accent-glow: var(--an-teal-glow);
  --accent2: var(--an-purple);
  --accent2-soft: var(--an-purple-soft);
  --accent3: var(--an-orange);
  --accent3-soft: var(--an-orange-soft);

  /* Typography */
  --font-heading: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --transition: 0.25s ease;
  --max-width: 1248px;
  --sidebar-w: 280px;

  /* Hero gradient (like acadenice.fr) */
  --hero-gradient: linear-gradient(135deg, var(--an-navy) 0%, #1a3a6e 40%, var(--an-teal) 100%);
}

/* ── Variables — Dark Mode ── */
[data-theme="dark"] {
  --bg-body: #0f1219;
  --bg-section: #161b26;
  --bg-card: #1a2030;
  --bg-card-hover: #222b3d;
  --bg-input: #1e2536;
  --bg-navbar: rgba(15, 18, 25, 0.95);
  --bg-sidebar: #141923;
  --bg-code: #1a2030;
  --bg-code-block: #0d1117;

  --text: #e2e8f0;
  --text-heading: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(76, 204, 184, 0.3);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-body);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--an-teal-light); }
[data-theme="dark"] a:hover { color: #5ee0cc; }
img { max-width: 100%; height: auto; }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-heading);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.8rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.3rem; margin: 2rem 0 0.8rem; }
h4 { font-size: 1.1rem; margin: 1.5rem 0 0.6rem; color: var(--text); }
h1 .accent, h2 .accent { color: var(--an-teal); }
h1 .accent-purple, h2 .accent-purple { color: var(--an-purple); }
p { margin: 0.8rem 0; }
strong { color: var(--text-heading); font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Layout ── */
.page-wrapper { position: relative; z-index: 1; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-navbar);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.navbar .logo {
  font-family: var(--font-heading); font-weight: 800; font-size: 1.3rem;
  color: var(--text-heading);
}
.navbar .logo span { color: var(--an-teal); }
.navbar nav { display: flex; gap: 1.5rem; align-items: center; }
.navbar nav a {
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: color var(--transition);
}
.navbar nav a:hover,
.navbar nav a.active { color: var(--an-teal); }

/* Theme toggle button */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  width: 38px; height: 38px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all var(--transition);
  color: var(--text-muted);
}
.theme-toggle:hover { border-color: var(--an-teal); color: var(--an-teal); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
  display: none; background: none; border: none;
  color: var(--text-heading); font-size: 1.5rem; cursor: pointer;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 1rem 0; font-size: 0.85rem; color: var(--text-muted);
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--an-teal); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--an-teal); font-weight: 600; }

/* ── Hero section (homepage) ── */
.hero {
  background: var(--hero-gradient);
  color: #ffffff;
  text-align: center;
  padding: 5rem 2rem 4rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(76, 204, 184, 0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(155, 81, 224, 0.1) 0%, transparent 60%);
  pointer-events: none;
}
.hero * { position: relative; z-index: 1; }
.hero h1 { font-size: 2.8rem; margin-bottom: 1rem; color: #fff; }
.hero h1 .accent { color: var(--an-teal-light); }
.hero h1 .accent-purple { color: #c49dff; }
.hero p {
  font-size: 1.1rem; color: rgba(255,255,255,0.85);
  max-width: 640px; margin: 0 auto 2rem;
}
.hero .badge-top {
  display: inline-block;
  background: rgba(255,255,255,0.12); backdrop-filter: blur(8px);
  color: #fff; border: 1px solid rgba(255,255,255,0.25);
  padding: 0.3rem 1.2rem; border-radius: 999px; font-size: 0.8rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}

/* ── Hero small (sub-pages) ── */
.hero-small {
  background: var(--hero-gradient);
  color: #ffffff;
  padding: 3rem 2rem 2.5rem;
  position: relative; overflow: hidden;
}
.hero-small::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 30%, rgba(76, 204, 184, 0.12) 0%, transparent 50%);
  pointer-events: none;
}
.hero-small * { position: relative; z-index: 1; }
.hero-small h1 { color: #fff; font-size: 2rem; margin-bottom: 0.5rem; }
.hero-small h1 .accent { color: var(--an-teal-light); }
.hero-small p { color: rgba(255,255,255,0.8); margin: 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.8rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  letter-spacing: 0.02em; transition: all var(--transition);
  cursor: pointer; border: none; text-decoration: none;
}
.btn-primary {
  background: var(--an-teal); color: #fff; border: 1px solid var(--an-teal);
}
.btn-primary:hover {
  background: var(--an-teal-light); border-color: var(--an-teal-light);
  color: #fff; box-shadow: 0 4px 16px var(--an-teal-glow);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--an-teal); color: var(--an-teal); }
.btn-group { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Cards grid ── */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem; margin: 2rem 0;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative; overflow: hidden;
  text-decoration: none; color: inherit;
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
  background: var(--bg-card-hover);
}
.card .card-number {
  position: absolute; top: 0.8rem; right: 1.2rem;
  font-family: var(--font-heading); font-size: 2.5rem; font-weight: 800;
  color: var(--an-teal-soft); line-height: 1;
}
[data-theme="dark"] .card .card-number { color: rgba(76, 204, 184, 0.08); }

.card .card-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--an-teal-soft);
  border: 1px solid rgba(36, 148, 122, 0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 1rem;
}
.card .card-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.8rem;
  border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.6rem;
}
.card .card-status.done { color: var(--an-teal); border-color: rgba(36, 148, 122, 0.25); }
.card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-heading); }
.card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* ── Progress bar ── */
.progress-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem 2rem;
  margin: 2rem 0; display: flex; align-items: center; gap: 2rem;
  box-shadow: var(--shadow-sm);
}
.progress-box .progress-info { flex: 1; }
.progress-box .progress-info h4 { font-size: 1rem; margin-bottom: 0.3rem; }
.progress-box .progress-info p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.progress-track {
  flex: 2; background: var(--bg-input); border-radius: 100px;
  height: 10px; overflow: hidden; position: relative;
}
.progress-fill {
  height: 100%; border-radius: 100px; transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--an-teal), var(--an-teal-light));
}
.progress-pct { font-size: 0.9rem; font-weight: 700; color: var(--an-teal); min-width: 40px; text-align: right; }

/* ── Course page layout ── */
.course-layout { display: flex; gap: 0; min-height: 100vh; }
.course-sidebar {
  width: var(--sidebar-w); background: var(--bg-sidebar);
  border-right: 1px solid var(--border); padding: 2rem 0;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  flex-shrink: 0; transition: background-color 0.3s ease;
}
.course-sidebar h4 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); padding: 0 1.5rem; margin-bottom: 0.8rem;
}
.course-sidebar ul { list-style: none; }
.course-sidebar li a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1.5rem; font-size: 0.88rem; color: var(--text-muted);
  border-left: 3px solid transparent; transition: all var(--transition);
}
.course-sidebar li a:hover { color: var(--text-heading); background: var(--an-teal-soft); }
.course-sidebar li a.active {
  color: var(--an-teal); border-left-color: var(--an-teal);
  background: var(--an-teal-soft); font-weight: 600;
}
.course-sidebar li a .check { color: var(--an-teal); font-size: 0.8rem; margin-left: auto; }

.course-content {
  flex: 1; padding: 2rem 3rem; max-width: 900px;
}

/* ── Course meta badges ── */
.course-meta {
  display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.75rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border);
}
.badge-level { color: var(--an-teal); border-color: rgba(36, 148, 122, 0.3); background: var(--an-teal-soft); }
.badge-hours { color: var(--an-purple); border-color: rgba(155, 81, 224, 0.3); background: var(--an-purple-soft); }
.badge-module { color: var(--an-orange); border-color: rgba(253, 161, 0, 0.3); background: var(--an-orange-soft); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9rem; }
th, td { padding: 0.7rem 1rem; text-align: left; border: 1px solid var(--border); }
th {
  background: var(--an-teal-soft); color: var(--an-teal);
  font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em;
}
[data-theme="dark"] th { background: rgba(36, 148, 122, 0.1); }
td { color: var(--text-muted); }
tr:hover td { background: var(--an-navy-soft); }
[data-theme="dark"] tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* ── Code blocks ── */
pre {
  background: var(--bg-code-block);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.2rem; margin: 1rem 0;
  overflow-x: auto; position: relative;
}
pre code {
  font-family: var(--font-mono); font-size: 0.88rem;
  color: #c9d1d9; line-height: 1.6;
}
code:not(pre code) {
  background: var(--an-teal-soft); color: var(--an-teal);
  padding: 0.15rem 0.4rem; border-radius: var(--radius-xs);
  font-family: var(--font-mono); font-size: 0.88em;
}
pre .lang-tag {
  position: absolute; top: 0.5rem; right: 0.8rem;
  font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ── Lists ── */
ul, ol { padding-left: 1.5rem; margin: 0.8rem 0; }
li { margin: 0.4rem 0; color: var(--text-muted); }
li::marker { color: var(--an-teal); }

/* ── Blockquotes ── */
blockquote {
  border-left: 3px solid var(--an-teal); margin: 1.5rem 0;
  padding: 1rem 1.5rem; background: var(--an-teal-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
blockquote p { color: var(--text-muted); margin: 0; }

/* ── Details / Accordion ── */
details {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin: 1rem 0; overflow: hidden;
}
details summary {
  padding: 0.8rem 1.2rem; cursor: pointer; font-weight: 600;
  color: var(--an-teal); list-style: none;
  display: flex; align-items: center; gap: 0.5rem;
}
details summary::before { content: '▸'; transition: transform var(--transition); }
details[open] summary::before { transform: rotate(90deg); }
details > *:not(summary) { padding: 0 1.2rem 1rem; }

/* ── Course navigation ── */
.course-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin: 3rem 0 2rem; padding-top: 2rem; border-top: 1px solid var(--border);
  gap: 1rem;
}
.course-nav a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 0.9rem; transition: all var(--transition);
}
.course-nav a:hover { border-color: var(--an-teal); color: var(--an-teal); }

/* ── Footer ── */
footer {
  background: var(--an-navy); color: rgba(255,255,255,0.7);
  padding: 2.5rem 2rem; text-align: center; font-size: 0.85rem;
  margin-top: 3rem;
}
footer a { color: rgba(255,255,255,0.8); }
footer a:hover { color: var(--an-teal-light); }
footer .footer-logo {
  font-family: var(--font-heading); font-weight: 700;
  font-size: 1.2rem; color: #fff; margin-bottom: 0.5rem;
}
footer .footer-logo span { color: var(--an-teal-light); }

/* ── Section divider ── */
.section-title {
  text-align: center; margin: 4rem 0 2rem;
}
.section-title h2 { margin-bottom: 0.5rem; }
.section-title p { color: var(--text-muted); }

/* ── Teal accent bar (decorative) ── */
.accent-bar {
  width: 60px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--an-teal), var(--an-teal-light));
  margin: 0.8rem auto 0;
}
.section-title .accent-bar { margin: 0.8rem auto 0; }

/* ── Stats row (homepage) ── */
.stats-row {
  display: flex; justify-content: center; gap: 3rem;
  margin: 2rem 0; flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-item .stat-value {
  font-family: var(--font-heading); font-weight: 800;
  font-size: 2rem; color: var(--an-teal);
}
.stat-item .stat-label {
  font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  .hero { padding: 3rem 1rem 2rem; }
  .hero h1 { font-size: 2rem; }
  .navbar { padding: 0.8rem 1rem; }
  .navbar nav { display: none; }
  .nav-toggle { display: block; }
  .navbar.open nav {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-navbar); border-bottom: 1px solid var(--border);
    padding: 1rem 2rem; gap: 0.5rem;
    box-shadow: var(--shadow);
  }
  .cards-grid { grid-template-columns: 1fr; }
  .course-sidebar { display: none; }
  .course-content { padding: 1.5rem; }
  .progress-box { flex-direction: column; gap: 1rem; }
  .course-nav { flex-direction: column; }
  .btn-group { flex-direction: column; align-items: center; }
  .container { padding: 0 1rem; }
  .stats-row { gap: 1.5rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .course-sidebar { width: 220px; }
  .course-content { padding: 2rem; }
}

/* ── Print ── */
@media print {
  .navbar, .course-sidebar, footer, .course-nav, .theme-toggle { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .course-content { max-width: 100%; padding: 0; }
  h1, h2, h3, h4, strong { color: #000 !important; }
  a { color: #000 !important; text-decoration: underline; }
  pre { border: 1px solid #ccc; }
  .hero, .hero-small { background: #333 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
