/* ============================================================
   VOTE PLATFORM — Design System Cameroun
   Vert  : #007A5E  Rouge : #CE1126  Jaune : #FCD116
   ============================================================ */

:root {
  --vp-green:       #007A5E;
  --vp-green-dark:  #005A45;
  --vp-green-light: #e6f4f0;
  --vp-red:         #CE1126;
  --vp-red-light:   #fdecea;
  --vp-yellow:      #FCD116;
  --vp-yellow-dark: #c9a500;
  --vp-bg:          #0d1117;
  --vp-surface:     #161b22;
  --vp-surface2:    #1c2330;
  --vp-border:      #30363d;
  --vp-text:        #e6edf3;
  --vp-muted:       #8b949e;
  --vp-radius:      12px;
  --vp-shadow:      0 4px 24px rgba(0,0,0,0.4);
  --vp-transition:  0.2s ease;
}

/* ---- Layout ---- */
.vote-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--vp-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.vote-card {
  max-width: 480px;
  margin: 40px auto;
  background: var(--vp-surface);
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius);
  box-shadow: var(--vp-shadow);
  overflow: hidden;
}

/* ---- Bandeau tricolore en haut de chaque carte ---- */
.vote-card-header {
  display: flex;
  height: 6px;
  width: 100%;
}
.vote-card-header span { flex: 1; }
.vote-card-header span:nth-child(1) { background: var(--vp-green); }
.vote-card-header span:nth-child(2) { background: var(--vp-red); }
.vote-card-header span:nth-child(3) { background: var(--vp-yellow); }

.vote-card-body { padding: 32px; }

.vote-card-wide { max-width: 680px; }
.vote-card-wide .vote-card-body { padding: 32px 40px; }

/* ---- Titres ---- */
.vote-card-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--vp-text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.vote-card-title .vote-icon {
  width: 32px; height: 32px;
  background: var(--vp-green);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.vote-subtitle {
  color: var(--vp-muted);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

/* ---- Formulaires ---- */
.vote-field { margin-bottom: 18px; }
.vote-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--vp-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}
.vote-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--vp-bg);
  border: 1.5px solid var(--vp-border);
  border-radius: 8px;
  color: var(--vp-text);
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color var(--vp-transition), box-shadow var(--vp-transition);
}
.vote-input:focus {
  outline: none;
  border-color: var(--vp-green);
  box-shadow: 0 0 0 3px rgba(0,122,94,0.25);
}
.vote-input::placeholder { color: var(--vp-border); }

/* ---- Boutons ---- */
.vote-btn {
  display: block;
  width: 100%;
  padding: 13px 20px;
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background var(--vp-transition), transform var(--vp-transition), box-shadow var(--vp-transition);
  letter-spacing: 0.02em;
}
.vote-btn:focus-visible {
  outline: 3px solid var(--vp-yellow);
  outline-offset: 2px;
}
.vote-btn-primary {
  background: var(--vp-green);
  color: #fff;
}
.vote-btn-primary:hover:not(:disabled) {
  background: var(--vp-green-dark);
  box-shadow: 0 4px 12px rgba(0,122,94,0.4);
  transform: translateY(-1px);
}
.vote-btn-danger {
  background: var(--vp-red);
  color: #fff;
}
.vote-btn-danger:hover:not(:disabled) {
  background: #a80d1e;
  box-shadow: 0 4px 12px rgba(206,17,38,0.4);
  transform: translateY(-1px);
}
.vote-btn-ghost {
  background: transparent;
  border: 1.5px solid var(--vp-border);
  color: var(--vp-muted);
}
.vote-btn-ghost:hover:not(:disabled) {
  border-color: var(--vp-muted);
  color: var(--vp-text);
}
.vote-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.vote-btn-sm {
  width: auto;
  display: inline-block;
  padding: 8px 16px;
  font-size: 0.85rem;
  margin-top: 0;
}

/* ---- Messages ---- */
.vote-msg {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-top: 16px;
  display: none;
  animation: vp-fadein 0.3s ease;
}
@keyframes vp-fadein { from { opacity:0; transform: translateY(-4px); } to { opacity:1; transform: none; } }
.vote-msg.is-visible { display: block; }
.vote-msg-success {
  background: rgba(0,122,94,0.15);
  border: 1px solid var(--vp-green);
  color: #4dc8aa;
}
.vote-msg-error {
  background: rgba(206,17,38,0.12);
  border: 1px solid var(--vp-red);
  color: #f87070;
}
.vote-msg-info {
  background: rgba(252,209,22,0.08);
  border: 1px solid var(--vp-yellow-dark);
  color: var(--vp-yellow);
}

