/* ===================================================================
   PILOXA — Module Diagnostic Conformité e-Facturation 2026
   Classes scoping :  .d-*  (préfixe court pour éviter collisions).
   Tokens hérités de styles.css — ne pas redéfinir ici.
   =================================================================== */

/* ── Module wrapper ────────────────────────────────────────────────── */

.d-module {
  max-width: 880px;
  margin: 0 auto 64px;
  padding: 0 24px;
}

/* ── Stepper ───────────────────────────────────────────────────────── */

.d-stepper {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  counter-reset: d-step;
}

.d-stepper li {
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-lg);
  background: var(--pi-card);
  color: var(--pi-ink-soft);
  font-size: 0.88rem;
  font-weight: 500;
  position: relative;
  transition: all .15s ease;
}

.d-stepper li::before {
  counter-increment: d-step;
  content: counter(d-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pi-cream-2);
  color: var(--pi-ink-soft);
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.d-stepper li.is-current {
  border-color: var(--pi-purple);
  background: var(--pi-violet-3);
  color: var(--pi-ink);
}

.d-stepper li.is-current::before {
  background: var(--pi-purple-press);
  color: #fff;
}

.d-stepper li.is-done {
  color: var(--pi-success);
}

.d-stepper li.is-done::before {
  content: '✓';
  background: rgba(15,133,80,0.10);
  color: var(--pi-success);
}

/* ── Card de step ──────────────────────────────────────────────────── */

.d-step {
  background: var(--pi-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: var(--sh-1);
}

.d-step[hidden] {
  display: none;
}

.d-step h2 {
  font-size: 1.4rem;
  margin: 0 0 6px;
}

.d-step .d-step-intro {
  color: var(--pi-ink-soft);
  margin: 0 0 24px;
  font-size: 0.95rem;
}

/* ── Form fields ───────────────────────────────────────────────────── */

.d-field {
  margin-bottom: 20px;
}

.d-field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--pi-ink);
  margin-bottom: 6px;
}

.d-field .d-help {
  font-size: 0.82rem;
  color: var(--pi-ink-soft);
  margin-top: 4px;
}

.d-field select,
.d-field input[type="email"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-md);
  background: var(--pi-card);
  font-family: var(--ff-body);
  font-size: 0.95rem;
  color: var(--pi-ink);
  transition: all .15s ease;
}

.d-field select:focus,
.d-field input[type="email"]:focus {
  border-color: var(--pi-purple-press);
  box-shadow: var(--sh-2);
}

.d-field select:invalid {
  color: var(--pi-ink-soft);
}

/* ── Radio cards (Q yes/no/unknown) ────────────────────────────────── */

.d-question {
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-lg);
  padding: 18px 18px 14px;
  margin-bottom: 14px;
  background: var(--pi-card);
}

.d-question legend {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--pi-ink);
  padding: 0;
  margin-bottom: 6px;
}

.d-question .d-help {
  font-size: 0.82rem;
  color: var(--pi-ink-soft);
  margin-bottom: 12px;
  line-height: 1.5;
}

.d-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.d-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-md);
  background: var(--pi-cream);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--pi-ink-soft);
  transition: all .15s ease;
}

.d-radio:hover {
  border-color: var(--pi-ink);
  background: var(--pi-violet-3);
  color: var(--pi-ink);
}

.d-radio input[type="radio"] {
  accent-color: var(--pi-purple-press);
  margin: 0;
}

.d-radio input[type="radio"]:checked + span {
  font-weight: 600;
  color: var(--pi-purple-press);
}

.d-radio:has(input[type="radio"]:checked) {
  border-color: var(--pi-purple);
  background: var(--pi-violet-3);
  color: var(--pi-ink);
}

.d-radio input[type="radio"]:focus-visible {
  outline: 2px solid var(--pi-purple-press);
  outline-offset: 2px;
}

/* ── Actions row ───────────────────────────────────────────────────── */

