/*
 * ms-questionnaire.css — Questionnaire athlète Move&Shine
 * Chargé uniquement sur /portail-client (shortcode) et /portail-coach (ms_bilan).
 * Préfixe exclusif : .msq-
 * Utilise les variables CSS du design system : colors_and_type.css
 */

/* ===== Conteneur global ===== */
.msq-wrap {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 80px;
}

/* ===== Barre de progression ===== */
.msq-progress-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  padding: 10px 20px;
  margin-bottom: 24px;
}

.msq-progress-track {
  display: flex;
  gap: 6px;
  align-items: center;
}

.msq-progress-step {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.msq-progress-step .msq-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--gold-300, #E8CB8A), var(--gold-500, #C9A24A));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.msq-progress-step.msq-active .msq-fill,
.msq-progress-step.msq-complete .msq-fill {
  transform: scaleX(1);
}

.msq-progress-label {
  text-align: center;
  margin-top: 7px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute, #B7B7B7);
  font-weight: 600;
}

/* ===== En-tête ===== */
.msq-header {
  text-align: center;
  padding: 4px 0 36px;
}

.msq-badge {
  display: block;
  font-family: var(--font-body, 'Lato', sans-serif);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-500, #C9A24A);
  margin-bottom: 20px;
}

.msq-title {
  font-family: var(--font-display, 'Cormorant Garamond', serif) !important;
  font-size: 2.6rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: var(--paper, #fff) !important;
  margin: 24px 0 32px !important;
}

.msq-subtitle {
  font-family: var(--font-body, 'Lato', sans-serif);
  color: var(--mute, #B7B7B7);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  max-width: 460px;
  margin-inline: auto;
}

/* ===== Sections ===== */
.msq-section {
  background: var(--surface-card, #0A0A0A);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: var(--r-md, 16px);
  padding: 24px 22px;
  margin-bottom: 16px;
  scroll-margin-top: 80px;
}

.msq-section.msq-hidden {
  display: none;
}

.msq-section--pps {
  border-color: var(--gold-700, #6F5417);
  position: relative;
}

.msq-section--pps::before {
  content: "⚡ Section ciblée";
  position: absolute;
  top: -11px;
  left: 22px;
  background: var(--gold-500, #C9A24A);
  color: var(--ink, #000);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--r-pill, 9999px);
}

.msq-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.msq-section-emoji {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.msq-section-head h3 {
  font-family: var(--font-body, 'Lato', sans-serif) !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: var(--paper, #fff) !important;
  margin: 0 !important;
}

.msq-section-intro {
  color: var(--mute, #B7B7B7);
  font-size: 0.83rem;
  margin: -10px 0 18px;
}

/* ===== Questions ===== */
.msq-question {
  margin-bottom: 22px;
}

.msq-question:last-child {
  margin-bottom: 0;
}

.msq-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--paper, #fff);
  margin-bottom: 10px;
}

.msq-hint {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--mute, #B7B7B7);
  margin-top: 3px;
}

.msq-limit-hint {
  font-size: 0.78rem;
  color: var(--mute, #B7B7B7);
  font-style: italic;
  margin-top: 8px;
}

/* ===== Options standard (ring) ===== */
.msq-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msq-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 10px 13px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: var(--r-sm, 8px);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.msq-option:hover {
  border-color: var(--gold-700, #6F5417);
}

.msq-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.msq-ring {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin-top: 1px;
  position: relative;
  transition: border-color 0.15s ease;
}

.msq-ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--gold-500, #C9A24A);
  transform: scale(0);
  transition: transform 0.18s ease;
}

.msq-option input:checked + .msq-ring {
  border-color: var(--gold-500, #C9A24A);
}

.msq-option input:checked + .msq-ring::after {
  transform: scale(1);
}

.msq-option.msq-checked {
  background: rgba(201, 162, 74, 0.08);
  border-color: var(--gold-700, #6F5417);
}

.msq-option.msq-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.msq-option-text {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--paper, #fff);
}

/* ===== Options feu tricolore ===== */
.msq-traffic-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.msq-traffic-option {
  flex: 1;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 13px 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: var(--r-sm, 8px);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.msq-traffic-option:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
}

.msq-traffic-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.msq-traffic-dot {
  font-size: 1.3rem;
  line-height: 1;
}

.msq-traffic-text {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--mute, #B7B7B7);
}

.msq-traffic-option.msq-checked-green {
  border-color: #5C8A4F;
  border-width: 2px;
  background: rgba(92, 138, 79, 0.28);
}

.msq-traffic-option.msq-checked-yellow {
  border-color: var(--gold-500, #C9A24A);
  border-width: 2px;
  background: rgba(201, 162, 74, 0.22);
}

.msq-traffic-option.msq-checked-red {
  border-color: var(--danger, #C9483A);
  border-width: 2px;
  background: rgba(201, 72, 58, 0.22);
}

.msq-traffic-option.msq-checked-green .msq-traffic-text,
.msq-traffic-option.msq-checked-yellow .msq-traffic-text,
.msq-traffic-option.msq-checked-red .msq-traffic-text {
  color: var(--paper, #fff);
}

/* ===== Navigation étape par étape ===== */
.msq-step-hidden {
  display: none !important;
}

.msq-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.15));
}

.msq-nav-btn {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 22px;
  border-radius: var(--r-pill, 9999px);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.msq-nav-prev {
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.25));
  color: var(--mute, #B7B7B7);
}

.msq-nav-prev:hover {
  border-color: var(--paper, #fff);
  color: var(--paper, #fff);
}

/* .msq-nav-next hérite de .ms-btn (gradient or du design system) */

/* ===== Transitions entre étapes ===== */
@keyframes msqFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msq-section.msq-leaving,
.msq-conclusion.msq-leaving {
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.msq-section.msq-entering,
.msq-conclusion.msq-entering {
  animation: msqFadeIn 0.28s ease forwards;
}

/* ===== Champs texte ===== */
.msq-text-input {
  width: 100%;
  font-size: 0.9rem;
  padding: 9px 12px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: var(--r-sm, 8px);
  background: rgba(255, 255, 255, 0.05);
  color: var(--paper, #fff);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.msq-text-input:focus {
  outline: none;
  border-color: var(--gold-500, #C9A24A);
  background: rgba(255, 255, 255, 0.08);
}

.msq-text-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* ===== Sous-champs conditionnels ===== */
.msq-sub-field {
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.msq-sub-field.msq-visible {
  max-height: 120px;
  opacity: 1;
}

/* ===== Conclusion ===== */
.msq-conclusion {
  text-align: center;
  padding: 30px 22px 32px;
}

.msq-conclusion-icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.msq-conclusion-title {
  font-family: var(--font-display, 'Cormorant Garamond', serif) !important;
  font-size: 1.5rem !important;
  color: var(--paper, #fff) !important;
  margin: 0 0 8px !important;
}

.msq-conclusion-text {
  color: var(--mute, #B7B7B7);
  font-size: 0.88rem;
  max-width: 420px;
  margin: 0 auto 22px;
}

.msq-submit-btn {
  font-size: 1rem;
  padding: 13px 36px;
}

.msq-signature {
  margin-top: 18px;
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--gold-500, #C9A24A);
}

/* ===== Message connexion ===== */
.msq-notice {
  color: var(--mute, #B7B7B7);
  font-size: 0.9rem;
}

.msq-notice a {
  color: var(--gold-500, #C9A24A);
  text-decoration: underline;
}

/* ===== Overlay confirmation ===== */
.msq-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.msq-overlay[hidden] {
  display: none;
}

.msq-overlay-card {
  background: var(--surface-card, #0A0A0A);
  border: 1px solid var(--gold-700, #6F5417);
  border-radius: var(--r-md, 16px);
  max-width: 420px;
  width: 100%;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--halo-gold, 0 0 80px rgba(201, 162, 74, 0.25));
}

.msq-overlay-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.msq-overlay-card h3 {
  font-family: var(--font-display, 'Cormorant Garamond', serif) !important;
  font-size: 1.4rem !important;
  color: var(--paper, #fff) !important;
  margin: 0 0 10px !important;
}

.msq-overlay-card p {
  color: var(--mute, #B7B7B7);
  font-size: 0.88rem;
  margin: 0 0 22px;
}

/* ===== Portail coach : badge + bouton ===== */
.msq-coach-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--mute, #B7B7B7);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: var(--r-pill, 9999px);
  padding: 5px 14px;
  margin: 8px 0 16px;
}

.msq-coach-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-500, #C9A24A);
  background: transparent;
  border: 1px solid var(--gold-700, #6F5417);
  border-radius: var(--r-pill, 9999px);
  padding: 7px 18px;
  cursor: pointer;
  margin: 8px 0 16px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.msq-coach-btn:hover {
  background: rgba(201, 162, 74, 0.08);
  border-color: var(--gold-500, #C9A24A);
}

/* ===== Modal coach (overlay) ===== */
.msq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  overflow-y: auto;
}

.msq-modal-overlay[hidden] {
  display: none;
}

.msq-modal-card {
  background: var(--surface-card, #0A0A0A);
  border: 1px solid var(--gold-700, #6F5417);
  border-radius: var(--r-md, 16px);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px;
  position: relative;
  box-shadow: var(--halo-gold, 0 0 80px rgba(201, 162, 74, 0.25));
}

.msq-modal-actions {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msq-modal-close,
.msq-modal-print {
  background: transparent;
  border: none;
  color: var(--mute, #B7B7B7);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
}

.msq-modal-close { font-size: 1.1rem; }

.msq-modal-close:hover,
.msq-modal-print:hover {
  color: var(--gold-500, #C9A24A);
}


/* ===== Vue lecture seule ===== */
.msq-readonly-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.15));
}

.msq-readonly-name {
  font-family: var(--font-display, 'Cormorant Garamond', serif) !important;
  font-size: 1.4rem !important;
  color: var(--paper, #fff) !important;
  margin: 0 !important;
}

.msq-readonly-date {
  font-size: 0.78rem;
  color: var(--mute, #B7B7B7);
}

.msq-readonly-section {
  margin-bottom: 18px;
}

.msq-readonly-section-title {
  font-family: var(--font-display, 'Cormorant Garamond', serif) !important;
  font-size: 1rem !important;
  color: var(--gold-300, #E8CB8A) !important;
  font-weight: 600 !important;
  margin: 0 0 10px !important;
  display: flex;
  align-items: center;
  gap: 7px;
}

.msq-readonly-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msq-readonly-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px;
  font-size: 0.87rem;
}

.msq-readonly-dt {
  color: var(--mute, #B7B7B7);
  font-weight: 600;
}

.msq-readonly-dd {
  color: var(--paper, #fff);
  margin: 0;
}

/* ===== Focus visible (accessibilité) ===== */
.msq-option input:focus-visible + .msq-ring,
.msq-traffic-option input:focus-visible ~ .msq-traffic-dot,
.msq-text-input:focus-visible,
.msq-submit-btn:focus-visible,
.msq-coach-btn:focus-visible {
  outline: 2px solid var(--gold-500, #C9A24A);
  outline-offset: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .msq-wrap { padding-bottom: 60px; }

  .msq-header { padding: 4px 0 24px; }

  .msq-title {
    font-size: 1.8rem !important;
    letter-spacing: 0.02em !important;
    margin: 8px 0 14px !important;
  }

  .msq-subtitle { font-size: 0.85rem; }

  .msq-section { padding: 18px 14px; }
  .msq-traffic-options { flex-direction: column; }
  .msq-traffic-option { flex-direction: row; justify-content: flex-start; min-width: 0; text-align: left; }
  .msq-section--pps::before { left: 14px; }
  .msq-readonly-row { grid-template-columns: 1fr; gap: 2px; }
  .msq-readonly-dt { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .msq-fill,
  .msq-ring::after,
  .msq-traffic-option,
  .msq-sub-field,
  .msq-option { transition: none !important; }
}
