/* ═══════════════════════════════════════════════════════════════════════════
 * Swaygo UI — authentication & account forms
 * login, register (wizard), step-up OTP, allauth account pages, delete account.
 * Builds on sy.css tokens/components; everything is scoped under .sy-auth so
 * nothing leaks onto the shared header/footer. Replaces auth.css/register.css
 * on these pages (those redefined :root --text to near-white + a global reset).
 * ═══════════════════════════════════════════════════════════════════════════ */

.sy-auth { padding-block: 24px 8px; }
@media (min-width: 768px) { .sy-auth { padding-block: 40px 8px; } }

.sy-auth__grid { display: grid; gap: 20px; }
.sy-auth__main { width: 100%; max-width: 520px; margin-inline: auto; min-width: 0; }
@media (min-width: 960px) {
  /* card and photo panel share the row height: a short card (logout, reset…) no longer sits next to
     a much taller aside — the photo shrinks to the space left, the card centres its content. */
  .sy-auth--split .sy-auth__grid {
    grid-template-columns: minmax(0, 500px) minmax(0, 1fr); gap: 40px; align-items: stretch;
  }
  .sy-auth--split .sy-auth__main { margin: 0; max-width: none; display: flex; flex-direction: column; }
  .sy-auth--split .sy-auth__card { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; }
  .sy-auth--split .sy-auth__card-in { min-width: 0; }
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.sy-auth__card { padding: 24px 20px; scroll-margin-top: calc(var(--sy-header-h) + 12px); }
@media (min-width: 480px) { .sy-auth__card { padding: 32px; } }

.sy-auth__head { display: grid; gap: 6px; margin-bottom: 22px; }
.sy-auth__head--center { justify-items: center; text-align: center; }
.sy-auth__icon {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--sy-accent-soft); color: var(--sy-accent-text); margin-bottom: 6px;
}
.sy-auth__icon svg { width: 22px; height: 22px; }
.sy-auth__icon--success { background: var(--sy-success-bg); color: var(--sy-success); }
.sy-auth__icon--warning { background: var(--sy-warning-bg); color: var(--sy-warning); }
.sy-auth__icon--danger  { background: var(--sy-danger-bg);  color: var(--sy-danger); }
.sy-auth__icon--info    { background: var(--sy-info-bg);    color: var(--sy-info); }
.sy-auth__title {
  margin: 0; color: var(--sy-ink); font-weight: 800; line-height: 1.1; letter-spacing: -0.035em;
  font-size: clamp(1.6rem, 1.4rem + .8vw, 2rem); overflow-wrap: anywhere;
}
.sy-auth__lead { margin: 0; color: var(--sy-ink-2); font-size: .9375rem; line-height: 1.5; overflow-wrap: anywhere; }
.sy-auth__lead strong { color: var(--sy-ink); }

.sy-auth__alerts { display: grid; gap: 8px; margin-bottom: 18px; }
.sy-auth .sy-alert__body p { margin: 0; }
.sy-auth .sy-alert__body p + p { margin-top: 4px; }
.rg-nfe { margin-top: 18px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.sy-auth__form { display: grid; gap: 18px; margin: 0; }
.sy-auth form { margin: 0; }
.sy-auth input:not([type=radio], [type=checkbox], [type=hidden], [type=submit], [type=button]) { width: 100%; }
.sy-auth .sy-field > label { justify-self: start; }
.sy-auth .sy-label { font-size: .9375rem; }
.sy-auth__errs { display: grid; gap: 4px; }
.sy-auth__errs .sy-error svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.sy-auth__help { font-size: .8125rem; color: var(--sy-ink-3); margin: 0; line-height: 1.45; }
.sy-auth__help ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; list-style: disc; }
.sy-auth__forgot { margin: 2px 0 0; text-align: right; font-size: .875rem; }
.sy-auth__labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sy-auth__labelrow .sy-link { font-size: .875rem; }

/* password field + show/hide toggle (static/js/sy-auth.js) */
.sy-auth__pw { position: relative; min-width: 0; }
.sy-auth .sy-auth__pw input { padding-right: 52px; }
.sy-auth__pw-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--sy-ink-2); }
.sy-auth__pw-btn[hidden] { display: none; }
.sy-auth__pw-btn .sy-auth__eye-off { display: none; }
.sy-auth__pw-btn[aria-pressed="true"] .sy-auth__eye { display: none; }
.sy-auth__pw-btn[aria-pressed="true"] .sy-auth__eye-off { display: block; }

