/* Composants réutilisables, fidèles au design system SEICHO. */

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 11px; border: none;
  font-family: var(--font-body); font-weight: 700; font-size: 14.5px; cursor: pointer;
  transition: filter .15s, background .15s; text-align: center;
}
.btn:disabled { cursor: not-allowed; background: #0c1424; color: var(--text-faint); border: 1px solid var(--border-soft); }
.btn--primary { background: var(--cyan); color: #04121a; box-shadow: 0 0 22px rgba(0, 229, 255, .32); }
.btn--primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn--secondary { background: #141d33; color: var(--text-hi); border: 1px solid var(--border-input); font-weight: 600; }
.btn--ghost { background: transparent; color: var(--cyan); border: 1px solid rgba(0, 229, 255, .35); font-weight: 600; }
.btn--danger { background: rgba(255, 84, 112, .12); color: var(--danger-soft); border: 1px solid rgba(255, 84, 112, .3); font-weight: 600; }
.btn--block { display: flex; width: 100%; }
.btn--lg { padding: 15px 26px; font-size: 16px; border-radius: 12px; }
.btn--sm { padding: 8px 15px; font-size: 12.5px; border-radius: 9px; }

/* Champs */
.field { display: block; margin-bottom: var(--space-4); }
.field__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-mid); margin-bottom: 8px; }
.input, .textarea, .select {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: #0a1224; border: 1px solid var(--border-input); color: var(--text-hi);
  font-family: var(--font-body); font-size: 15px; outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, .15);
}
.textarea { resize: vertical; min-height: 84px; }
.select { appearance: none; cursor: pointer; }
.field__hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Cartes */
.card {
  border-radius: 16px; background: var(--night-850); border: 1px solid var(--border-soft);
  padding: 24px 26px;
}
.card--poll {
  border-radius: 18px; background: linear-gradient(180deg, #101a30, #0c1424);
  border: 1px solid var(--border); box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; font-family: var(--font-mono);
}
.badge--open { background: rgba(0, 229, 255, .12); color: var(--cyan); }
.badge--open::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.badge--closed { background: rgba(180, 255, 51, .12); color: var(--lime); }
.badge--neutral { background: #141d33; color: var(--text-mid); border: 1px solid var(--border-input); }
.badge--anon { background: #141d33; color: var(--text-mid); border: 1px solid var(--border-input); }
.badge--named { background: rgba(255, 176, 32, .13); color: var(--warning); border: 1px solid rgba(255, 176, 32, .32); }
.poll-item__badges { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Onglets */
.tabs {
  display: inline-flex; padding: 4px; border-radius: 12px;
  background: #0a1224; border: 1px solid var(--border-soft); gap: 2px; margin-bottom: var(--space-6);
}
.tabs__link {
  padding: 9px 18px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
  color: var(--text-mid); transition: all .15s;
}
.tabs__link.is-active { background: var(--cyan); color: #04121a; }

/* Liste de sondages */
.poll-list { display: grid; gap: var(--space-4); }
.poll-item {
  display: block; border-radius: 15px; background: #101a30; border: 1px solid #1e2c48;
  padding: 18px; transition: border-color .15s;
}
.poll-item:hover { border-color: var(--border); }
.poll-item__meta {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
}
.poll-item__title {
  font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.3;
  color: var(--text-hi); margin: 0;
}

/* Options de vote */
.options { display: flex; flex-direction: column; gap: 10px; margin: var(--space-5) 0; }
.option {
  position: relative; overflow: hidden; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-input); background: #0a1326; padding: 14px 16px; transition: all .15s;
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  font-family: var(--font-body); color: var(--text-hi); font-size: 15px; font-weight: 600;
}
.option:hover { border-color: rgba(0, 229, 255, .5); }
.option.is-selected { border-color: var(--cyan); }
.option__dot {
  width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--text-faint);
  flex: none; display: flex; align-items: center; justify-content: center;
}
.option.is-selected .option__dot { border-color: var(--cyan); }
.option__dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: transparent; transition: all .15s; }
.option.is-selected .option__dot::after { background: var(--cyan); }

/* Choix multiple : carré (case à cocher) au lieu du cercle (bouton radio),
   pour signifier que plusieurs réponses sont possibles. */
[data-multi="1"] .option__dot { border-radius: 5px; }
[data-multi="1"] .option__dot::after { border-radius: 2px; }

/* Barres de résultat */
.result { margin-bottom: var(--space-4); }
.result__head { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 14px; }
.result__label { font-weight: 600; color: var(--text-hi); }
.result__pct { font-family: var(--font-mono); font-weight: 700; color: var(--text-mid); }
.result.is-winner .result__label, .result.is-winner .result__pct { color: var(--cyan); }
.result__track { height: 11px; border-radius: 999px; background: #0a1326; overflow: hidden; }
.result__fill { height: 100%; border-radius: 999px; background: #2a3a5c; }
.result.is-winner .result__fill {
  background: linear-gradient(90deg, #00e5ff, #00b8d4); box-shadow: 0 0 14px rgba(0, 229, 255, .5);
}

/* Statut de vote / participation */
.vote-status {
  margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border-hairline);
  font-family: var(--font-mono); font-size: 13px; color: var(--text-mid);
}
.vote-status strong { color: var(--lime); }

.participation { display: grid; gap: 10px; }
.participation__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 10px; background: #0a1326; border: 1px solid var(--border-input); padding: 12px 14px;
}
.participation__phone { font-family: var(--font-mono); font-size: 13.5px; color: var(--text-hi); }
.participation__name { font-size: 12px; color: var(--text-muted); }
.participation__row--named { align-items: flex-start; }
.participation__who { flex: 1; }
.participation__choices { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--border-hairline); display: flex; flex-direction: column; gap: 4px; }
.participation__choices li { font-size: 13px; }
.participation__q { color: var(--text-muted); }
.participation__a { color: var(--lime); font-weight: 600; }
.participation__choices--empty { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-hairline); font-size: 12.5px; color: var(--text-muted); font-style: italic; }

/* Liste dynamique d'options / numéros dans le formulaire de création */
.repeat-list { display: flex; flex-direction: column; gap: 8px; }
.repeat-row { display: flex; gap: 8px; align-items: center; }
.repeat-row .input { flex: 1; }
.repeat-remove {
  flex: none; width: 40px; height: 44px; border-radius: 10px; border: 1px solid var(--border-input);
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px;
}
.repeat-add {
  align-self: flex-start; background: transparent; border: 1px dashed var(--border-input);
  color: var(--cyan); border-radius: 10px; padding: 11px 14px; cursor: pointer; font-size: 13.5px;
  font-family: var(--font-body);
}

/* ——— Utilitaires de mise en page (remplacent les styles inline des templates) ——— */
.inline-form { display: inline; }
.back-link { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--text-mid); }
.page-title--after-back { margin-top: 12px; }
.form-footnote { margin-top: 16px; font-size: 13px; }
.not-found-block { margin-top: 40px; }