/* ---- Indicateur période ---- */
.vote-period-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.vote-period-badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vote-period-badge.is-open { background: rgba(0,122,94,0.15); color: #4dc8aa; }
.vote-period-badge.is-open .dot { background: var(--vp-green); box-shadow: 0 0 0 2px rgba(0,122,94,0.3); animation: vp-pulse 2s infinite; }
.vote-period-badge.is-closed { background: rgba(206,17,38,0.12); color: #f87070; }
.vote-period-badge.is-closed .dot { background: var(--vp-red); }
.vote-period-badge.is-upcoming { background: rgba(252,209,22,0.08); color: var(--vp-yellow); }
.vote-period-badge.is-upcoming .dot { background: var(--vp-yellow); }
@keyframes vp-pulse { 0%,100%{box-shadow:0 0 0 2px rgba(0,122,94,0.3)} 50%{box-shadow:0 0 0 5px rgba(0,122,94,0.1)} }

/* ---- Lien secondaire ---- */
.vote-link-row {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--vp-muted);
}
.vote-link-row a { color: var(--vp-green); text-decoration: none; font-weight: 600; }
.vote-link-row a:hover { text-decoration: underline; }

/* ================================================================
   BULLETIN DE VOTE — Navigation poste par poste
   ================================================================ */

/* ---- Barre de progression globale (postes) ---- */
.vote-progress-bar-wrap {
  margin-bottom: 28px;
}
.vote-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--vp-muted);
  margin-bottom: 8px;
}
.vote-progress-track {
  height: 6px;
  background: var(--vp-border);
  border-radius: 99px;
  overflow: hidden;
}
.vote-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vp-green), var(--vp-yellow));
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ---- Minuteur de session ---- */
.vote-session-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: var(--vp-surface2);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--vp-muted);
}
.vote-session-timer .timer-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--vp-border);
  border-radius: 99px;
  overflow: hidden;
}
.vote-session-timer .timer-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 1s linear, background 1s ease;
}
.vote-session-timer .timer-text { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* ---- Carte d'un poste ---- */
.vote-post-step { display: none; }
.vote-post-step.is-active { display: block; animation: vp-fadein 0.3s ease; }

.vote-post-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.vote-post-number {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--vp-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.vote-post-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.vote-post-desc { color: var(--vp-muted); font-size: 0.88rem; margin: 0; }

/* ---- Options de vote (candidats ou oui/non) ---- */
.vote-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.vote-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--vp-bg);
  border: 2px solid var(--vp-border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--vp-transition), background var(--vp-transition), box-shadow var(--vp-transition);
  user-select: none;
  position: relative;
}
.vote-option:hover {
  border-color: var(--vp-green);
  background: rgba(0,122,94,0.06);
}
.vote-option.is-selected {
  border-color: var(--vp-green);
  background: rgba(0,122,94,0.12);
  box-shadow: 0 0 0 3px rgba(0,122,94,0.2);
}
.vote-option input[type=radio] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.vote-option-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--vp-border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--vp-transition), background var(--vp-transition);
  background: var(--vp-surface);
}
.vote-option.is-selected .vote-option-check {
  border-color: var(--vp-green);
  background: var(--vp-green);
}
.vote-option.is-selected .vote-option-check::after {
  content: '';
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
}
/* Accessibilité : focus clavier visible */
.vote-option:focus-within {
  outline: 3px solid var(--vp-yellow);
  outline-offset: 2px;
}
.vote-option-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--vp-border);
  flex-shrink: 0;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--vp-muted);
}
.vote-option-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.vote-option-label { flex: 1; }
.vote-option-name { font-weight: 600; font-size: 0.97rem; margin: 0; }
.vote-option-desc { font-size: 0.82rem; color: var(--vp-muted); margin: 2px 0 0; }