.sy-auth__submit { margin-top: 2px; }
.sy-auth__note {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
  margin: -6px 0 0; font-size: .8125rem; color: var(--sy-ink-3); text-align: center;
}
.sy-auth__note svg { width: 15px; height: 15px; }
.sy-auth .sy-auth__note a { color: var(--sy-accent-text); font-weight: 600; text-decoration: none; }
.sy-auth__note a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* actions row: secondary on the left, primary on the right; stacked on phones */
.sy-auth__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.sy-auth__actions .sy-auth__spacer { flex: 1; }
.sy-auth__actions--spaced { margin-top: 22px; }
@media (max-width: 479px) {
  .sy-auth__actions { flex-direction: column-reverse; align-items: stretch; }
  .sy-auth__actions > .sy-btn { width: 100%; }
  .sy-auth__actions .sy-auth__spacer { display: none; }
}

/* ── Social providers ─────────────────────────────────────────────────────── */
.sy-auth__divider {
  display: flex; align-items: center; gap: 12px; margin: 22px 0 14px;
  color: var(--sy-ink-3); font-size: .8125rem; font-weight: 600;
}
.sy-auth__divider::before, .sy-auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--sy-line); }
.sy-auth__socials { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 420px) { .sy-auth__socials { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sy-auth__social { padding-inline: 10px; }
.sy-auth__social svg { width: 18px; height: 18px; }

.sy-auth__foot {
  margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--sy-line);
  text-align: center; color: var(--sy-ink-2); font-size: .9375rem;
}
.sy-auth__foot .sy-link { display: inline; }

/* ── Side visual (desktop) / compact recap (mobile) ───────────────────────── */
.sy-auth__aside {
  display: flex; flex-direction: column; min-width: 0; max-width: 520px; width: 100%; margin-inline: auto;
  background: var(--sy-bg-alt); border: 1px solid var(--sy-line); border-radius: var(--sy-r-lg); overflow: hidden;
}
.sy-auth__media { display: none; }
.sy-auth__aside-body { padding: 20px; display: grid; gap: 10px; align-content: start; }
.sy-auth__kicker { margin: 0; font-size: .875rem; font-weight: 700; color: var(--sy-accent-text); }
.sy-auth__aside-title {
  margin: 0; color: var(--sy-ink); font-weight: 800; line-height: 1.12; letter-spacing: -0.03em;
  font-size: clamp(1.25rem, 1.1rem + .9vw, 1.95rem);
}
.sy-auth__aside-text { margin: 0; color: var(--sy-ink-2); font-size: .9375rem; }
.sy-auth__feats { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.sy-auth__feats li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; color: var(--sy-ink-2); font-size: .9375rem; line-height: 1.4; }
.sy-auth__feats svg { width: 20px; height: 20px; color: var(--sy-accent-text); }
@media (min-width: 960px) {
  .sy-auth__aside { max-width: none; margin: 0; background: var(--sy-surface); box-shadow: var(--sy-shadow-1); }
  /* height 0 + flex-grow: the photo adds only its min-height to the row and fills what the card leaves */
  .sy-auth__media { display: block; position: relative; flex: 1 1 auto; height: 0; min-height: 240px; background: #2a1d14; }
  .sy-auth__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; display: block; }
  /* warm, convivial scene: a soft veil at the bottom keeps the frame calm next to the panel copy */
  .sy-auth__media::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(0deg, rgba(20,13,8,.28) 0%, rgba(20,13,8,0) 45%); }
  /* very tall card (sign-up after a server error: every step shown) — keep the natural 16:10 photo
     and a sticky panel instead of a stretched, upscaled image */
  .sy-auth__grid:has(.rg-show-all) .sy-auth__aside { align-self: start; position: sticky; top: calc(var(--sy-header-h) + 24px); }
  .sy-auth__grid:has(.rg-show-all) .sy-auth__media { flex: none; height: auto; aspect-ratio: 16 / 10; }
  .sy-auth__aside-body { padding: 28px 32px 32px; gap: 12px; }
}

/* ── Notices inside a card (info pages, tips) ─────────────────────────────── */
.sy-auth__stack { display: grid; gap: 12px; }
.sy-auth__stack > .sy-btn { margin-top: 6px; }

