/* PourQuiVoter - Minimal Cool Theme (Slate/Blue) */

:root {
  /* === PALETTE MINIMAL COOL === */

  /* Couleurs principales (gris ardoise/bleuté) */
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --primary-light: #334155;

  /* Header gradient */
  --header-bg-start: #1e293b;
  --header-bg-end: #334155;
  --header-text: #ffffff;

  /* Backgrounds */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-input: #ffffff;

  /* Textes */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  /* Bordures */
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #94a3b8;

  /* Accent (pour CTA, liens, éléments interactifs) */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.1);

  /* Succès / Validation */
  --success: #059669;
  --success-light: rgba(5, 150, 105, 0.1);

  /* Erreur */
  --error: #dc2626;
  --error-light: rgba(220, 38, 38, 0.1);

  /* Ombres */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);

  /* Rayons */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  /* Font */
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Legacy compatibility */
  --bg-gradient-start: #1e293b;
  --bg-gradient-end: #334155;
  --text: #0f172a;
  --border-color: #e2e8f0;
  --shadow: rgba(15, 23, 42, 0.08);
  --radius: 8px;
}

/* Dark Mode */
[data-theme="dark"] {
  /* Couleurs principales inversées */
  --primary: #e2e8f0;
  --primary-hover: #f1f5f9;
  --primary-light: #cbd5e1;

  /* Header gradient (plus sombre) */
  --header-bg-start: #0f172a;
  --header-bg-end: #1e293b;
  --header-text: #f1f5f9;

  /* Backgrounds */
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --bg-input: #1e293b;

  /* Textes */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0f172a;

  /* Bordures */
  --border: #334155;
  --border-hover: #475569;
  --border-focus: #64748b;

  /* Accent (plus lumineux en dark) */
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59, 130, 246, 0.15);

  /* Succès */
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);

  /* Erreur */
  --error: #f87171;
  --error-light: rgba(248, 113, 113, 0.15);

  /* Ombres (plus fortes en dark) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);

  /* Legacy compatibility */
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e293b;
  --text: #f1f5f9;
  --border-color: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
  padding: 10px 20px;
  transition: background var(--transition-normal), color var(--transition-normal);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0 40px 10px 40px; /* Supprime le padding en haut pour le header */
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  transition: all var(--transition-normal);
  overflow-x: hidden; /* Cache le débordement horizontal pour le border-radius */
  overflow-y: visible; /* Permet au tooltip de dépasser en haut */
}

/* === NOUVEAU HEADER === */
.header {
  background: linear-gradient(135deg, #1e293b, #334155);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;

  /* Pleine largeur sans marge - compense le padding latéral du conteneur */
  margin: 0 -40px 16px -40px; /* Marges négatives = padding latéral du .container */
  width: calc(100% + 80px); /* Compense les marges négatives (40px * 2) */

  /* Coins arrondis en haut seulement - même valeur que le conteneur parent */
  border-radius: 12px 12px 0 0; /* var(--radius-lg) = 12px */

  /* Cliquable */
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.header:hover {
  opacity: 0.95;
}

.header:active {
  opacity: 0.9;
}

.header-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.header-logo svg {
  width: 100%;
  height: 100%;
}

.header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Aligne les deux textes à gauche */
  gap: 2px; /* Petit gap pour meilleur alignement visuel */
  justify-content: center; /* Centre verticalement le texte */
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
  text-align: left;
}

.header-tagline {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
  text-align: left;
}

/* Responsive header */
@media (max-width: 768px) {
  .container {
    padding: 0 20px 30px 20px; /* Réduit le padding latéral en tablette */
  }

  .header {
    margin: 0 -20px 30px -20px; /* Ajuste les marges négatives */
    width: calc(100% + 40px); /* Ajuste la largeur (20px * 2) */
    padding: 14px 20px;
    border-radius: 12px 12px 0 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px 20px 16px; /* Réduit encore plus en mobile */
  }

  .header {
    margin: 0 -16px 20px -16px; /* Ajuste les marges négatives */
    width: calc(100% + 32px); /* Ajuste la largeur (16px * 2) */
    padding: 12px 16px; /* Garde un minimum de 16px pour le logo */
    border-radius: 12px 12px 0 0;
  }

  .header-logo {
    width: 36px;
    height: 36px;
  }
  .header-title {
    font-size: 1.1rem;
  }
  .header-tagline {
    font-size: 0.8rem;
  }
}

/* Legacy support - keep old classes for backward compatibility during transition */
header {
  text-align: center;
  margin-bottom: 30px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.header-content > div {
  flex: 1;
}

header h1 {
  font-size: 2.5rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
}

.app-logo {
  width: 48px;
  height: 48px;
  color: var(--accent);
  flex-shrink: 0;
}

#app-title {
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#app-title:hover {
  transform: scale(1.05);
  opacity: 0.8;
}

#app-title:active {
  transform: scale(0.98);
}

.tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
}


/* Steps */
.step {
  display: none;
}

.step.active {
  display: block;
  animation: fadeIn 0.3s;
}

/* Padding pour le quiz */
#step-quiz {
  padding-bottom: 10px;
}

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

/* Écran info commune avec image de fond */
.commune-info-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  margin: -10px -20px;
  padding: 10px 20px;
}

/* Image de fond plein écran */
.commune-background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  transition: opacity 0.5s ease;
}

/* Overlay sombre pour lisibilité */
.commune-background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.7) 0%,
    rgba(15, 23, 42, 0.85) 100%
  );
}

/* Contenu par-dessus l'image */
.commune-content {
  position: relative;
  z-index: 1;
}

/* Crédit photo discret */
.photo-credit {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Écran info commune */
.commune-info-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 30px;
  margin: 30px 0;
}

/* Photo de la commune */
.commune-photo-container {
  position: relative;
  width: calc(100% + 60px);
  height: 180px;
  margin: -30px -30px 20px -30px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

/* Effet de texture subtil sur le gradient */
.commune-photo-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.03) 10px,
    rgba(255, 255, 255, 0.03) 20px
  );
  pointer-events: none;
}

.commune-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.commune-photo-container:hover .commune-photo {
  transform: scale(1.05);
}

.commune-photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2) 70%, transparent);
  padding: 25px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.commune-photo-name {
  color: white;
  font-size: 2rem;
  font-weight: 700;
  text-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(0, 0, 0, 0.4);
  letter-spacing: 1px;
  animation: fadeInUp 0.5s ease;
}

.maire-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 0.5s ease 0.2s both;
}

.maire-icon {
  font-size: 1.1rem;
}

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

.commune-info-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 2px solid var(--border-color);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: var(--light);
  border-radius: var(--radius);
  transition: transform 0.3s ease;
}

[data-theme="dark"] .stat-item {
  background: rgba(255, 255, 255, 0.05);
}

.stat-item:hover {
  transform: translateY(-2px);
}

/* Section candidats */
.candidats-section {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--light);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  max-height: 200px;
  overflow-y: auto;
}

