@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;600;700;900&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0f172a;
  --accent: #ef4444;
  --success: #16a34a;
  --warning: #ea580c;
  --neutral: #64748b;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .brand-font {
  font-family: 'Outfit', sans-serif;
}

/* En-tête / Header */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.45rem;
  color: var(--secondary);
}

.logo .on {
  color: var(--primary);
}

.logo .tld {
  color: var(--accent);
}

.tricolore-pill {
  display: inline-flex;
  height: 8px;
  width: 24px;
  border-radius: 4px;
  overflow: hidden;
}

.tricolore-pill span:nth-child(1) { background: #002395; width: 33.33%; }
.tricolore-pill span:nth-child(2) { background: #ffffff; width: 33.33%; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; }
.tricolore-pill span:nth-child(3) { background: #ed2939; width: 33.33%; }

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  transition: color 0.2s;
  cursor: pointer;
}

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

/* Conteneur principal */
.main-wrapper {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* Vues (SPA) */
.view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view.active {
  display: block;
}

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

/* HERO SECTION */
.hero-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #2563eb, #ffffff, #ef4444);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.3px;
  border: 1px solid #bfdbfe;
}

.hero-title {
  font-size: 2.7rem;
  font-weight: 900;
  line-height: 1.15;
  color: #0f172a;
  margin-bottom: 18px;
}

.hero-title span {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto 30px;
}

.mode-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  background: #fdfdfe;
}

.mode-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
}

.mode-card.selected {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

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

.mode-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--secondary);
}

.mode-time {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
}

.mode-card.selected .mode-time {
  background: #bfdbfe;
  color: #1e40af;
}

.mode-details {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-start {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.5);
}

/* Garanties citoyennes */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
}

.trust-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.trust-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.trust-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--secondary);
}

.trust-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* SECTION QUIZ */
.quiz-header {
  margin-bottom: 24px;
}

.quiz-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.question-counter {
  font-weight: 800;
  color: var(--secondary);
  font-size: 1rem;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.question-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  position: relative;
}

.question-tag {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.question-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.35;
  color: #0f172a;
  margin-bottom: 16px;
}

.question-expl {
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 30px;
}

/* Options de vote */
.answers-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.btn-answer {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
  text-align: left;
}

.btn-answer .badge-key {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 700;
}

.btn-answer:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateX(4px);
}

.btn-answer.opt-strongly-agree:hover, .btn-answer.opt-strongly-agree.selected {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #15803d;
}

.btn-answer.opt-agree:hover, .btn-answer.opt-agree.selected {
  border-color: #65a30d;
  background: #f7fee7;
  color: #4d7c0f;
}

.btn-answer.opt-neutral:hover, .btn-answer.opt-neutral.selected {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #334155;
}

.btn-answer.opt-disagree:hover, .btn-answer.opt-disagree.selected {
  border-color: #f97316;
  background: #fff7ed;
  color: #c2410c;
}

.btn-answer.opt-strongly-disagree:hover, .btn-answer.opt-strongly-disagree.selected {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
}

/* Sélecteur de pondération */
.quiz-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.weight-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weight-checkbox {
  display: none;
}

.weight-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  transition: all 0.2s;
  user-select: none;
}

.weight-checkbox:checked + .weight-label {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.quiz-nav-btns {
  display: flex;
  gap: 12px;
}

.btn-nav {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--secondary);
  transition: all 0.2s;
}

.btn-nav:hover {
  background: #f1f5f9;
}

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

/* SECTION RÉSULTATS */
.results-header {
  text-align: center;
  margin-bottom: 36px;
}

.results-badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.results-title {
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.results-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Podium */
.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 40px;
}

.podium-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border);
  position: relative;
  transition: transform 0.2s;
}

.podium-card:hover {
  transform: translateY(-4px);
}

.podium-card.first {
  border-color: #3b82f6;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.15);
  transform: scale(1.04);
  z-index: 2;
  background: linear-gradient(180deg, #ffffff, #f0f7ff);
}

.podium-rank {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 999px;
}

.podium-card.first .podium-rank {
  background: #2563eb;
}

.candidate-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 10px auto 14px;
  display: block;
  border: 3px solid #e2e8f0;
}

.podium-card.first .candidate-avatar {
  border-color: #2563eb;
  width: 90px;
  height: 90px;
}

.candidate-name {
  font-weight: 800;
  font-size: 1.25rem;
  color: #0f172a;
  margin-bottom: 4px;
}

.candidate-party {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  min-height: 38px;
}

.candidate-percent {
  font-family: 'Outfit', sans-serif;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.candidate-percent-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Boutons de partage et actions */
.share-action-box {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.share-info h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.share-info p {
  color: #94a3b8;
  font-size: 0.95rem;
}

.share-buttons {
  display: flex;
  gap: 12px;
}

.btn-share {
  background: #2563eb;
  color: white;
  border: none;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-share:hover {
  background: #1d4ed8;
}

.btn-restart {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-restart:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Classement complet */
.full-ranking-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 40px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--secondary);
}

.candidate-row {
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  cursor: pointer;
  transition: background 0.15s;
}

.candidate-row:last-child {
  border-bottom: none;
}

.candidate-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.candidate-info-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rank-badge {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-muted);
  width: 24px;
}

.mini-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.candidate-titles h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary);
}

.candidate-titles span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.candidate-score-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-bar-bg {
  width: 140px;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.score-bar-val {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
}

.score-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--secondary);
  width: 60px;
  text-align: right;
}

/* Accordéon de détail */
.candidate-details-pane {
  display: none;
  padding-top: 18px;
  margin-top: 14px;
  border-top: 1px dashed var(--border);
}

.candidate-details-pane.open {
  display: block;
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.theme-score-chip {
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}

.points-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.points-col h5 {
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.points-col.agreements h5 { color: #16a34a; }
.points-col.disagreements h5 { color: #dc2626; }

.point-item {
  font-size: 0.85rem;
  color: #334155;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
  line-height: 1.4;
}

/* Modal Partage */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.share-preview-img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

/* Pied de page / Footer */
.app-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 40px 20px 30px;
  margin-top: auto;
}

.footer-container {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.footer-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.88rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Responsive */
@media (max-width: 768px) {
  .hero-title { font-size: 2.1rem; }
  .mode-selector { grid-template-columns: 1fr; }
  .trust-grid { grid-template-columns: 1fr; }
  .podium-grid { grid-template-columns: 1fr; align-items: stretch; }
  .podium-card.first { transform: none; }
  .share-action-box { flex-direction: column; gap: 20px; text-align: center; }
  .points-list { grid-template-columns: 1fr; }
  .score-bar-bg { display: none; }
}