.d-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.d-actions .d-actions-right {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Résultat — bloc deadlines ─────────────────────────────────────── */

.d-deadline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.d-deadline {
  background: var(--pi-card);
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}

.d-deadline .ey {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pi-purple-press);
  font-weight: 700;
  margin-bottom: 8px;
}

.d-countdown {
  font-size: 1rem;
  color: var(--pi-ink-soft);
  margin: 4px 0 6px;
}

.d-countdown strong {
  font-family: var(--ff-display);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-block;
  margin-right: 4px;
  color: var(--pi-ink);
}

.d-countdown[data-tone="danger"] strong {
  color: var(--pi-error);
}
.d-countdown[data-tone="warning"] strong {
  color: var(--pi-warn);
}
.d-countdown[data-tone="info"] strong {
  color: var(--pi-purple-press);
}

.d-deadline-date {
  font-size: 0.92rem;
  color: var(--pi-ink);
  font-weight: 600;
}

.d-deadline-help {
  font-size: 0.8rem;
  color: var(--pi-ink-soft);
  margin: 10px 0 0;
  line-height: 1.5;
}

/* ── Résultat — score ──────────────────────────────────────────────── */

.d-score-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px 24px;
  border-radius: var(--r-xl);
  border: 1px solid var(--pi-divider);
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.d-score-card.is-compliant   { background: rgba(15,133,80,0.18); border-color: var(--pi-success); }
.d-score-card.is-finalize    { background: var(--pi-sun-soft); border-color: var(--pi-warn); }
.d-score-card.is-significant { background: var(--pi-coral-soft); border-color: var(--pi-coral); }
.d-score-card.is-critical    { background: var(--pi-coral-soft); border-color: var(--pi-error); }

.d-score-number {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
}

.d-score-value {
  font-family: var(--ff-display);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--pi-ink);
}

.d-score-out {
  font-size: 1rem;
  color: var(--pi-ink-soft);
  font-weight: 600;
}

.d-score-meta {
  flex: 1 1 auto;
  min-width: 200px;
}

.d-score-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--pi-ink);
  margin-bottom: 4px;
}

.d-score-breakdown {
  font-size: 0.85rem;
  color: var(--pi-ink);
  line-height: 1.6;
}

.d-score-note {
  font-size: 0.78rem;
  color: var(--pi-ink-soft);
  margin: 8px 0 0;
  font-style: italic;
}

/* ── Risk alert ────────────────────────────────────────────────────── */

.d-risk-alert {
  display: flex;
  gap: 14px;
  background: var(--pi-coral-soft);
  border: 1px solid var(--pi-error);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 24px;
}

.d-risk-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.d-risk-alert h3 {
  margin: 0 0 6px;
  color: var(--pi-error);
  font-size: 1rem;
  font-weight: 700;
}

.d-risk-alert p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--pi-ink);
  line-height: 1.55;
}

/* ── Franchise note ────────────────────────────────────────────────── */

.d-franchise-warn {
  display: flex;
  gap: 12px;
  background: var(--pi-sun-soft);
  border: 1px solid var(--pi-warn);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: var(--pi-ink);
}

.d-franchise-warn p { margin: 0; line-height: 1.55; }

/* ── Chantiers ─────────────────────────────────────────────────────── */

.d-chantier {
  background: var(--pi-card);
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 14px;
}

.d-chantier-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.d-chantier-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--pi-purple);
  color: var(--pi-purple-press);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--ff-display);
  flex-shrink: 0;
}

.d-chantier h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.d-chantier-desc {
  margin: 4px 0 14px;
  font-size: 0.92rem;
  color: var(--pi-ink-soft);
  line-height: 1.55;
}

.d-chantier-meta {
  display: flex;
  gap: 24px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.d-chantier-meta > div { margin: 0; }
.d-chantier-meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pi-ink-soft);
  margin-bottom: 2px;
  font-weight: 600;
}
.d-chantier-meta dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--pi-ink);
}

