/* ═══════════════════════════════════════════════════════
   Formation NestJS Backend TypeScript — Design System
   Dark Glassmorphism · Responsive · Animé
   ═══════════════════════════════════════════════════════ */

:root {
  --bg:         #0a0e1a;
  --bg-2:       #0d1117;
  --bg-3:       #161b22;

  --glass:      rgba(22, 27, 34, 0.70);
  --glass-lite: rgba(255, 255, 255, 0.04);
  --glass-hover:rgba(255, 255, 255, 0.07);

  --border:       rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.20);

  --text:           #e6edf3;
  --text-secondary: #8b949e;
  --muted:          #8b949e;
  --faint:          #484f58;

  --yellow: #ffd43b;
  --blue:   #79c0ff;
  --green:  #3fb950;
  --purple: #d2a8ff;
  --red:    #f85149;
  --orange: #f78166;

  /* ── NestJS accent ── */
  --nestjs:        #E0234E;
  --nestjs-light:  #ff6b8a;
  --nestjs-dark:   #b01a3c;
  --nestjs-bg:     rgba(224, 35, 78, 0.08);
  --glow-nestjs:   0 0 24px rgba(224, 35, 78, 0.28);

  /* ── TypeScript accent ── */
  --typescript:    #3178c6;
  --ts-light:      #5ba0e0;
  --glow-ts:       0 0 24px rgba(49, 120, 198, 0.22);

  /* ── Autres technologies ── */
  --typeorm:       #e8271a;
  --passport:      #34d058;
  --swagger:       #49cc90;
  --graphql:       #e10098;
  --redis-color:   #dc382d;
  --ws-color:      #7c3aed;

  /* ── Code ── */
  --code-bg:  rgba(7, 11, 20, 0.85);
  --surface:  rgba(22, 27, 34, 0.70);

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --blur:    blur(20px);
  --blur-sm: blur(12px);

  --shadow:    0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.30);

  --glow-y: 0 0 24px rgba(255, 212,  59, 0.20);
  --glow-b: 0 0 24px rgba(121, 192, 255, 0.15);
  --glow-g: 0 0 24px rgba( 63, 185,  80, 0.15);

  --transition: all 0.22s ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(224, 35, 78, 0.20); }

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 1rem;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; height: 56px;
  flex-shrink: 0;
}
.header-title {
  font-weight: 800; font-size: 0.88rem;
  background: linear-gradient(135deg, var(--nestjs), var(--typescript));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; white-space: nowrap;
}
.header-sub { font-size: 0.78rem; color: var(--muted); flex: 1; }
.back-link {
  font-size: 0.75rem; color: var(--muted); padding: 0.3rem 0.7rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: var(--transition); white-space: nowrap;
}
.back-link:hover { color: var(--text); border-color: rgba(224,35,78,0.4); background: rgba(224,35,78,0.07); }

/* ── Layout 2 colonnes ───────────────────────────────── */
.layout {
  display: flex; min-height: calc(100vh - 56px);
}
.layout > nav {
  width: 220px; flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 1.4rem 0;
  position: sticky; top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.layout > nav::-webkit-scrollbar { width: 3px; }
.layout > nav::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 2px; }

.nav-section {
  display: block; font-size: 0.60rem; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--nestjs); padding: 0 1.1rem 0.7rem;
}
.nav-link {
  display: block; font-size: 0.78rem; color: var(--muted);
  padding: 0.38rem 1.1rem; border-left: 2px solid transparent;
  transition: var(--transition);
}
.nav-link:hover { color: var(--text); background: rgba(224,35,78,0.05); border-left-color: rgba(224,35,78,0.30); }
.nav-link.active { background: rgba(224,35,78,0.10); color: var(--nestjs); border-left-color: var(--nestjs); font-weight: 600; }
.nav-divider { height: 1px; background: var(--border); margin: 0.7rem 1.1rem; }

/* ── Contenu principal ───────────────────────────────── */
.content {
  flex: 1; min-width: 0;
  padding: 2.2rem 2.4rem;
  max-width: 880px;
}
@media (max-width: 900px) { .content { padding: 1.4rem 1.2rem; } }