/* Page de vote */
.poll-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.named-notice {
  border-radius: 12px; background: rgba(255, 176, 32, .1); border: 1px solid rgba(255, 176, 32, .35);
  color: var(--warning); padding: 12px 15px; font-size: 13.5px; line-height: 1.5; margin-bottom: 18px;
}
.named-notice strong { color: var(--warning); }
.poll-question { font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.25; margin: 0 0 6px; }
.poll-description { margin: 0 0 6px; }
.poll-deadline { font-size: 12.5px; margin: 6px 0 0; }
.card--results { margin-top: var(--space-5); }
.section-title--flush { margin-top: 0; }
.vote-status__error { color: var(--danger-soft); }

/* Vue participation */
.stat-card { margin-bottom: 20px; display: flex; gap: 32px; }
.stat-card__value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--cyan); }
.stat-card__caption { color: var(--text-muted); font-size: 12px; }
.participation-note { font-size: 13px; margin-bottom: 16px; }
.participation__status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.participation__when { font-size: 11px; }

/* Résultats */
.empty-state--bare { border: none; padding: 24px 0; }
.flash--stacked { margin-top: 12px; }

/* Compteur en exposant sur le lien de menu « Disponibles » */
.nav-link { position: relative; }
.nav-badge {
  position: absolute; top: -9px; right: -14px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--cyan); color: #04121a;
  font-family: var(--font-mono); font-weight: 700; font-size: 11px; line-height: 1;
  box-shadow: 0 0 14px rgba(0, 229, 255, .5);
}

/* ——— Zones « à compléter » / « déjà complétés » (page Disponibles) ——— */
.poll-zone { margin-bottom: var(--space-8); }
.poll-zone__head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-4); }
.poll-zone__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.poll-zone__title { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0; }
.poll-zone__count {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-left: 2px;
}
/* À compléter : cyan (action attendue) */
.poll-zone--todo .poll-zone__dot { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.poll-zone--todo .poll-zone__count { background: rgba(0, 229, 255, .12); color: var(--cyan); }
/* Déjà complétés : lime (fait) */
.poll-zone--done .poll-zone__dot { background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.poll-zone--done .poll-zone__count { background: rgba(180, 255, 51, .12); color: var(--lime); }

.poll-item__flag { font-size: 11.5px; font-weight: 700; }
.poll-item__flag--todo { color: var(--cyan); }
.poll-item__flag--done { color: var(--lime); }
/* Liseré latéral discret assortissant chaque carte à sa zone */
.poll-item--todo { border-left: 3px solid rgba(0, 229, 255, .55); }
.poll-item--todo:hover { border-color: rgba(0, 229, 255, .55); border-left-color: var(--cyan); }
.poll-item--done { border-left: 3px solid rgba(180, 255, 51, .45); }
.poll-item--done:hover { border-color: rgba(180, 255, 51, .45); border-left-color: var(--lime); }

/* Listes « mes sondages » / admin */
.page-actions { margin-bottom: var(--space-5); }
.poll-item--static { cursor: default; }

/* ——— Modale de confirmation ——— */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 8, 18, .72); backdrop-filter: blur(3px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%; max-width: 420px; border-radius: 16px;
  background: var(--night-850); border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .6); padding: 26px 28px;
}
.modal__title { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin: 0 0 10px; }
.modal__text { color: var(--text-mid); font-size: 14.5px; line-height: 1.5; margin: 0 0 22px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; }
.poll-item__title--spaced { margin-bottom: 14px; }
.poll-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.poll-actions__end { margin-left: auto; }