/* ── Register wizard (ids/classes driven by the inline script) ───────────── */
.rg-progress { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 22px; }
.rg-step-wrap { flex: 0 1 auto; min-width: 0; display: grid; justify-items: center; gap: 6px; text-align: center; }
.rg-step-dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8125rem; font-weight: 700; line-height: 1;
  border: 1.5px solid var(--sy-line-strong); background: var(--sy-surface); color: var(--sy-ink-3);
}
.rg-step-dot.is-active { border-color: var(--sy-action); background: var(--sy-accent-soft); color: var(--sy-accent-text); }
.rg-step-dot.is-done { border-color: var(--sy-action); background: var(--sy-action); color: var(--sy-on-action); }
.rg-step-dot.is-done::before {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rg-step-label { font-size: .75rem; font-weight: 600; line-height: 1.2; color: var(--sy-ink-3); white-space: nowrap; }
@media (max-width: 399px) { .rg-progress { gap: 4px; } .rg-step-label { font-size: .6875rem; } }
.rg-step-wrap:has(.is-active) .rg-step-label, .rg-step-wrap:has(.is-done) .rg-step-label { color: var(--sy-ink); }
.rg-step-line { flex: 1 1 8px; min-width: 8px; height: 2px; margin-top: 14px; border-radius: 2px; background: var(--sy-line); }
.rg-step-line.is-done { background: var(--sy-action); }

.rg-panel { display: none; }
.rg-panel.is-active { display: block; animation: sy-auth-in .16s ease-out; }
@keyframes sy-auth-in { from { opacity: 0; } to { opacity: 1; } }
.rg-panel-hd { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.rg-panel-hd .sy-auth__icon { width: 40px; height: 40px; margin: 0; }
.rg-panel-hd .sy-auth__icon svg { width: 20px; height: 20px; }
.rg-panel-hd h2 { margin: 0; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; color: var(--sy-ink); }
.rg-panel-hd h2:focus { outline: none; }
.rg-panel-hd p { margin: 2px 0 0; font-size: .875rem; color: var(--sy-ink-3); }
.rg-panel .sy-field + .sy-field { margin-top: 18px; }
.rg-step-err { margin-top: 10px; }
.rg-step-err[hidden] { display: none; }

.sy-auth .rg-input-bad { border-color: var(--sy-danger) !important; }
.sy-auth .rg-input-ok { border-color: var(--sy-success); }

.rg-avail { display: flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--sy-ink-3); }
.rg-avail-ico { flex: none; font-weight: 800; }
.rg-avail--ok { color: var(--sy-success); }
.rg-avail--taken { color: var(--sy-danger); }
.rg-avail--loading .rg-avail-ico {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--sy-line-strong); border-right-color: transparent;
  animation: sy-spin .7s linear infinite;
}

.rg-strength { display: flex; align-items: center; gap: 10px; margin-top: 2px; min-height: 18px; }
.rg-strength-bar { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.rg-seg { height: 4px; border-radius: 2px; background: var(--sy-line); }
.rg-seg.lv1 { background: var(--sy-danger); }
.rg-seg.lv2 { background: var(--sy-warning); }
.rg-seg.lv3, .rg-seg.lv4 { background: var(--sy-success); }
.rg-strength-txt { flex: none; min-width: 6.5em; text-align: right; font-size: .8125rem; font-weight: 700; color: var(--sy-ink-3); }
.rg-strength-txt[data-level="1"], .rg-strength-txt[data-level="2"] { color: var(--sy-danger); }
.rg-strength-txt[data-level="3"] { color: var(--sy-warning); }
.rg-strength-txt[data-level="4"], .rg-strength-txt[data-level="5"] { color: var(--sy-success); }
.rg-match { min-height: 1.2em; font-size: .8125rem; font-weight: 600; margin: 0; }
.rg-match.is-ok { color: var(--sy-success); }
.rg-match.is-bad { color: var(--sy-danger); }

.rg-summary { border: 1px solid var(--sy-line); border-radius: var(--sy-r-sm); background: var(--sy-surface); }
.rg-sum-row {
  display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 6px 6px 6px 14px; min-height: 52px;
}
.rg-sum-row + .rg-sum-row { border-top: 1px solid var(--sy-line); }
.rg-sum-lbl { font-size: .8125rem; font-weight: 600; color: var(--sy-ink-3); }
.rg-sum-val { font-weight: 600; color: var(--sy-ink); overflow-wrap: anywhere; }

.rg-nav { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.rg-spacer { flex: 1; }
.rg-nav .sy-btn[disabled] { visibility: hidden; }
/* phones: "Précédent" + "Créer mon compte" (343px) do not fit side by side under 480px —
   stack them like .sy-auth__actions: primary action first, full width */
@media (max-width: 479px) {
  .rg-nav { flex-direction: column; align-items: stretch; }
  .rg-nav .rg-spacer, .rg-nav .sy-btn[disabled] { display: none; }
  .rg-nav .sy-btn { width: 100%; min-width: 0; white-space: normal; }
}
.sy-auth__form--wizard .sy-auth__note { margin-top: 14px; }

/* After a server-side error every step is shown at once; keep the submit button. */
.rg-show-all .rg-panel { display: block; animation: none; }
.rg-show-all .rg-panel + .rg-panel { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--sy-line); }
.rg-show-all .rg-progress,
.rg-show-all #rg-prev, .rg-show-all #rg-next,
.rg-show-all #rg-p3 .rg-panel-hd, .rg-show-all #rg-summary { display: none; }
.rg-show-all #rg-p3 .sy-auth__divider { margin-top: 0; }
.rg-show-all #rg-submit { display: inline-flex !important; }

/* ── E-mail addresses ─────────────────────────────────────────────────────── */
/* kept: swaygo.css `fieldset {…}` / `legend { text-transform: uppercase … }` (0,0,1) still outrank
   the zero-specificity :where() resets of sy.css */
.sy-auth__fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sy-auth__fieldset legend { padding: 0; margin-bottom: 10px; font-size: .9375rem; font-weight: 700; color: var(--sy-ink); text-transform: none; letter-spacing: normal; }
.sy-auth__emails { display: grid; gap: 8px; }
.sy-auth__em {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--sy-line-strong); border-radius: var(--sy-r-sm);
  background: var(--sy-surface); cursor: pointer; transition: border-color .15s, background-color .15s;
  font-size: .9375rem; font-weight: 400; color: var(--sy-ink);
}
.sy-auth__em:hover { border-color: var(--sy-ink-3); }
.sy-auth__em.is-selected, .sy-auth__em:has(input:checked) { border-color: var(--sy-action); background: var(--sy-accent-soft); }
.sy-auth__em:has(input:focus-visible) { outline: 2px solid var(--sy-focus); outline-offset: 2px; }
.sy-auth .sy-auth__em input[type=radio] {
  grid-row: span 2; width: 18px; height: 18px; margin: 0; border-radius: 50%;
  background: var(--sy-surface); border: 1.5px solid var(--sy-line-strong);
}
.sy-auth .sy-auth__em input[type=radio]:checked { background: var(--sy-action); border-color: var(--sy-action); }
.sy-auth .sy-auth__em input[type=radio]:focus-visible { box-shadow: none; outline: none; }
.sy-auth__em-addr { font-weight: 600; color: var(--sy-ink); overflow-wrap: anywhere; }
.sy-auth__em-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.sy-auth__em-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sy-auth__sep { height: 1px; background: var(--sy-line); border: 0; margin: 24px 0; }
.sy-auth__subtitle { margin: 0 0 12px; font-size: .9375rem; font-weight: 700; color: var(--sy-ink); }