/* ── Sections ────────────────────────────────────────── */
.section { margin-bottom: 3rem; }
.section h2 {
  font-size: 1.35rem; font-weight: 800;
  background: linear-gradient(135deg, var(--text) 60%, var(--nestjs-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 1rem; padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.section h3 { font-size: 1rem; font-weight: 700; color: var(--ts-light); margin: 1.4rem 0 0.7rem; }
.section p  { color: var(--muted); font-size: 0.90rem; line-height: 1.7; margin-bottom: 0.85rem; }
.section ul, .section ol { padding-left: 1.4rem; color: var(--muted); font-size: 0.88rem; }
.section li { margin-bottom: 0.25rem; }

/* ── Cartes ─────────────────────────────────────────── */
.card {
  background: var(--glass); backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; transition: var(--transition);
}
.card:hover { border-color: rgba(224,35,78,0.45); transform: translateY(-3px); box-shadow: 0 16px 44px rgba(0,0,0,0.40), var(--glow-nestjs); }
.card.completed { border-color: rgba(63,185,80,0.38); }
.card.completed:hover { border-color: var(--green); box-shadow: 0 16px 44px rgba(0,0,0,0.40), 0 0 24px rgba(63,185,80,0.15); }

/* ── Code blocks ─────────────────────────────────────── */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  overflow-x: auto; font-size: 0.82rem;
  line-height: 1.6; margin-bottom: 1.2rem;
  position: relative;
}
pre code { background: none; padding: 0; font-size: inherit; }
code {
  font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
  font-size: 0.83rem;
  background: rgba(224,35,78,0.10);
  color: var(--nestjs-light);
  padding: 0.1rem 0.35rem; border-radius: 4px;
}
pre code { color: inherit; background: none; }

/* ── Bouton copier ───────────────────────────────────── */
.copy-btn {
  position: absolute; top: 0.55rem; right: 0.55rem;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  color: var(--muted); border-radius: 5px;
  width: 28px; height: 28px; cursor: pointer;
  font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.copy-btn:hover { background: rgba(255,255,255,0.14); color: var(--text); }
.copy-btn.copied { color: var(--green); border-color: rgba(63,185,80,0.4); }

/* ── Badges ─────────────────────────────────────────── */
.badge-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.6rem; }
.badge {
  font-size: 0.68rem; font-weight: 700; padding: 0.18rem 0.55rem;
  border-radius: 20px; border: 1px solid;
  font-family: 'Consolas', monospace; letter-spacing: 0.3px;
}
.badge-nestjs    { background: rgba(224,35,78,0.12);  color: var(--nestjs);      border-color: rgba(224,35,78,0.30); }
.badge-typescript{ background: rgba(49,120,198,0.12); color: var(--typescript);  border-color: rgba(49,120,198,0.30); }
.badge-typeorm   { background: rgba(232,39,26,0.10);  color: #f87171;            border-color: rgba(232,39,26,0.28); }
.badge-swagger   { background: rgba(73,204,144,0.10); color: var(--swagger);     border-color: rgba(73,204,144,0.28); }
.badge-passport  { background: rgba(52,208,88,0.10);  color: var(--passport);    border-color: rgba(52,208,88,0.28); }
.badge-redis     { background: rgba(220,56,45,0.10);  color: #fca5a5;            border-color: rgba(220,56,45,0.28); }
.badge-ws        { background: rgba(124,58,237,0.12); color: #c4b5fd;            border-color: rgba(124,58,237,0.30); }

/* ── Boutons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; font-weight: 600;
  padding: 0.52rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: var(--transition); white-space: nowrap;
  background: var(--glass); color: var(--muted);
  font-family: inherit; text-decoration: none;
}
.btn:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: var(--border-hover); }

.btn-nestjs { color: var(--nestjs); background: rgba(224,35,78,0.08); border-color: rgba(224,35,78,0.28); }
.btn-nestjs:hover { background: rgba(224,35,78,0.16); border-color: var(--nestjs); color: var(--nestjs-light); }

.btn-ts { color: var(--typescript); background: rgba(49,120,198,0.08); border-color: rgba(49,120,198,0.28); }
.btn-ts:hover { background: rgba(49,120,198,0.16); border-color: var(--typescript); }

/* ── Reveal animation ────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ── Modules grid ────────────────────────────────────── */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

/* ── Module card (index.html) ────────────────────────── */
.module-card {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.7rem;
  text-decoration: none; color: var(--text); position: relative; overflow: hidden;
  transition: var(--transition);
}
.module-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--c, var(--nestjs)); opacity: 0; transition: opacity 0.25s;
}
.module-card:hover { border-color: rgba(224,35,78,0.35); transform: translateY(-3px); box-shadow: var(--shadow), var(--glow-nestjs); }
.module-card:hover::before { opacity: 1; }
.module-card.soon { opacity: 0.4; pointer-events: none; }

.module-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 8px; font-size: 0.72rem; font-weight: 800;
  color: var(--nestjs); background: rgba(224,35,78,0.10); border: 1px solid rgba(224,35,78,0.22);
  font-family: 'Consolas', monospace; flex-shrink: 0;
}
.module-card h2 { font-size: 0.95rem; font-weight: 700; color: var(--nestjs-light); }
.module-card p  { font-size: 0.78rem; color: var(--muted); line-height: 1.5; flex: 1; }
.module-meta { display: flex; gap: 0.5rem; align-items: center; font-size: 0.72rem; color: var(--faint); }

/* ── Progress bar ────────────────────────────────────── */
.progress-bar { height: 6px; background: rgba(255,255,255,0.07); border-radius: 10px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: linear-gradient(90deg, var(--nestjs), var(--typescript)); border-radius: 10px; transition: width 0.6s ease; }

/* ── Hero (index.html) ───────────────────────────────── */
.hero-section {
  padding: 3rem 2.5rem 2.5rem;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(224,35,78,0.12), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.hero-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 900;
  background: linear-gradient(135deg, #E0234E 0%, #ff6b8a 45%, #3178c6 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 0.6rem; line-height: 1.15;
}
.hero-sub { font-size: 0.90rem; color: var(--muted); max-width: 600px; line-height: 1.7; margin-bottom: 1.4rem; }
.stats-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1.2rem; }
.stat-box { text-align: center; }
.stat-box .num { font-size: 1.6rem; font-weight: 900; color: var(--nestjs); line-height: 1; }
.stat-box .lbl { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 0.15rem; }

/* ── Section header ──────────────────────────────────── */
.section-header {
  display: flex; align-items: center; gap: 0.8rem; margin: 2.5rem 0 1rem;
}
.section-header h2 { font-size: 0.65rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.section-header::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nestjs); flex-shrink: 0; }

/* ── QCM Banner ──────────────────────────────────────── */
.qcm-banner {
  background: linear-gradient(135deg, rgba(224,35,78,0.08), rgba(49,120,198,0.06));
  border: 1px solid rgba(224,35,78,0.18);
  border-radius: var(--radius); padding: 1.5rem 1.8rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  margin-top: 2.5rem;
}
.qcm-banner .qcm-icon { font-size: 2.2rem; flex-shrink: 0; }
.qcm-banner h3 { font-size: 1.05rem; font-weight: 800; color: var(--nestjs-light); margin-bottom: 0.2rem; }
.qcm-banner p  { font-size: 0.83rem; color: var(--muted); }

/* ── Callout boxes ───────────────────────────────────── */
.info-box {
  background: rgba(49,120,198,0.07); border: 1px solid rgba(49,120,198,0.22);
  border-left: 3px solid var(--typescript); border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem; font-size: 0.87rem; color: var(--muted); line-height: 1.65; margin-bottom: 1.2rem;
}
.info-box strong { color: var(--text); }

.tip-box {
  background: rgba(63,185,80,0.06); border: 1px solid rgba(63,185,80,0.20);
  border-left: 3px solid var(--green); border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem; font-size: 0.87rem; color: var(--muted); line-height: 1.65; margin-bottom: 1.2rem;
}
.tip-box strong { color: var(--text); }

.warn-box {
  background: rgba(255,212,59,0.06); border: 1px solid rgba(255,212,59,0.20);
  border-left: 3px solid var(--yellow); border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem; font-size: 0.87rem; color: var(--muted); line-height: 1.65; margin-bottom: 1.2rem;
}
.warn-box strong { color: var(--text); }

.danger-box {
  background: rgba(224,35,78,0.07); border: 1px solid rgba(224,35,78,0.22);
  border-left: 3px solid var(--nestjs); border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem; font-size: 0.87rem; color: var(--muted); line-height: 1.65; margin-bottom: 1.2rem;
}
.danger-box strong { color: var(--text); }

/* ── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; margin-bottom: 1.2rem; }
th { background: rgba(255,255,255,0.04); color: var(--text-secondary); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.7px; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); text-align: left; }
td { padding: 0.55rem 0.9rem; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--muted); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Containers ──────────────────────────────────────── */
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 1.2rem; }
@media (min-width: 768px) { .container { padding: 0 2rem; } }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .layout { flex-direction: column !important; }
  .layout > nav { width: 100% !important; height: auto !important; position: static !important; border-right: none !important; border-bottom: 1px solid var(--border); }
  .modules-grid { grid-template-columns: 1fr; }
}