/* Variantes couleur oui/non */
.vote-option[data-choice="oui"]:hover,
.vote-option[data-choice="oui"].is-selected { border-color: var(--vp-green); background: rgba(0,122,94,0.1); }
.vote-option[data-choice="non"]:hover,
.vote-option[data-choice="non"].is-selected { border-color: var(--vp-red); background: rgba(206,17,38,0.08); }
.vote-option[data-choice="non"].is-selected .vote-option-check { border-color: var(--vp-red); background: var(--vp-red); }
.vote-option[data-choice="abstention"]:hover,
.vote-option[data-choice="abstention"].is-selected { border-color: var(--vp-muted); }

/* ---- Navigation entre postes ---- */
.vote-step-nav {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.vote-step-nav .vote-btn { margin-top: 0; }

/* ---- Erreur de validation (champ non rempli) ---- */
.vote-option-error {
  color: #f87070;
  font-size: 0.83rem;
  margin-top: -6px;
  display: none;
}
.vote-option-error.is-visible { display: block; }

/* ---- Écran de confirmation final ---- */
.vote-confirm-screen {
  text-align: center;
  padding: 20px 0;
}
.vote-confirm-screen .vote-check-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(0,122,94,0.15);
  border: 3px solid var(--vp-green);
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  animation: vp-popin 0.4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes vp-popin { from{transform:scale(0);opacity:0} to{transform:scale(1);opacity:1} }
.vote-confirm-screen h3 { font-size: 1.3rem; margin: 0 0 8px; }
.vote-confirm-screen p { color: var(--vp-muted); font-size: 0.9rem; margin: 0 0 6px; }
.vote-receipt { font-size: 0.78rem; color: var(--vp-border); margin-top: 12px; }

/* ---- Modal de confirmation de soumission ---- */
.vote-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: vp-fadein 0.2s ease;
}
.vote-modal-overlay.is-open { display: flex; }
.vote-modal {
  background: var(--vp-surface);
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--vp-shadow);
}
.vote-modal h3 { margin: 0 0 12px; font-size: 1.1rem; }
.vote-modal p { color: var(--vp-muted); font-size: 0.9rem; margin: 0 0 20px; }
.vote-modal-actions { display: flex; gap: 10px; }
.vote-modal-actions .vote-btn { margin-top: 0; }

/* ---- Récapitulatif des choix dans la modale ---- */
.vote-summary-list { list-style: none; padding: 0; margin: 0 0 20px; border-radius: 8px; overflow: hidden; border: 1px solid var(--vp-border); }
.vote-summary-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; font-size: 0.88rem;
  border-bottom: 1px solid var(--vp-border);
}
.vote-summary-list li:last-child { border-bottom: none; }
.vote-summary-list li strong { color: var(--vp-text); }
.vote-summary-list li span { color: var(--vp-green); font-weight: 600; }

/* ---- Page résultats publics ---- */
.vote-results-wrap { max-width: 680px; margin: 40px auto; }
.vote-results-post { margin-bottom: 28px; background: var(--vp-surface); border: 1px solid var(--vp-border); border-radius: var(--vp-radius); overflow: hidden; }
.vote-results-post-header { padding: 16px 20px; border-bottom: 1px solid var(--vp-border); }
.vote-results-post-header h3 { margin: 0; font-size: 1rem; }
.vote-results-body { padding: 16px 20px; }
.vote-result-row { margin-bottom: 14px; }
.vote-result-row-label { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 5px; }
.vote-result-row-label span:last-child { font-weight: 700; color: var(--vp-green); }
.vote-result-bar-track { height: 8px; background: var(--vp-border); border-radius: 99px; overflow: hidden; }
.vote-result-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--vp-green), var(--vp-yellow)); }
.vote-result-bar-fill.is-winner { background: linear-gradient(90deg, var(--vp-green), #00c48c); box-shadow: 0 0 8px rgba(0,122,94,0.4); }
.vote-integrity-block {
  margin-top: 20px; padding: 14px 18px;
  background: var(--vp-surface2); border: 1px solid var(--vp-border);
  border-radius: 8px; font-size: 0.85rem; color: var(--vp-muted);
}
.vote-integrity-block strong { color: var(--vp-text); }

/* ---- Responsive ---- */
@media (max-width: 520px) {
  .vote-card-body { padding: 20px 16px; }
  .vote-card-wide .vote-card-body { padding: 20px 16px; }
  .vote-step-nav { flex-direction: column; }
}