/* Formulaire de création : ligne invité (numéro + nom optionnel) */
.repeat-row--voter .input[type="tel"] { flex: 1.2; }

/* Date limite : date + heure séparées (heure par défaut 20:00) */
.deadline-row { display: flex; gap: 8px; }
.deadline-row .input[type="date"] { flex: 1.6; }
.deadline-row .input[type="time"] { flex: 1; }

/* Image de sondage */
.input--file { padding: 10px 12px; cursor: pointer; }
.input--file::file-selector-button {
  background: #141d33; color: var(--text-hi); border: 1px solid var(--border-input);
  border-radius: 8px; padding: 6px 12px; margin-right: 12px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
}
.poll-image {
  display: block; border-radius: var(--radius-md); border: 1px solid var(--border-soft);
  margin: 0 auto 16px;
}
/* Auto : dimensions naturelles, bornées — un carré reste carré, un portrait reste portrait. */
.poll-image--auto { max-width: 100%; max-height: 420px; width: auto; height: auto; }
/* Bannière : pleine largeur, hauteur fixe, recadrage centré (zoom de remplissage). */
.poll-image--banner { width: 100%; height: 220px; object-fit: cover; object-position: center; }
/* Entière : jamais recadrée, à sa taille d'affichage maximale. */
.poll-image--full { width: 100%; height: auto; }

/* Case à cocher (choix multiple à la création) */
.field--checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-mid); }
.field--checkbox input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--cyan); cursor: pointer; }

/* Bascule « lever l'anonymat » */
.anon-toggle {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  border-radius: 11px; background: #101a30; border: 1px solid #1e2c48; padding: 14px 16px;
}
.anon-toggle input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--warning); cursor: pointer; flex: none; }
.anon-toggle__text { display: flex; flex-direction: column; gap: 3px; }
.anon-toggle__title { font-size: 14px; font-weight: 600; color: var(--text-hi); }
.anon-toggle__desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.anon-toggle:has(input:checked) { border-color: rgba(255, 176, 32, .5); background: rgba(255, 176, 32, .07); }

/* ——— Sondages multi-questions ——— */
/* Formulaire de création : blocs question */
.questions-list { display: flex; flex-direction: column; gap: 14px; }
.question-block {
  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px;
}
.question-block__head { display: flex; gap: 8px; align-items: center; }
.question-block__head .input { flex: 1; }
.question-block__number { color: var(--cyan); font-size: 12px; font-weight: 700; flex: none; }
.question-block__multi { margin: 0; font-size: 13px; }
.repeat-add--question { margin-top: 10px; }

/* Réponses en retrait sous leur question : la hiérarchie se lit d'un coup d'œil */
.question-block__answers {
  margin-left: 26px; padding-left: 16px; border-left: 2px solid var(--border-hairline);
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.question-block__answers .repeat-list { width: 100%; }

/* ——— Formulaire de création : gros blocs ——— */
.form-blocks { display: flex; flex-direction: column; gap: var(--space-6); }
.form-block__title {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  letter-spacing: -.01em; margin: 0 0 4px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field--compact { margin-bottom: 0; }
.image-options { margin-top: 12px; }

/* Créateur affiché en tête de la liste des invités (ajouté automatiquement) */
.voter-creator {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 10px; background: #0a1326; border: 1px dashed var(--border-input);
  padding: 12px 14px; margin-bottom: 8px;
}
.voter-creator__phone { font-size: 13.5px; color: var(--text-hi); }
.voter-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Aperçu du sondage */
.preview-zone__label { font-size: 12px; margin: 0 0 10px; }
.preview-zone .option { cursor: default; }
.preview-zone .option:hover { border-color: var(--border-input); }

/* Page de vote : une section par question, séparation nette entre chacune */
.question { margin-top: 20px; }
.question + .question { border-top: 2px solid var(--border); margin-top: 28px; padding-top: 24px; }
.question__title {
  font-family: var(--font-display); font-weight: 600; font-size: 17px;
  line-height: 1.3; margin: 0 0 4px; color: var(--text-hi);
}
.question__hint { font-size: 12px; margin: 0; }
.question .options { margin: 10px 0 0; }
/* Respiration entre la dernière option et le bouton Voter */
[data-vote-submit] { margin-top: var(--space-6); }

/* Résultats : une section par question */
.tally-question { margin-bottom: 18px; }
.tally-question + .tally-question { border-top: 1px solid var(--border-hairline); padding-top: 16px; }
.tally-question__title {
  font-family: var(--font-display); font-weight: 600; font-size: 15.5px;
  margin: 0 0 12px; color: var(--text-hi);
}
.tally-question__hint { font-size: 11px; font-weight: 500; }
