/* ============================================================
   Pass-Nationalité — Design System Républicain Premium
   Examen Civique 2026 & Entretien d'Assimilation Préfecture
   ============================================================ */

:root {
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Georgia", "Cambria", "Times New Roman", serif;

  /* Palette Nationale & Républicaine */
  --blue-republic: #002654;
  --blue-france: #1d4ed8;
  --blue-soft: #eff6ff;
  --blue-border: #bfdbfe;

  --red-marianne: #ce1126;
  --red-soft: #fef2f2;
  --red-border: #fecaca;

  --gold-laurel: #c59b27;
  --gold-soft: #fffbeb;
  --gold-border: #fef3c7;

  --green-success: #059669;
  --green-soft: #ecfdf5;

  /* Surfaces & Textes */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-light: #e2e8f0;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 38, 84, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

html[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-card: #131d33;
  --bg-card-subtle: #1a2642;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border-light: #1e293b;

  --blue-soft: rgba(29, 78, 216, 0.15);
  --blue-border: #1e3a8a;
  --red-soft: rgba(206, 17, 38, 0.15);
  --red-border: #7f1d1d;
  --gold-soft: rgba(197, 155, 39, 0.15);
  --gold-border: #78350f;
  --green-soft: rgba(5, 150, 105, 0.15);

  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   En-tête de l'application (App Bar)
   ============================================================ */
.app-header {
  background: var(--blue-republic);
  color: #ffffff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 2px solid var(--gold-laurel);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-emblem {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #002654, #ce1126);
  border: 1.5px solid var(--gold-laurel);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.5px;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fef08a;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   Conteneur Principal & Vues
   ============================================================ */
.main-container {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 85px 16px;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.view-section.is-active {
  display: block;
}

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

/* ============================================================
   Bandeau & Cartes d'Accueil
   ============================================================ */
.republic-hero {
  background: linear-gradient(135deg, var(--blue-republic), #0f172a);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  border-left: 6px solid var(--red-marianne);
}

.republic-hero::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(197, 155, 39, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fef08a;
  margin-bottom: 10px;
}

.hero-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 18px;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-marianne), #b91c1c);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(206, 17, 38, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(206, 17, 38, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
  border-color: var(--blue-france);
  color: var(--blue-france);
}

.republic-hero .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.republic-hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ============================================================
   Jauge de Préparation & Statistiques
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Barre de progression globale */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-card-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-france), var(--gold-laurel));
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ============================================================
   Cartes des 4 Piliers du Livret du Citoyen
   ============================================================ */
.section-heading {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin: 20px 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.pillar-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-france);
}

.pillar-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.pillar-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.pillar-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 14px;
  flex: 1;
}

.pillar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-france);
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

/* ============================================================
   Simulateur Examen Civique (Vue Examen)
   ============================================================ */
.exam-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 65px;
  z-index: 50;
}

.exam-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--blue-republic);
  background: var(--blue-soft);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue-border);
}

.exam-timer.is-warning {
  color: var(--red-marianne);
  background: var(--red-soft);
  border-color: var(--red-border);
  animation: pulse 1s infinite;
}

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

.exam-progress {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.q-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--blue-france);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: 12px;
}

.q-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 20px;
}

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

.option-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.option-btn:hover {
  border-color: var(--blue-france);
  background: var(--blue-soft);
}

.option-btn.is-selected {
  border-color: var(--blue-france);
  background: var(--blue-soft);
  font-weight: 700;
}

.opt-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.option-btn.is-selected .opt-letter {
  background: var(--blue-france);
  color: #ffffff;
}

.exam-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

/* ============================================================
   Verdict et Débriefing d'Examen (32/40)
   ============================================================ */
.verdict-card {
  border-radius: var(--radius-xl);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}

.verdict-card.is-passed {
  background: linear-gradient(135deg, #065f46, #047857);
  color: #ffffff;
}

.verdict-card.is-failed {
  background: linear-gradient(135deg, #991b1b, #b91c1c);
  color: #ffffff;
}

.verdict-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 8px;
}

.verdict-score {
  font-size: 48px;
  font-weight: 900;
  margin: 12px 0;
  line-height: 1;
}

.verdict-text {
  font-size: 15px;
  color: #f1f5f9;
  max-width: 550px;
  margin: 0 auto 20px auto;
  line-height: 1.5;
}

/* ============================================================
   Simulateur Entretien Préfecture (Vue Oral)
   ============================================================ */
.oral-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
}

.oral-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.oral-question {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 16px;
}

.oral-intent {
  background: var(--blue-soft);
  border-left: 4px solid var(--blue-france);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-main);
  margin-bottom: 14px;
}

.oral-intent strong {
  color: var(--blue-france);
}

.oral-answer-box {
  background: var(--gold-soft);
  border-left: 4px solid var(--gold-laurel);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 14px;
}

.oral-pitfalls {
  background: var(--red-soft);
  border-left: 4px solid var(--red-marianne);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
}

.voice-btn {
  background: var(--blue-france);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
  transition: transform 0.15s;
}

.voice-btn:hover {
  transform: scale(1.05);
}

/* ============================================================
   Barre de Navigation Inférieure (Mobile First)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px;
  z-index: 90;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-tab {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.nav-tab.is-active {
  color: var(--blue-republic);
}

html[data-theme="dark"] .nav-tab.is-active {
  color: #60a5fa;
}

.nav-tab svg {
  width: 22px;
  height: 22px;
}

/* ============================================================
   Modales & Utilitaires
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

/* ============================================================
   Onglets et Composants Mémos & Livret du Citoyen
   ============================================================ */
.memo-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 22px;
  -webkit-overflow-scrolling: touch;
}

.memo-tab-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.memo-tab-btn:hover {
  border-color: var(--blue-france);
  color: var(--blue-france);
  background: var(--blue-soft);
}

.memo-tab-btn.is-active {
  background: linear-gradient(135deg, var(--blue-republic), #1e3a8a);
  color: #ffffff;
  border-color: var(--blue-republic);
  box-shadow: 0 4px 12px rgba(0, 38, 84, 0.25);
}

.charte-box {
  background: linear-gradient(135deg, var(--bg-card), var(--gold-soft));
  border: 1px solid var(--gold-border);
  border-left: 5px solid var(--gold-laurel);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.charte-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.checklist-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--blue-republic);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

html[data-theme="dark"] .checklist-title {
  color: #93c5fd;
}

.checklist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-list li {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-main);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.check-bullet {
  color: var(--green-success);
  font-weight: 900;
  flex-shrink: 0;
}