.d-chantier-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.88rem;
  color: var(--pi-purple-press);
  font-weight: 600;
}
.d-chantier-link:hover {
  color: var(--pi-success);
}

.d-chantier-piloxa {
  margin-top: 16px;
  padding: 16px 18px;
  background: rgba(15,133,80,0.10);
  border: 1px solid var(--pi-success);
  border-radius: var(--r-md);
}

.d-chantier-piloxa .ey {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pi-success);
  font-weight: 700;
  margin-bottom: 4px;
}

.d-chantier-piloxa-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pi-ink);
  margin-bottom: 10px;
}

.d-chantier-piloxa ul {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--pi-ink);
  line-height: 1.6;
}
.d-chantier-piloxa li + li {
  margin-top: 4px;
}

/* ── Empty state (score 100) ──────────────────────────────────────── */

.d-empty {
  text-align: center;
  padding: 40px 20px;
}
.d-empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}
.d-empty h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}
.d-empty p {
  margin: 0;
  color: var(--pi-ink-soft);
}

/* ── CTA form ──────────────────────────────────────────────────────── */

.d-cta {
  margin-top: 32px;
  padding: 24px;
  background: var(--pi-cream);
  border: 1px solid var(--pi-divider);
  border-radius: var(--r-xl);
}

.d-cta h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

.d-cta .d-cta-intro {
  margin: 0 0 18px;
  color: var(--pi-ink-soft);
  font-size: 0.92rem;
}

.d-cta fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.d-cta-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--pi-ink-soft);
  line-height: 1.5;
}

/* Input natif visuellement masqué (mais focusable et lu par les lecteurs
   d'écran) — le visuel est porté par `.d-cta-switch`. */
.d-cta-consent input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* Toggle pilule — 32×18 px, gris au repos, sky-deep une fois coché. */
.d-cta-switch {
  flex: 0 0 auto;
  position: relative;
  width: 32px;
  height: 18px;
  margin-top: 2px;
  background: var(--pi-ink);
  border-radius: 999px;
  transition: background 0.18s ease;
  cursor: pointer;
}

.d-cta-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.d-cta-consent input[type="checkbox"]:checked + .d-cta-switch {
  background: var(--pi-purple-press);
}

.d-cta-consent input[type="checkbox"]:checked + .d-cta-switch::before {
  transform: translateX(14px);
}

.d-cta-consent input[type="checkbox"]:focus-visible + .d-cta-switch {
  outline: 2px solid var(--pi-purple-press);
  outline-offset: 2px;
}

.d-cta-consent-text {
  flex: 1 1 auto;
}

.d-cta-submit {
  margin-top: 16px;
  width: 100%;
}

/* Honeypot anti-spam — label + input retirés du viewport mais conservés
   dans le DOM (les bots remplissent, les humains ne voient rien). Surtout
   pas `display: none` : la plupart des scrapers ignorent les éléments
   non rendus et le piège tomberait à l eau. */
.d-cta label[for="leadCompany"] {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.d-cta-feedback {
  margin-top: 12px;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.d-cta-feedback[data-tone="success"] { color: var(--pi-success); }
.d-cta-feedback[data-tone="error"]   { color: var(--pi-error); }

/* ── Disclaimer ────────────────────────────────────────────────────── */

.d-disclaimer {
  max-width: 880px;
  margin: 0 auto 80px;
  padding: 0 24px;
  font-size: 0.82rem;
  color: var(--pi-ink-soft);
  line-height: 1.6;
}

.d-disclaimer strong { color: var(--pi-ink); }

/* ── Mobile tweaks ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .d-step { padding: 22px 18px; }
  .d-stepper li { font-size: 0.82rem; padding: 10px 12px; }
  .d-score-value { font-size: 2.4rem; }
  .d-actions { flex-direction: column-reverse; }
  .d-actions .d-actions-right { width: 100%; margin-left: 0; }
  .d-actions .d-actions-right .btn { width: 100%; justify-content: center; }
}