[data-theme="dark"] .candidats-section {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

.candidats-title {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
}

.candidats-liste {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.candidat-item {
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.candidat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

[data-theme="dark"] .candidat-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.candidat-item.maire-sortant {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
  border-color: var(--primary);
  font-weight: 600;
}

[data-theme="dark"] .candidat-item.maire-sortant {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(147, 51, 234, 0.15));
}

.stat-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.info-column h3 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.info-list li {
  padding: 5px 0;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-color);
}

.info-list li:last-child {
  border-bottom: none;
}

.info-note {
  background: rgba(var(--primary), 0.1);
  padding: 10px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  border-left: 3px solid var(--primary);
  line-height: 1.4;
}

[data-theme="dark"] .info-note {
  background: rgba(96, 165, 250, 0.15);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

.btn-success {
  background: var(--success);
  color: white;
  border: none;
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

/* CTA principal avec accent */
.btn-accent {
  background: var(--accent);
  color: white;
  border: none;
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-light);
}

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

.btn-outline:hover {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Commune choice */
.commune-choice {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.separator {
  color: var(--secondary);
  font-weight: 600;
}

.commune-select {
  flex: 1;
  min-width: 250px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.commune-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Commune choice inline - Select + Géoloc sur la même ligne */
.commune-choice-inline {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: stretch;
}

.commune-select-inline {
  flex: 1;
  min-width: 250px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.3s ease;
  font-weight: 400;
}

.commune-select-inline:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Commune sélectionnée - mise en valeur */
.commune-select-inline.commune-selected {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.08));
  border-color: var(--accent);
  border-width: 2px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.commune-select-inline.commune-selected:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.1));
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Bouton géoloc - icône seule */
.btn-geoloc {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-geoloc:hover {
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
}

.btn-geoloc svg {
  width: 20px;
  height: 20px;
}

/* Sélecteur commune + bouton géoloc */
.commune-choice-inline {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-bottom: 16px;
}

.commune-select-inline {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text, #0f172a);
  background: var(--bg-card, #ffffff);
  cursor: pointer;
}

/* Actions */
.actions {
  margin-top: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  justify-content: center;
}

/* Actions de l'écran résultats - boutons sur une ligne */
#step-results .actions {
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
}

#step-results .actions .btn {
  flex: 0 0 auto;
  min-width: 160px;
}

/* Responsive : empiler sur mobile */
@media (max-width: 600px) {
  #step-results .actions {
    flex-direction: column;
    gap: 12px;
  }

  #step-results .actions .btn {
    width: 100%;
  }
}

/* Quiz */
.quiz-header {
  margin-bottom: 15px;
}

.quiz-header h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* Header compact - Tout sur une ligne */
.quiz-header-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -8px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.link-back-quiz {
  color: var(--accent);
  font-size: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.link-back-quiz:hover {
  transform: translateX(-3px);
  color: var(--accent-hover);
}

.quiz-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.quiz-header-right h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.quiz-title-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.quiz-title-progress h2 {
  font-size: 1.3rem;
  margin: 0;
  flex-shrink: 0;
}

.progress-inline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

.progress-text {
  text-align: center;
  color: var(--secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Theme indicators */
.theme-indicators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 8px 0 6px 0;
  flex-wrap: wrap;
}

.theme-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--border-color);
  border-radius: 10px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.theme-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  transition: all 0.3s ease;
}

.theme-indicator.covered {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.theme-indicator.covered .theme-indicator-dot {
  background: var(--primary);
}

[data-theme="dark"] .theme-indicator.covered {
  background: rgba(96, 165, 250, 0.15);
}

/* Badge du thème actuel avec emoji */
.current-theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

.theme-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.theme-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-content {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  min-height: 0;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--dark);
  line-height: 1.35;
}

