/* ===========================================================================
   Clairgest signup wizard — chantier 4.B (UI only)
   Mobile-first. Standalone — does not depend on admin.css.
   =========================================================================== */

:root {
  --primary:        #C97B5C;
  --primary-dark:   #B26849;
  --primary-light:  #F5E8DD;
  --bg:             #f8fafc;
  --card:           #ffffff;
  --text:           #1f2937;
  --text-muted:     #6b7280;
  --border:         #e5e7eb;
  --border-strong:  #d1d5db;
  --error:          #ef4444;
  --success:        #10b981;
  --shadow-card:    0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-cta:     0 4px 14px rgba(201, 123, 92, 0.35);
  --radius:         12px;
  --radius-lg:      16px;
}

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

html, body { margin: 0; padding: 0; }

body.signup-page {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(201, 123, 92, 0.08), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(178, 104, 73, 0.06), transparent 50%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ----------------------------- Layout ------------------------------------- */

.signup-shell {
  max-width: 840px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

@media (min-width: 768px) {
  .signup-shell { padding: 48px 24px 64px; }
}

.signup-header {
  text-align: center;
  margin-bottom: 24px;
}

.signup-brand {
  display: inline-block;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.signup-tagline {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.signup-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------------------------- Wizard card -------------------------------- */

.wizard-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 20px;
}

@media (min-width: 768px) {
  .wizard-card { padding: 40px; }
}

/* ----------------- Server-side alert (flash from POST handler) ---------- */

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* ---------------------------- Progress ----------------------------------- */

.progress {
  margin-bottom: 32px;
}

.progress-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.progress-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.progress-segment {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background-color 200ms ease;
}

.progress-segment.is-done {
  background: var(--primary);
}

.progress-segment.is-current {
  background: var(--primary);
}

/* ----------------------------- Steps ------------------------------------- */

.step-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .step-title { font-size: 28px; }
}

.step-subtitle {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 15px;
}

/* --------------------- Step 1 — Vertical cards --------------------------- */

.vertical-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .vertical-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

.vertical-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.vertical-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.vertical-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.vertical-radio:focus-visible + .vertical-card {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.vertical-radio:checked + .vertical-card {
  border-color: var(--primary);
  background: var(--primary-light);
}

.vertical-icon { font-size: 40px; line-height: 1; }
.vertical-title { font-size: 17px; font-weight: 600; color: var(--text); }
.vertical-subtitle { font-size: 13px; color: var(--text-muted); }

/* --------------------- Form fields (steps 2 & 3) ------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field-full { grid-column: 1 / -1; }
}

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

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.req { color: var(--error); margin-left: 2px; }
.optional { color: var(--text-muted); font-weight: 400; font-size: 13px; }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 123, 92, 0.18);
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.error-msg {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--error);
  min-height: 1em;
}

.error-msg:empty { display: none; }

/* --------------------- Slug live preview --------------------------------- */

.slug-preview {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.slug-preview code {
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* --------------------- Password strength meter --------------------------- */

.strength-meter {
  position: relative;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.strength-bar {
  height: 100%;
  width: 0;
  background: var(--error);
  transition: width 200ms ease, background-color 200ms ease;
}
.strength-bar[data-level="1"] { width: 33%;  background: var(--error); }
.strength-bar[data-level="2"] { width: 66%;  background: #f59e0b; }
.strength-bar[data-level="3"] { width: 100%; background: var(--success); }

#match-label.is-ok    { color: var(--success); }
#match-label.is-error { color: var(--error); }

/* --------------------- Step 4 — Trial card (Option B pricing) ----------- */

.trial-card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 16px;
  box-shadow: 0 0 0 4px rgba(201, 123, 92, 0.08);
}
.trial-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.trial-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px 0;
}
.trial-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}
.trial-features li::before {
  content: "✓ ";
  color: var(--primary);
  font-weight: 700;
  margin-right: 4px;
}
.trial-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 16px 0 12px 0;
  padding: 12px 14px;
  background: var(--primary-light);
  border-radius: 8px;
}
.trial-pricing-link {
  margin: 0;
  font-size: 14px;
}
.trial-pricing-link a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted var(--primary-dark);
  padding-bottom: 1px;
}
.trial-pricing-link a:hover {
  color: var(--primary);
  border-bottom-style: solid;
}

/* --------------------- Step 4 — Legacy plan cards (vestige, conservé pour
   ne pas casser éventuels old browser caches) ------------------------------ */

.plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 768px) {
  .plan-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

.plan-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 18px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.plan-radio:checked + .plan-card.plan-active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(201, 123, 92, 0.08);
}

.plan-card.plan-disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: #fafafa;
}
.plan-card.plan-disabled:hover { border-color: var(--border); }

.plan-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 4px 10px;
  border-radius: 999px;
}

.plan-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.plan-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.plan-price s { color: var(--text-muted); font-weight: 600; font-size: 16px; }
.plan-card.plan-disabled .plan-price { font-size: 14px; color: var(--text-muted); font-weight: 500; }

.plan-features {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
}
.plan-features li::before {
  content: "✓ ";
  color: var(--primary);
  font-weight: 700;
}

.plan-current {
  margin-top: 8px;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan-card.plan-disabled .plan-current { display: none; }

.plan-note {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 24px;
}

/* --------------------- Step 4 — Recap ------------------------------------ */

.recap {
  margin: 0 0 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}
.recap summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  color: var(--text);
}
.recap summary::-webkit-details-marker { display: none; }
.recap summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--primary);
  transition: transform 150ms ease;
}
.recap[open] summary::before { transform: rotate(90deg); }

.recap-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  padding: 0 16px 16px;
  font-size: 13px;
}
.recap-list dt { color: var(--text-muted); font-weight: 500; }
.recap-list dd { margin: 0; color: var(--text); }
.recap-list code { font-size: 12px; }

/* --------------------- Step 4 — Terms checkbox -------------------------- */

.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.terms-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* ---------------------------- Buttons ------------------------------------ */

.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

@media (max-width: 539px) {
  .step-nav { flex-direction: column-reverse; }
  .step-nav .btn { width: 100%; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

/* Honor the [hidden] HTML attribute on buttons. Without this, the .btn
   display:inline-flex above wins over the user-agent [hidden]{display:none}
   rule (equal specificity, later wins), keeping nav buttons visible
   when JS toggles hidden between wizard steps. */
.btn[hidden] { display: none; }

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg); }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  background: var(--border-strong);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 17px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: var(--shadow-cta);
}
.btn-lg:hover { filter: brightness(1.05); }
.btn-lg:disabled,
.btn-lg[aria-disabled="true"] {
  background: var(--border-strong);
  box-shadow: none;
}

/* Step 4 in a compact viewport: stack nav so submit button gets full width */
@media (min-width: 540px) {
  .step-nav .btn-lg { margin-left: auto; }
}