/* ── Home button ─────────────────────────────────────── */
.site-home-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  color: var(--muted); border: 1px solid var(--border);
  background: rgba(255,255,255,0.03); transition: var(--transition);
  flex-shrink: 0; text-decoration: none;
}
.site-home-btn:hover { color: var(--text); background: rgba(255,255,255,0.09); border-color: rgba(224,35,78,0.40); }

/* ── Variantes cartes avancées ───────────────────────── */
.card.advanced { border-color: rgba(49,120,198,0.14); }
.card.advanced:hover { border-color: rgba(49,120,198,0.45); box-shadow: 0 16px 44px rgba(0,0,0,0.42), var(--glow-ts); }
.card.final { border-color: rgba(247,129,102,0.18); }
.card.final:hover { border-color: var(--orange); box-shadow: 0 16px 44px rgba(0,0,0,0.42), 0 0 24px rgba(247,129,102,0.15); }


/* ══ Mobile Complet (640 · 420 px) ══════════════════════ */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .site-header { height: auto; min-height: 52px; padding: 0.5rem 0.9rem; }
  .site-header .header-sub { display: none; }
  pre, .code-block { font-size: 0.75rem; padding: 0.8rem 0.85rem; }
  table, .ts-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .container, .container-wide { padding-left: 0.9rem; padding-right: 0.9rem; }
  .content { padding: 1rem 0.9rem !important; }
  .sidebar { display: none !important; }
  .layout { flex-direction: column !important; }
  .modules-grid { grid-template-columns: 1fr !important; }
  .hero-stats, .stats-row { gap: 1rem; }
}
@media (max-width: 420px) {
  h1 { font-size: 1.3rem !important; }
}