.question-theme {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 3px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.answer-option {
  display: flex;
  align-items: flex-start;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  font-size: 0.9rem;
  line-height: 1.4;
}

.answer-option:hover {
  border-color: var(--primary);
  transform: translateX(5px);
}

.answer-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.answer-option input[type="radio"] {
  margin-right: 10px;
  margin-top: 3px;
  flex-shrink: 0;
}

/* Navigation quiz - Barre dans le flux, après les options */
.quiz-nav {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .quiz-nav {
  background: var(--bg-card, #1e293b);
  border-color: var(--border, #334155);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.quiz-nav .btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  border: none;
  font-size: 0;
  padding: 0;
}

.quiz-nav .btn-icon svg {
  width: 20px;
  height: 20px;
}

.quiz-nav .btn-icon.btn-prev {
  background: transparent;
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text-secondary, #64748b);
}

.quiz-nav .btn-icon.btn-prev:hover:not(:disabled) {
  border-color: var(--primary, #0f172a);
  color: var(--primary, #0f172a);
}

.quiz-nav .btn-icon.btn-prev:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quiz-nav .progress-section {
  flex: 1;
  text-align: center;
}

.quiz-nav .progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  margin-bottom: 6px;
}

.quiz-nav .progress-bar {
  height: 8px;
  background: var(--border, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
}

.quiz-nav .progress-fill {
  height: 100%;
  background: var(--primary, #0f172a);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.quiz-nav .btn-icon.btn-next {
  background: var(--primary, #0f172a);
  color: white;
}

.quiz-nav .btn-icon.btn-next:hover:not(:disabled) {
  background: #1e293b;
}

.quiz-nav .btn-icon.btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bouton résultats (dernier écran) */
.quiz-nav .btn-results {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--success, #059669);
  color: white;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-nav .btn-results svg {
  width: 18px;
  height: 18px;
}

.quiz-nav .btn-results:hover {
  background: #047857;
  transform: scale(1.1);
}

/* Results */
.results-intro {
  text-align: center;
  color: var(--secondary);
  margin-bottom: 30px;
}

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

.result-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s;
}

.result-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Result cards - Layout horizontal compact */
.result-card.compact {
  padding: 10px 14px;
  margin-bottom: 0;
  min-height: auto;
  display: block;
}

/* Top 1 result - Mise en avant subtile */
.result-card-top {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.04) 0%, rgba(118, 75, 162, 0.02) 100%);
  padding: 16px 20px;
}

.result-card-top .result-name {
  font-size: 1.15em;
  font-weight: 600;
}

.result-card-top .score-value {
  font-size: 1.8em;
  font-weight: 700;
}

.result-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Header horizontal */
.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-rank {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
}

/* === PODIUM - Médailles Or/Argent/Bronze === */

/* Rang 1 - OR */
.result-card.rank-1 {
  border: 2px solid #ffd700;
  background: linear-gradient(135deg, #fffef5, white);
}

.result-card.rank-1 .result-rank {
  background: linear-gradient(135deg, #ffd700, #ffb800);
  color: #7c5800;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* Rang 2 - ARGENT */
.result-card.rank-2 {
  border: 2px solid #c0c0c0;
  background: linear-gradient(135deg, #fafafa, white);
}

.result-card.rank-2 .result-rank {
  background: linear-gradient(135deg, #e8e8e8, #c0c0c0);
  color: #505050;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

/* Rang 3 - BRONZE */
.result-card.rank-3 {
  border: 2px solid #cd7f32;
  background: linear-gradient(135deg, #fdf8f3, white);
}

.result-card.rank-3 .result-rank {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: white;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

/* Rangs 4+ - Neutre (style par défaut) */
.result-card.rank-other .result-rank {
  background: #f1f5f9;
  color: #64748b;
}

/* Dark mode pour les médailles */
[data-theme="dark"] .result-card.rank-1 {
  background: linear-gradient(135deg, #2a2510, var(--bg-card));
  border-color: #b8960a;
}

[data-theme="dark"] .result-card.rank-2 {
  background: linear-gradient(135deg, #252525, var(--bg-card));
  border-color: #909090;
}

[data-theme="dark"] .result-card.rank-3 {
  background: linear-gradient(135deg, #2a1f15, var(--bg-card));
  border-color: #a06020;
}

.result-avatar {
  flex-shrink: 0;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-circle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.result-identity {
  flex: 1;
  min-width: 0;
}

.result-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bouton toggle propositions avec flèche */
.btn-toggle-proposals {
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-toggle-proposals:hover {
  background: rgba(102, 126, 234, 0.1);
}

.toggle-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  display: inline-block;
}

.badge-maire {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-continuite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Tooltip tactile pour badges (hover desktop + tap mobile) */
.badge-tooltip {
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.badge-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--primary, #0f172a);
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.badge-tooltip:hover::after,
.badge-tooltip:active::after,
.badge-tooltip:focus::after {
  opacity: 1;
}

.result-meta {
  font-size: 0.9rem;
  color: var(--secondary);
  margin-top: 2px;
}

/* Barre de progression intégrée */
.result-bar-container {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 120px;
}

/* Score à droite */
.result-score-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

/* Actions buttons inline */
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-expand.compact {
  padding: 6px 12px;
  font-size: 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-expand.compact:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-expand .icon {
  font-size: 1rem;
}

/* Top matches section */
.top-matches-section {
  margin-top: 6px;
  padding: 8px 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
  border-left: 2px solid var(--success);
  border-radius: 4px;
}

.section-title-inline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-matches-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  background: var(--bg-card);
  border-radius: 3px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.match-item:hover {
  transform: translateX(3px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.match-theme {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.match-question {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.3;
}

/* Sections expandables */
.expandable-section {
  display: none;
  padding: 8px 0 0 0;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  animation: slideDown 0.3s ease-out;
}

.expandable-section.open {
  display: block;
}

.section-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* Liste propositions */
.propositions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.proposition-item {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.4;
  position: relative;
  padding-left: 16px;
}

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

.proposition-item::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
  font-size: 0.75rem;
}

.result-info {
  flex: 1;
}

.result-score {
  text-align: right;
  min-width: 80px;
}

/* Upload */
.upload-card, .contribute-container {
  background: var(--light);
  padding: 30px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.upload-zone {
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--bg-card);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.upload-text {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.upload-subtext, .upload-limit {
  color: var(--secondary);
  font-size: 0.9rem;
}

.preview-zone {
  position: relative;
  margin-bottom: 20px;
}

.preview-zone img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius);
}

.btn-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: var(--secondary);
  font-size: 0.85rem;
}

.consent-box {
  margin: 20px 0;
  display: flex;
  align-items: start;
  gap: 10px;
}

.consent-box input[type="checkbox"] {
  margin-top: 4px;
}

.info-box {
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 30px;
}

.info-box h3 {
  margin-bottom: 15px;
}

.info-box ol {
  margin-left: 20px;
}

.info-box ol li {
  margin-bottom: 8px;
}

.rate-limit-info {
  background: #fef3c7;
  border-left-color: var(--warning);
  text-align: center;
}

.result-icon {
  font-size: 4rem;
  text-align: center;
  margin-bottom: 20px;
}

.extracted-data {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  margin: 20px 0;
}

.extracted-content {
  margin-top: 15px;
}

.extracted-item {
  margin-bottom: 10px;
  padding: 10px;
  background: var(--light);
  border-radius: var(--radius);
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Loading */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: white;
  margin-top: 20px;
  font-size: 1.2rem;
}

.loading-progress {
  width: 300px;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  margin-top: 20px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 10px;
  width: 0%;
  transition: width 0.5s ease;
}

.loading-percentage {
  color: white;
  margin-top: 10px;
  font-size: 1.5rem;
  font-weight: bold;
}

#loading-message {
  margin-top: 20px;
  margin-bottom: 0;
  font-size: 1rem;
  opacity: 0.9;
}

/* Map Loader */
.map-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 30px 40px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.map-loader .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.map-loader p {
  color: var(--dark);
  margin-top: 15px;
  font-size: 1rem;
  font-weight: 600;
}

/* Loading Messages */
.loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 10px 0 5px 0;
}

.loading-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.loading-hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
  margin: 5px 0 0 0;
}

/* Notification Toast */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
  max-width: 400px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.notification-info {
  border-left: 4px solid var(--primary);
}

.notification-success {
  border-left: 4px solid var(--success);
}

.notification-warning {
  border-left: 4px solid var(--warning);
}

.notification-danger {
  border-left: 4px solid var(--danger);
}

.notification.fade-out {
  animation: slideOutRight 0.3s ease-out;
}

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

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

/* Progress Bars */
.compatibility-bar-container {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 10px 0;
  position: relative;
}

.compatibility-bar-fill {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.compatibility-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.3) 50%,
    rgba(255,255,255,0) 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.compatibility-bar-fill.high {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.compatibility-bar-fill.medium {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.compatibility-bar-fill.low {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.compatibility-bar-container.small {
  height: 8px;
  margin: 5px 0;
}

/* Theme Details */
.btn-expand-themes {
  background: none;
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 10px;
  transition: all 0.3s;
}

.btn-expand-themes:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.theme-details {
  margin-top: 15px;
  padding: 15px;
  background: var(--light);
  border-radius: var(--radius);
  display: none;
  animation: slideDown 0.3s ease-out;
}

.theme-details.open {
  display: block;
}

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

/* Grille 3 colonnes pour les thèmes */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

/* Cercles SVG de progression */
.theme-circle {
  width: 80px;
  height: 80px;
  position: relative;
}

.circular-chart {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.circle-bg {
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 2.8;
}

.circle {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  animation: progress 1s ease-out forwards;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.circle.high { stroke: var(--success); }
.circle.medium { stroke: var(--warning); }
.circle.low { stroke: var(--danger); }

@keyframes progress {
  0% {
    stroke-dasharray: 0 100;
  }
}

.percentage {
  fill: var(--text);
  font-family: sans-serif;
  font-size: 0.5em;
  font-weight: 700;
  text-anchor: middle;
}

.theme-name-compact {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  line-height: 1.3;
}

/* Responsive grille thèmes */
@media (max-width: 768px) {
  .themes-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
  }

  .theme-circle {
    width: 70px;
    height: 70px;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

/* Result Card Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
}

/* ======================
   BARRES HORIZONTALES THÈMES
   ====================== */

.themes-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 16px !important;
}

.theme-bar-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-bar-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.theme-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.theme-bar-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.theme-bar-value {
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
}

.theme-bar-value.high { color: var(--success); }
.theme-bar-value.medium { color: var(--warning); }
.theme-bar-value.low { color: var(--danger); }

.theme-bar-container {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

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

.theme-bar-fill.high { background: var(--success); }
.theme-bar-fill.medium { background: var(--warning); }
.theme-bar-fill.low { background: var(--danger); }

/* ======================
   MICRO-ANIMATIONS
   ====================== */

/* Enhanced button interactions */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::after {
  width: 300px;
  height: 300px;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Answer options hover effects */
.answer-option {
  transform: translateX(0);
}

.answer-option:hover {
  transform: translateX(4px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.answer-option:active {
  transform: translateX(2px) scale(0.99);
}

.answer-option.selected {
  animation: selectPulse 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes selectPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Theme indicators hover */
.theme-indicator {
  cursor: default;
}

.theme-indicator:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.theme-indicator.covered:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Commune select hover */
.commune-select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.commune-select:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.commune-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

/* Result cards hover */
.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Stat items subtle animation */
.stat-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item:hover {
  transform: translateY(-2px);
}

.stat-item .stat-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item:hover .stat-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Theme cards hover */
.theme-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.theme-card:hover .theme-circle {
  transform: scale(1.05);
}

/* Smooth entrance for theme indicators */
.theme-indicator {
  animation: fadeInScale 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.theme-indicator:nth-child(1) { animation-delay: 0.05s; }
.theme-indicator:nth-child(2) { animation-delay: 0.1s; }
.theme-indicator:nth-child(3) { animation-delay: 0.15s; }
.theme-indicator:nth-child(4) { animation-delay: 0.2s; }
.theme-indicator:nth-child(5) { animation-delay: 0.25s; }
.theme-indicator:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Progress fill smooth animation */
.progress-fill {
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Link hover effects */
a {
  transition: all 0.2s ease;
}

.contribute-link a:hover {
  transform: translateX(4px);
  display: inline-block;
}

/* Quiz nav buttons smooth transitions */
.quiz-nav .btn-icon,
.quiz-nav .btn-results {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* Circular chart animation enhancement */
.circular-chart {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-circle:hover .circular-chart {
  transform: scale(1.05);
}

/* Smoother step transitions */
.step {
  transition: opacity 0.3s ease;
}

.step:not(.active) {
  opacity: 0;
  pointer-events: none;
}

.step.active {
  opacity: 1;
  pointer-events: all;
}

/* Header logo subtle animation - removed, now handled by #app-title */

/* Footer */
footer {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

footer a {
  color: var(--accent);
  text-decoration: underline;
}

footer a:hover {
  color: var(--accent-hover);
}

/* Style déplacé dans .footer-line .contribute-link */

/* Responsive */
/* ======================
   MOBILE OPTIMIZATION
   Touch-friendly responsive design
   ====================== */

@media (max-width: 768px) {
  /* Container & Typography */
  .container {
    padding: 16px;
  }

  header h1 {
    font-size: 1.8rem;
  }

  /* Touch-friendly buttons - minimum 44x44px */
  .btn {
    min-height: 44px;
    padding: 12px 24px;
    font-size: 1rem;
  }

  .btn-primary, .btn-secondary {
    font-weight: 600;
  }

  /* Disable hover effects on touch devices */
  @media (hover: none) {
    .btn:hover::after {
      width: 0;
      height: 0;
    }

    .answer-option:hover {
      transform: none;
      box-shadow: none;
    }

    /* Use active states instead */
    .btn:active {
      transform: scale(0.96);
      transition: transform 0.1s;
    }

    .answer-option:active {
      transform: scale(0.98);
      border-color: var(--primary);
      background: rgba(37, 99, 235, 0.05);
    }
  }

  /* Commune selection */
  .commune-choice {
    flex-direction: column;
    gap: 16px;
  }

  .commune-select {
    min-height: 48px;
    font-size: 1rem;
    padding: 12px;
  }

  #btn-geoloc {
    min-height: 48px;
  }

  /* Quiz navigation - sticky bar */
  .quiz-nav {
    padding: 10px 12px;
    gap: 12px;
  }

  .quiz-nav .btn-icon {
    width: 40px;
    height: 40px;
  }

  .quiz-nav .progress-text {
    font-size: 0.8rem;
  }

  #step-quiz {
    padding-bottom: 16px;
  }

  /* Answer options - larger touch targets */
  .answer-option {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.95rem;
    margin-bottom: 6px;
  }

  .answer-option input[type="radio"] {
    width: 22px;
    height: 22px;
  }

  /* Question text */
  .question-text {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 10px;
  }

  .question-theme {
    font-size: 0.85rem;
    padding: 6px 14px;
    margin-bottom: 12px;
  }

  /* Theme indicators - wrap better on mobile */
  .theme-indicators {
    gap: 8px;
    margin: 10px 0;
  }

  .theme-indicator {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .theme-indicator-dot {
    width: 6px;
    height: 6px;
  }

  /* Progress bar */
  .progress-bar {
    height: 6px;
    margin: 12px 0;
  }

  .progress-text {
    font-size: 0.85rem;
  }

  /* Info screen stats */
  .commune-info-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Commune photo responsive */
  .commune-photo-container {
    height: 200px;
    margin: -30px -16px 20px -16px;
  }

  .commune-photo-overlay {
    padding: 15px 20px;
  }

  .commune-photo-name {
    font-size: 1.4rem;
  }

  .stat-item {
    padding: 12px;
  }

  .stat-icon {
    font-size: 1.8rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  /* Result cards */
  .result-card {
    padding: 16px;
  }

  .result-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .result-rank {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .avatar-circle {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .result-name {
    font-size: 1rem;
  }

  .result-meta {
    font-size: 0.85rem;
  }

  .result-bar-container {
    order: 3;
    width: 100%;
    margin-top: 12px;
    height: 8px;
  }

  .result-score-container {
    margin-left: auto;
  }

  .score-value {
    font-size: 1.5rem;
  }

  /* Badge maire / continuite */
  .badge-maire,
  .badge-continuite {
    width: 22px;
    height: 22px;
  }

  /* Top matches section */
  .top-matches-section {
    margin-top: 12px;
    padding: 12px;
  }

  .match-item {
    padding: 10px;
  }

  .match-theme {
    font-size: 0.7rem;
  }

  .match-question {
    font-size: 0.85rem;
  }

  /* Buttons - expandable sections */
  .btn-expand.compact {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  /* Theme grid */
  .themes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .theme-circle {
    width: 70px;
    height: 70px;
  }

  .theme-name-compact {
    font-size: 0.8rem;
  }

  /* Actions buttons */
  .actions {
    flex-direction: column;
    gap: 12px;
  }

  .actions .btn {
    width: 100%;
  }

  .result-actions {
    gap: 8px;
  }

  .result-actions .btn-expand {
    flex: 1;
    min-width: 0;
  }

  /* Header */
  .header-content {
    gap: 12px;
  }

  /* Map - responsive height */
  #map-container {
    height: calc(100dvh - 420px) !important;
    min-height: 120px !important;
    max-height: 400px !important;
    margin-top: 16px;
  }

  /* Reduce animations on mobile for performance */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ======================
   Satisfaction Survey
   ====================== */

.satisfaction-survey {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
  text-align: center;
}

.survey-question {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.survey-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.survey-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s;
}

.survey-btn:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-main));
}

.survey-thanks {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .survey-btn {
    padding: 8px 14px;
    font-size: 0.9rem;
  }
}

/* Small mobile devices (< 480px) */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.6rem;
  }

  .tagline {
    font-size: 0.9rem;
  }

  .quiz-nav {
    padding: 8px 10px;
    gap: 10px;
  }

  .quiz-nav .btn-icon {
    width: 36px;
    height: 36px;
  }

  .quiz-nav .progress-text {
    font-size: 0.75rem;
  }

  .quiz-nav .progress-bar {
    height: 6px;
  }

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

  .commune-info-stats {
    grid-template-columns: 1fr;
  }

  /* Commune photo for very small screens */
  .commune-photo-container {
    height: 180px;
  }

  .commune-photo-name {
    font-size: 1.2rem;
  }

  .answer-option {
    font-size: 0.95rem;
    padding: 14px;
  }

  .result-identity {
    width: 100%;
  }
}

/* ======================
   Icon System Styles
   ====================== */

/* Emoji icons */
.icon-emoji {
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
}

/* Lucide icons */
.icon-lucide {
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Icon in buttons */
.btn .icon-emoji,
.btn .icon-lucide {
  margin-right: 6px;
  vertical-align: middle;
}

/* Icon only (no text) */
.icon-only .icon-emoji,
.icon-only .icon-lucide {
  margin-right: 0;
}

/* ======================
   Optimisations UX - Écran 2 (Info commune)
   ====================== */

/* Lien "Changer de commune" */
.link-change-commune {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.link-change-commune:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

/* Actions info commune */
.actions-info-commune {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 30px;
}

/* CTA principal énorme */
.btn-start-quiz-main {
  padding: 20px 48px;
  font-size: 1.2rem;
  width: 100%;
  max-width: 350px;
  margin: 10px auto;
  display: block;
  font-weight: 600;
}

/* Accordéon candidats */
.candidats-accordion {
  margin: 20px 0;
}

.accordion-toggle {
  width: 100%;
  padding: 14px 20px;
  background: var(--light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  font-family: inherit;
  color: var(--text);
}

.accordion-toggle:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.accordion-icon {
  transition: transform 0.3s ease;
  color: var(--text-secondary);
}

.accordion-toggle.open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 15px;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-card);
}

/* Note transparence plus discrète */
.transparence-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 20px;
  padding: 10px;
  background: transparent;
  border: none;
}

.info-column h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.info-note {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}


/* === THEME TOGGLE BUTTON === */
.theme-toggle {
  position: relative;
  bottom: auto;
  right: auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  color: var(--text-primary);
  margin-left: auto;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Icônes */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: all var(--transition-fast);
}

/* Light mode : afficher soleil */
.theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg);
}

.theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-90deg);
}

/* Dark mode : afficher lune */
[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Mobile */
@media (max-width: 768px) {
  .theme-toggle {
    width: 28px;
    height: 28px;
  }

  .theme-toggle svg {
    width: 14px;
    height: 14px;
  }
}

/* === BANDEAU INFOS COMMUNE SOUS LA CARTE === */
.commune-info-bar {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 14px 10px; /* Padding normal */
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  position: relative; /* Important pour le positionnement du tooltip */
  overflow: visible; /* Permet au tooltip de dépasser vers le haut */
}

.commune-info-bar.hidden {
  display: none;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary, #64748b);
}

.info-item-icon {
  font-size: 1.1rem;
}

.info-item-value {
  font-weight: 600;
  color: var(--text-primary, #0f172a);
}

.info-separator {
  width: 1px;
  height: 24px;
  background: var(--border, #e2e8f0);
}

/* Tooltip pour la liste des candidats */
.candidats-tooltip-trigger {
  position: relative;
  cursor: help;
}

.candidats-tooltip-trigger:hover .candidats-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0); /* Animation vers le haut */
}

.candidats-tooltip {
  position: absolute;
  bottom: calc(100% + 10px); /* Affiche vers le HAUT */
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--primary, #0f172a);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000; /* Z-index élevé pour passer au-dessus de tout */
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 350px; /* Limite la largeur */
  min-width: 200px; /* Largeur minimale */
}

.candidats-tooltip::after {
  content: "";
  position: absolute;
  top: 100%; /* Flèche en bas du tooltip */
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--primary, #0f172a); /* Flèche pointant vers le bas */
}

.candidats-tooltip ul {
  list-style: none;
  margin: 0;
  padding: 0;
  /* Pas de scroll - affiche toute la liste */
}

.candidats-tooltip li {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.candidats-tooltip li:not(:last-child) {
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.candidat-sortant {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

.candidat-continuite {
  font-size: 0.65rem;
  background: var(--accent, #2563eb);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.tooltip-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary, #64748b);
  flex-shrink: 0;
}

/* Adapter la carte pour qu'elle se colle au bandeau */
#map-container {
  border-radius: 12px 12px 0 0 !important;
  margin-bottom: 0 !important;
}

/* Responsive */
@media (max-width: 600px) {
  .commune-info-bar {
    justify-content: flex-start;
    gap: 12px 10px;
  }
  .info-separator {
    display: none;
  }
}

/* === MENTION TRANSPARENCE === */
/* Style déplacé dans .footer-line .transparency-text */

/* === FORCE : SUPPRIMER TOUT ESPACE AU-DESSUS DU HEADER === */
.header {
  margin-top: 0 !important;
}

.container {
  padding-top: 0 !important;
}

.container > .header:first-child {
  margin-top: 0 !important;
}

/* Media queries - garantir pas d'espace en responsive */
@media (max-width: 768px) {
  .container {
    padding-top: 0 !important;
  }

  .header {
    margin-top: 0 !important;
    margin-bottom: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding-top: 0 !important;
  }

  .header {
    margin-top: 0 !important;
    margin-bottom: 12px;
  }
}

/* === SITE FOOTER (outside container) === */
.site-footer {
  text-align: center;
  padding: 10px 16px 10px;
  max-width: 640px;
  margin: 0 auto;
}

.site-footer .footer-brand {
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
  margin-bottom: 6px;
}

.site-footer .footer-links {
  font-size: 0.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-footer .footer-links a {
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.site-footer .footer-links a:hover {
  text-decoration: underline;
}

.site-footer .footer-sep {
  color: var(--text-secondary, #64748b);
  opacity: 0.5;
}

/* Footer interne aux sections (quiz, budget, résultats) */
.section-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
  font-size: 0.8rem;
}

.section-footer .footer-brand {
  color: var(--text-secondary, #64748b);
  margin-bottom: 4px;
}

.section-footer .footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.section-footer a {
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.section-footer a:hover {
  text-decoration: underline;
}

.section-footer .footer-sep {
  color: var(--text-secondary, #64748b);
  opacity: 0.4;
}

/* CTA Contribuer sur l'écran 1 */
.contribute-cta {
  text-align: right;
  margin-top: 10px;
  font-size: 0.75rem;
}

.contribute-cta a {
  color: var(--accent, #2563eb);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.contribute-cta a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ======================================== */
/* CORRECTIONS RESPONSIVE MOBILE (ANDROID)  */
/* ======================================== */

/* CSS GLOBAL MOBILE - Éviter scroll horizontal */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

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

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .container,
  .quiz-container,
  .results-container {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }

  /* ========================================
     ÉCRAN 1 : ACCUEIL - RESPONSIVE
     ======================================== */

  /* Carte hauteur responsive */
  #map-container,
  #map {
    height: calc(100dvh - 490px) !important;
    min-height: 100px !important;
    max-height: 300px !important;
  }

  /* Marges/paddings réduits */
  .container {
    padding: 16px 12px;
  }

  .header {
    padding: 12px 16px;
  }

  .section-title,
  #step-commune h2 {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  /* Bandeau infos commune compact */
  .commune-info-bar {
    padding: 10px 12px;
    gap: 8px 12px;
  }

  .info-item {
    font-size: 0.8rem;
  }

  .info-item-icon {
    font-size: 0.95rem;
  }

  /* Bouton CTA compact */
  .btn-start-quiz-main,
  #btn-start-quiz {
    padding: 14px 24px;
    font-size: 0.95rem;
  }

  /* Mention transparence */
  .transparency-text {
    font-size: 0.75rem !important;
    margin-top: 10px;
  }

  /* Lien contribution */
  .contribute-link {
    font-size: 0.8rem !important;
    margin-top: 16px;
  }

  /* ========================================
     ÉCRAN 2 : QUIZ - RESPONSIVE
     ======================================== */

  /* Barre de progression compacte */
  .quiz-progress,
  .progress-container {
    margin-bottom: 12px;
  }

  .progress-info,
  .progress-text {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }

  .progress-bar {
    height: 4px;
  }

  /* Carte question compacte */
  .question-card,
  .quiz-content .card {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  /* Badge thème petit */
  .question-theme,
  .current-theme-badge {
    padding: 4px 10px;
    font-size: 0.75rem;
    margin-bottom: 0;
  }

  /* Texte question réduit */
  .question-text,
  .quiz-question {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 14px;
  }

  /* Options compactes */
  .options,
  .quiz-options {
    gap: 8px;
  }

  .option,
  .quiz-option {
    padding: 12px 14px;
    font-size: 0.9rem;
    line-height: 1.3;
    border-radius: 8px;
  }

  /* Navigation compacte */
  .quiz-nav,
  .quiz-navigation {
    margin-top: 12px;
    margin-bottom: 0;
    gap: 10px;
    padding: 10px 12px;
  }

  .quiz-nav .btn,
  .quiz-navigation .btn,
  .btn-results {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
  }

  .btn-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Supprimer espaces vides */
  .quiz-container,
  #step-quiz {
    padding-bottom: 16px;
  }

  #step-quiz .container {
    padding-bottom: 16px;
  }

  /* ========================================
     ÉCRAN 3 : RÉSULTATS - RESPONSIVE
     ======================================== */

  /* Header résultats compact */
  .results-header {
    margin-bottom: 16px;
  }

  .results-title,
  #step-results h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
  }

  .results-subtitle,
  #results-commune-name {
    font-size: 0.85rem;
  }

  /* Cartes résultats compactes */
  .result-card,
  .results-list .card {
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 10px;
    gap: 12px;
  }

  /* Rang petit */
  .result-rank {
    font-size: 1.1rem;
    min-width: 24px;
  }

  /* Infos candidat tronquées */
  .result-info {
    flex: 1;
    min-width: 0;
  }

  .result-name,
  .candidate-name {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .result-party,
  .candidate-party {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Score compact */
  .result-score,
  .match-score {
    text-align: right;
    flex-shrink: 0;
  }

  .score-value {
    font-size: 1.2rem;
  }

  .score-label {
    font-size: 0.7rem;
  }

  /* Boutons actions */
  .results-actions,
  #step-results .actions {
    margin-top: 16px;
    gap: 10px;
  }

  .results-actions .btn,
  #step-results .actions .btn {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
}
/* ===============================================
   OPTIMISATIONS MOBILE - Galaxy S5 & iPhone SE
   =============================================== */

@media (max-width: 600px) {
  /* === ÉCRAN 1 - ACCUEIL === */

  body {
    padding: 6px 10px;
  }

  .container {
    padding: 0 12px 16px 12px;
  }

  .header {
    padding: 10px 14px;
    margin-bottom: 14px;
  }

  /* Carte map plus compacte */
  #map-container {
    height: 150px !important;
  }

  /* Sélecteur commune */
  .commune-select-inline,
  #commune-select {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  /* Bandeau infos commune */
  .commune-info-bar {
    padding: 8px 12px;
    gap: 8px;
    font-size: 0.8rem;
  }

  /* Bouton Commencer */
  #btn-start {
    padding: 12px 20px;
    font-size: 0.9rem;
  }

  /* Footer/mentions */
  footer {
    margin-top: 12px;
    font-size: 0.7rem;
  }

  /* === ÉCRAN 2 - QUIZ ULTRA-COMPACT === */

  #step-quiz {
    padding-bottom: 4px;
  }

  /* Header quiz compact */
  .quiz-header-compact h2,
  #quiz-commune {
    font-size: 0.85rem;
    padding: 2px 0;
    margin-bottom: 0;
  }

  .quiz-header-compact {
    margin-bottom: 4px;
    padding-bottom: 4px;
  }

  /* Badge thème */
  .current-theme-badge {
    padding: 2px 8px;
    font-size: 0.6rem;
    margin-bottom: 0;
  }

  .theme-emoji {
    font-size: 0.9rem;
  }

  .theme-label {
    font-size: 0.6rem;
  }

  /* Question */
  .question-text {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  /* Réponses container */
  .answers {
    gap: 4px;
  }

  /* Chaque réponse */
  .answer-option {
    padding: 8px 10px;
    font-size: 0.85rem;
    line-height: 1.3;
    border-radius: 6px;
    min-height: 0;
    margin-bottom: 0;
  }

  .answer-option input[type="radio"] {
    width: 14px;
    height: 14px;
  }

  /* Navigation quiz - dans le flux */
  .quiz-nav {
    padding: 6px 12px;
    margin-top: 4px;
    border-radius: 12px;
  }

  /* Boutons nav */
  .quiz-nav .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0;
    padding: 0;
  }

  .quiz-nav .btn-icon svg {
    width: 16px;
    height: 16px;
  }

  /* Progress text */
  .progress-text {
    font-size: 0.7rem;
  }

  /* Progress bar */
  .progress-bar {
    height: 6px;
  }

  .quiz-content {
    padding: 10px 12px;
    min-height: auto;
    margin-bottom: 4px;
  }

  /* === ÉCRAN 1 - COMMUNE COMPACT === */

  #step-commune h2 {
    font-size: 1rem;
    margin-top: 4px;
    margin-bottom: 8px;
  }

  #map-container,
  #map {
    height: calc(100dvh - 490px) !important;
    min-height: 100px !important;
    max-height: 300px !important;
    margin-top: 8px !important;
  }

  .commune-info-bar {
    padding: 6px 10px;
    gap: 4px;
  }

  .commune-info-bar .info-item {
    font-size: 0.75rem;
    gap: 4px;
  }

  .commune-info-bar .info-item-icon {
    font-size: 0.85rem;
  }

  .commune-info-bar .info-item-value {
    font-size: 0.85rem;
  }

  .btn-start-quiz-main {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  #step-commune .actions {
    margin-top: 8px;
    margin-bottom: 0;
  }

  .footer-line {
    margin-top: 6px;
    padding-top: 6px;
  }

  .footer-line .transparency-text {
    font-size: 0.7rem;
    margin-bottom: 2px;
  }

  .footer-line .contribute-link {
    font-size: 0.75rem;
  }

  /* === ÉCRAN 3 - RÉSULTATS === */

  /* Titre résultats */
  #step-results h2 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  #results-commune-name {
    color: var(--accent);
    font-weight: 700;
  }

  /* Liste résultats */
  .results-list {
    gap: 8px;
  }

  /* Card Top 1 - très mise en valeur */
  .result-card-top {
    border-left: 4px solid var(--accent);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%);
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
    border-radius: 10px;
  }

  .result-card-top .result-rank {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--accent), #1d4ed8);
  }

  .result-card-top .result-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
  }

  .result-card-top .score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
  }

  /* Autres cards - compactes */
  .result-card.compact:not(.result-card-top) {
    padding: 8px 12px;
    border-radius: 8px;
  }

  .result-card.compact:not(.result-card-top) .result-rank {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  .result-card.compact:not(.result-card-top) .result-name {
    font-size: 0.8rem;
  }

  .result-card.compact:not(.result-card-top) .score-value {
    font-size: 1rem;
  }

  /* Masquer les avatars/initiales */
  .result-avatar {
    display: none;
  }

  /* Masquer la barre de progression sur mobile */
  .result-bar-container {
    display: none;
  }

  /* Top matches section plus compact */
  .top-matches-section {
    margin-top: 6px;
    padding: 6px 8px;
  }

  .match-item {
    padding: 3px 6px;
  }

  .match-theme {
    font-size: 0.55rem;
  }

  .match-question {
    font-size: 0.7rem;
  }

  /* === BOUTONS D'ACTION - PILLS COMPACTS === */

  #step-results .actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
  }

  #step-results .actions .btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 20px;
    min-width: auto;
    width: auto;
  }
}

/* ======================
   AMÉLIORATIONS UX v2
   ====================== */

/* === 1. BOUTON INFO CONTEXTUEL (?) === */
.question-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.question-text {
  flex: 1;
}

.btn-question-info {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 4px;
}

.btn-question-info:hover {
  background: var(--accent);
  color: white;
  transform: scale(1.1);
}

.btn-question-info:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Contexte de question - affiché/masqué sous la question */
.question-context {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--text-tertiary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-tertiary);
  animation: slideDown 0.2s ease-out;
}

.question-context.visible {
  display: block;
}

[data-theme="dark"] .question-context {
  background: rgba(255, 255, 255, 0.05);
}

/* === 2. TRANSITIONS ANIMÉES ENTRE QUESTIONS === */
.quiz-content {
  position: relative;
  overflow: hidden;
}

.quiz-content.transitioning-out {
  animation: slideOutLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.quiz-content.transitioning-in {
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.quiz-content.transitioning-out-reverse {
  animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.quiz-content.transitioning-in-reverse {
  animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

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

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

/* === BOUTON "JE NE SUIS PAS SÛR(E)" === */
.btn-skip-question {
  display: block;
  margin: 12px auto 0;
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 8px);
  color: var(--text-secondary, #64748b);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-skip-question:hover {
  border-color: var(--text-secondary, #64748b);
  color: var(--text-primary, #0f172a);
}

.btn-skip-question.active {
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
  background: var(--accent-light, rgba(37, 99, 235, 0.08));
}

/* === TOGGLE IMPORTANCE === */
.importance-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px auto 0;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
  transition: color 0.2s ease;
  width: fit-content;
}

.importance-toggle:hover {
  color: var(--text-primary, #0f172a);
}

.importance-toggle input[type="checkbox"] {
  accent-color: var(--accent, #2563eb);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.importance-toggle span {
  user-select: none;
}

/* === BOUTON "?" SCORE + DÉTAILS === */
.btn-score-info {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 50%;
  background: none;
  color: var(--text-secondary, #64748b);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-score-info:hover {
  background: var(--accent, #2563eb);
  color: white;
  border-color: var(--accent, #2563eb);
}

.score-details {
  display: none;
  padding: 12px 14px;
  margin-top: 8px;
  background: var(--bg-elevated, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
}

.score-details.open {
  display: block;
}

.score-details-text {
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.score-details-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.score-theme-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.score-theme-name {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
  min-width: 100px;
  flex-shrink: 0;
}

.score-theme-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border, #e2e8f0);
  border-radius: 3px;
  overflow: hidden;
}

.score-theme-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.score-theme-bar-fill.high {
  background: var(--success, #22c55e);
}

.score-theme-bar-fill.medium {
  background: var(--warning, #f59e0b);
}

.score-theme-bar-fill.low {
  background: var(--error, #ef4444);
}

.score-theme-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  min-width: 32px;
  text-align: right;
}

[data-theme="dark"] .score-details {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 600px) {
  .score-theme-name {
    min-width: 70px;
    font-size: 0.65rem;
  }

  .score-details {
    padding: 10px;
  }

  .score-theme-value {
    font-size: 0.65rem;
  }
}

/* === 3. BARRE DE PROGRESSION UPLOAD === */
.upload-progress-container {
  margin: 20px 0;
  display: none;
}

.upload-progress-container.active {
  display: block;
}

.upload-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.upload-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.upload-progress-percentage {
  font-weight: 600;
  color: var(--accent);
}

/* États de progression */
.upload-progress-container.success .upload-progress-fill {
  background: var(--success);
  width: 100%;
}

.upload-progress-container.success .upload-progress-text {
  color: var(--success);
}

.upload-progress-container.error .upload-progress-fill {
  background: var(--error);
}

.upload-progress-container.error .upload-progress-text {
  color: var(--error);
}

.upload-status-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* === 4. ACCESSIBILITÉ - CONTRASTES AMÉLIORÉS === */
/* Augmentation du contraste pour les textes gris */
:root {
  --text-secondary-accessible: #525f70; /* Au lieu de #64748b - ratio 4.5:1+ */
  --text-tertiary-accessible: #6b7689; /* Au lieu de #94a3b8 */
}

.transparency-text,
.footer-info p,
.upload-hint,
.form-label,
.progress-text,
.info-item,
.result-meta,
.score-label,
.match-theme {
  color: var(--text-secondary-accessible, #525f70);
}

[data-theme="dark"] {
  --text-secondary-accessible: #a8b4c4; /* Clair sur fond sombre */
  --text-tertiary-accessible: #8d9aad;
}

/* === CLASSE VISUALLY-HIDDEN POUR L'ACCESSIBILITÉ === */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* === 5. NAVIGATION CLAVIER - FOCUS STATES === */
/* Focus visible pour tous les éléments interactifs */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Focus pour les éléments non-boutons cliquables */
.result-card:focus-within {
  outline: none;
}

/* Focus personnalisé pour les options de quiz - sans double encadrement */
.answer-option {
  position: relative;
}

.answer-option:focus-within:not(.selected) {
  border-color: var(--accent);
}

/* Pas de double outline sur les options sélectionnées */
.answer-option.selected {
  outline: none !important;
  box-shadow: none;
}

/* Focus pour les cards candidats */
.result-card[tabindex="0"]:focus {
  outline: none;
}

/* Skip to content link (accessibilité) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  z-index: 10002;
  transition: top 0.3s ease;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 10px;
}

/* === 6. MICRO-ANIMATIONS FEEDBACK AMÉLIORÉES === */
/* Boutons - scale au hover */
.btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Effet ripple au clic */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.btn-ripple:active::before {
  width: 200%;
  height: 200%;
  opacity: 1;
  transition: width 0s, height 0s, opacity 0s;
}

/* Options de quiz - feedback immédiat au clic */
.answer-option {
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.answer-option:active {
  transform: scale(0.98);
}

.answer-option.selected {
  animation: selectFlash 0.3s ease-out;
}

@keyframes selectFlash {
  0% {
    background: var(--accent);
  }
  100% {
    background: var(--accent-light);
  }
}

/* Cards candidats - transition douce sur la sélection */
.result-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.result-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* === 7. LAZY LOADING CARTE - PLACEHOLDER/SKELETON === */
.map-placeholder {
  height: 400px;
  background: var(--bg-elevated);
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

.map-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmerPlaceholder 1.5s infinite;
}

@keyframes shimmerPlaceholder {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.map-placeholder-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.map-placeholder-text {
  font-size: 0.95rem;
  font-weight: 500;
}

/* === 8. FEEDBACK VISUEL CARTE LEAFLET === */
/* Surbrillance améliorée au hover - définie en JS, mais styles additionnels */
.leaflet-interactive {
  transition: fill-opacity 0.2s ease, stroke-width 0.2s ease !important;
}

.leaflet-container {
  cursor: grab;
}

.leaflet-container:active {
  cursor: grabbing;
}

/* Curseur pointer pour les communes actives */
.leaflet-interactive.commune-active {
  cursor: pointer !important;
}

.leaflet-interactive.commune-disabled {
  cursor: not-allowed !important;
}

/* === RESPONSIVE POUR LES NOUVELLES FEATURES === */
@media (max-width: 600px) {
  .btn-question-info {
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 0.75rem;
  }

  .question-tooltip {
    padding: 16px;
    max-width: 95%;
  }

  .upload-progress-text {
    font-size: 0.8rem;
  }

  .map-placeholder {
    height: 200px;
  }
}

/* ======================================== */
/* BUDGET SIMULATOR                         */
/* ======================================== */

#step-budget {
  padding-bottom: 0;
  padding-top: 0;
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 2px 0;
}

.budget-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.budget-header-center {
  flex: 1;
  text-align: center;
}

.budget-header-center h3 {
  font-size: 1rem;
  margin: 0;
  color: var(--text-primary);
}

.budget-header-center p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.btn-skip-budget {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-skip-budget:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.budget-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  padding: 0 10px;
  margin-bottom: 2px;
}

.budget-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.budget-item {
  display: grid;
  grid-template-columns: 20px 130px 1fr 28px;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

.budget-item.modified {
  border-color: var(--accent);
}

.budget-item-icon {
  font-size: 0.85rem;
  text-align: center;
  cursor: help;
}

.budget-item-label {
  font-size: 0.72rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.budget-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.budget-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.budget-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.budget-item-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}

.budget-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 16px;
  gap: 8px;
}

.budget-nav-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  flex: 1;
}

#step-budget .quiz-nav .btn-results {
  display: flex;
}

#step-budget .quiz-nav .btn-results:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Budget in results */
.budget-comparison {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}

.budget-comparison-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.budget-comparison-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.budget-comparison-label {
  min-width: 80px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.budget-comparison-bars {
  flex: 1;
  display: flex;
  gap: 2px;
  align-items: center;
}

.budget-bar-user,
.budget-bar-candidat {
  height: 4px;
  border-radius: 2px;
}

.budget-bar-user {
  background: var(--accent);
}

.budget-bar-candidat {
  background: var(--text-tertiary);
}

.budget-comparison-legend {
  display: flex;
  gap: 12px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.budget-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.budget-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.budget-legend-dot.user { background: var(--accent); }
.budget-legend-dot.candidat { background: var(--text-tertiary); }

.budget-score-line {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.budget-score-line strong {
  color: var(--accent);
}

/* Responsive budget */
@media (max-width: 600px) {
  .budget-header {
    gap: 8px;
  }

  .budget-header-center h3 {
    font-size: 0.85rem;
  }

  .budget-header-center p {
    font-size: 0.7rem;
  }

  .btn-skip-budget {
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  .budget-item {
    grid-template-columns: 20px 100px 1fr 28px;
    gap: 4px;
    padding: 3px 8px;
  }

  .budget-item-label {
    font-size: 0.7rem;
  }

  .budget-item-icon {
    font-size: 0.85rem;
  }

  .budget-item-value {
    font-size: 0.75rem;
  }

  .budget-comparison-label {
    min-width: 60px;
    font-size: 0.65rem;
  }
}

/* Notice un seul candidat */
.single-candidate-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
}

.single-candidate-notice .notice-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.single-candidate-notice .notice-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.single-candidate-notice .notice-content p:first-child {
  color: var(--text-primary);
  margin-bottom: 4px;
}

.single-candidate-notice .notice-content a {
  color: var(--primary);
  text-decoration: underline;
}