/* ── Step-up OTP ──────────────────────────────────────────────────────────── */
.sy-auth .sy-auth__otp {
  text-align: center; font-size: 1.75rem; font-weight: 800; line-height: 1.2; min-height: 60px;
  letter-spacing: .35em; padding-left: calc(12px + .35em); font-variant-numeric: tabular-nums;
}
.sy-auth .sy-auth__otp::placeholder { letter-spacing: .2em; font-weight: 600; }

/* ── Delete account recap ─────────────────────────────────────────────────── */
.sy-auth__list { list-style: none; margin: 0 0 22px; padding: 0; border: 1px solid var(--sy-line); border-radius: var(--sy-r-sm); }
.sy-auth__list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; color: var(--sy-ink-2); font-size: .9375rem; }
.sy-auth__list li + li { border-top: 1px solid var(--sy-line); }
.sy-auth__list strong { color: var(--sy-ink); text-align: right; }
.sy-auth__card--danger { border-color: var(--sy-danger-line); }

/* ── allauth social / remaining account pages (socialaccount/*, signup, password set,
      reauthenticate, inactive, signup closed) ─────────────────────────────────────── */
/* provider brand mark in the card header: neutral disc so the brand colours keep their contrast */
.sy-auth__icon--brand { background: var(--sy-surface); border: 1px solid var(--sy-line-strong); color: var(--sy-ink); }
.sy-auth__icon--brand svg { width: 24px; height: 24px; }
/* provider lists rendered from {% get_providers %} (signup, connections) reuse .sy-auth__socials */
.sy-auth__providers { list-style: none; margin: 0; padding: 0; }
.sy-auth__providers > li { display: flex; min-width: 0; }
.sy-auth__providers .sy-auth__social { flex: 1 1 auto; min-width: 0; }
/* connected accounts: same selectable rows as the e-mail list */
.sy-auth__brand-badge { background: var(--sy-surface-2); color: var(--sy-ink-2); border-color: var(--sy-line); }
.sy-auth__conn .sy-auth__em-addr { overflow-wrap: anywhere; }
/* reauthentication alternatives */
.sy-auth__alts { display: grid; gap: 8px; }
/* one-line notes with a leading icon: keep the icon on the first text line when it wraps */
.sy-auth__note--nowrap { flex-wrap: nowrap; align-items: flex-start; }
.sy-auth__note--nowrap svg { margin-top: 2px; flex: none; }
