/* ==========================================================================
   Refill Marketplace — shared auth (login + signup) styles.
   Built on the Refill design-system tokens (rup-ui.css / organizations.css):
   one teal (#0bb7b5), one component set, one set of breakpoints. Self-contained
   so both pages inherit the same look and can never drift apart again.
   Light theme only.
   ========================================================================== */

:root {
  --auth-primary: #0bb7b5;
  --auth-primary-rgb: 11, 183, 181;
  --auth-primary-strong: #0a9e9c;
  --auth-ink: #202124;
  --auth-muted: #7a8089;
  --auth-line: #e7e9ed;
  --auth-surface: #ffffff;
  --auth-soft: rgba(var(--auth-primary-rgb), 0.08);
  --auth-good: #178a5b;
  --auth-warn: #b7791f;
  --auth-warn-bg: #fff6e8;
  --auth-warn-line: #f2d59a;
  --auth-danger: #b6404d;
  /* page ground: neutral with a faint teal bias so it reads chosen */
  --auth-ground: #eef4f4;
  --auth-ground-2: #e4eded;
  --auth-card: #ffffff;
  --auth-card-line: #e7e9ed;
  --auth-field-bg: #f6faf9;
  --auth-shadow: 0 18px 42px -34px rgba(22, 31, 43, 0.5);
  --auth-shadow-lift: 0 24px 60px -34px rgba(22, 31, 43, 0.55);
  --auth-font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Light theme only — the pre-auth pages commit to a single light look, so the
   palette is defined once on :root and every colour is painted explicitly. */

* { box-sizing: border-box; }

body.auth-body {
  margin: 0;
  color-scheme: light;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--auth-font);
  color: var(--auth-ink);
  background:
    radial-gradient(circle at 88% -4%, rgba(var(--auth-primary-rgb), 0.10), transparent 34%),
    linear-gradient(180deg, var(--auth-ground) 0%, var(--auth-ground-2) 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: stretch;
}

/* ---------- Hero (the .rup-hero treatment: tinted surface + glow + ring) ---------- */
.auth-hero {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(2rem, 3vw, 2.75rem);
  border: 1px solid var(--auth-card-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% 8%, rgba(var(--auth-primary-rgb), 0.20), transparent 42%),
    linear-gradient(150deg, color-mix(in srgb, var(--auth-primary) 13%, var(--auth-card)) 0%, var(--auth-card) 60%);
  box-shadow: var(--auth-shadow);
  color: var(--auth-ink);
}
.auth-hero::after {
  position: absolute;
  right: -64px;
  bottom: -84px;
  width: 220px;
  height: 220px;
  border: 32px solid rgba(var(--auth-primary-rgb), 0.09);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.auth-hero-logo { position: relative; z-index: 1; display: inline-flex; }
.auth-hero-logo img { height: 40px; width: auto; }
.auth-hero-body { position: relative; z-index: 1; margin-top: auto; }
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  color: var(--auth-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth-eyebrow::before {
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: var(--auth-primary);
  content: "";
}
.auth-hero-body h2 {
  margin: 0 0 0.7rem;
  max-width: 15ch;
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.038em;
  text-wrap: balance;
}
.auth-hero-body p {
  max-width: 40ch;
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.98rem;
  line-height: 1.65;
}
.auth-hero-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
.auth-metric {
  padding: 0.95rem 1rem;
  border: 1px solid var(--auth-card-line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--auth-card) 72%, transparent);
}
.auth-metric strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.auth-metric span {
  display: block;
  margin-top: 0.2rem;
  color: var(--auth-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---------- Card ---------- */
.auth-card {
  align-self: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(1.9rem, 2.6vw, 2.4rem);
  border: 1px solid var(--auth-card-line);
  border-radius: 22px;
  background: var(--auth-card);
  box-shadow: var(--auth-shadow-lift);
  opacity: 0;
  transform: translateY(16px);
  animation: authRise 0.5s ease-out forwards;
}
@keyframes authRise { to { opacity: 1; transform: translateY(0); } }

/* align-self keeps the logo at its intrinsic width — the card is a column
   flexbox, which would otherwise stretch the image across the full width. */
.auth-card-logo { height: 42px; width: auto; align-self: flex-start; max-width: 100%; margin-bottom: 1.1rem; }
.auth-card-eyebrow {
  color: var(--auth-primary);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.auth-card h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.auth-card h1.tight { margin-bottom: 1rem; }

/* Alerts */
.auth-alert {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1.1rem;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.45;
}
.auth-alert svg { flex: none; margin-top: 1px; }
.auth-alert.info { border: 1px solid color-mix(in srgb, var(--auth-primary) 32%, transparent); background: var(--auth-soft); color: var(--auth-ink); }
.auth-alert.info svg { color: var(--auth-primary); }
.auth-alert.warn { border: 1px solid var(--auth-warn-line); background: var(--auth-warn-bg); color: var(--auth-warn); }

/* Fields */
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.85rem; }
.auth-field { margin-bottom: 0.85rem; }
.auth-field.full { grid-column: 1 / -1; }
.auth-field label {
  display: block;
  margin-bottom: 0.42rem;
  color: var(--auth-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-control { position: relative; display: flex; align-items: center; }
.auth-control .auth-ic {
  position: absolute;
  left: 0.9rem;
  color: var(--auth-muted);
  pointer-events: none;
  display: inline-flex;
  transition: color 0.18s ease;
}
.auth-control:focus-within .auth-ic { color: var(--auth-primary); }

.auth-input,
.auth-select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--auth-line);
  border-radius: 14px;
  padding: 0.6rem 0.95rem;
  background: var(--auth-field-bg);
  color: var(--auth-ink);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.auth-control .auth-input { padding-left: 2.6rem; }
.auth-control.has-reveal .auth-input { padding-right: 2.8rem; }
.auth-input::placeholder { color: color-mix(in srgb, var(--auth-muted) 78%, transparent); }
.auth-input:focus,
.auth-select:focus {
  outline: none;
  border-color: var(--auth-primary);
  background: var(--auth-card);
  box-shadow: 0 0 0 4px var(--auth-soft);
}
.auth-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--auth-muted) 50%), linear-gradient(135deg, var(--auth-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 15px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.auth-reveal {
  position: absolute;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  color: var(--auth-muted);
  background: transparent;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.auth-reveal:hover { color: var(--auth-primary); background: var(--auth-soft); }
.auth-reveal:focus-visible { outline: 2px solid var(--auth-primary); outline-offset: 1px; }
.auth-reveal .eye-off { display: none; }
.auth-reveal.is-visible .eye-on { display: none; }
.auth-reveal.is-visible .eye-off { display: inline-flex; }

/* Helpers row */
.auth-helpers {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.4rem 0 1.1rem;
  color: var(--auth-muted);
  font-size: 0.86rem;
}
.auth-helpers input { width: 16px; height: 16px; accent-color: var(--auth-primary); cursor: pointer; }
.auth-helpers label { cursor: pointer; }

/* Buttons */
.auth-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--auth-primary);
  color: #fff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 26px -14px rgba(var(--auth-primary-rgb), 0.85);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.auth-btn-primary:hover { background: var(--auth-primary-strong); transform: translateY(-1px); box-shadow: 0 18px 30px -14px rgba(var(--auth-primary-rgb), 0.9); }
.auth-btn-primary:active { transform: translateY(0); }
.auth-btn-primary:disabled { opacity: 0.7; cursor: wait; transform: none; }

.auth-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--auth-line);
  border-radius: 14px;
  background: var(--auth-card);
  color: var(--auth-primary);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.auth-btn-ghost:hover { background: var(--auth-soft); border-color: var(--auth-primary); }

.auth-spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* Separator + footer */
.auth-sep {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.3rem 0;
  color: var(--auth-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--auth-line); }

.auth-foot { margin-top: auto; }
.auth-foot-note { margin: 0 0 0.7rem; color: var(--auth-muted); font-size: 0.9rem; }
.auth-support { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; font-size: 0.85rem; }
.auth-support a { color: var(--auth-primary); font-weight: 700; text-decoration: none; }
.auth-support a:hover { text-decoration: underline; }
.auth-signin-row { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; color: var(--auth-muted); font-size: 0.9rem; }
.auth-signin-row a { color: var(--auth-primary); font-weight: 700; text-decoration: none; }

/* Step sequence (signup) */
.auth-steps { display: flex; gap: 0.5rem; margin-bottom: 1.3rem; }
.auth-step { flex: 1; display: flex; align-items: center; gap: 0.45rem; color: var(--auth-muted); font-size: 0.74rem; font-weight: 700; }
.auth-step .num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; font-weight: 800; background: var(--auth-soft); color: var(--auth-primary); }
.auth-step.is-active { color: var(--auth-ink); }
.auth-step.is-active .num { background: var(--auth-primary); color: #fff; }

/* Toast */
.auth-toast-stack {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
}
.auth-toast {
  display: none;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--auth-card-line);
  border-left: 4px solid var(--auth-primary);
  border-radius: 12px;
  background: var(--auth-card);
  box-shadow: var(--auth-shadow-lift);
  animation: authToast 0.22s ease-out;
}
.auth-toast.show { display: flex; }
.auth-toast.toast-error { border-left-color: var(--auth-danger); }
.auth-toast.toast-warning { border-left-color: var(--auth-warn); }
.auth-toast .toast-icon { flex: none; margin-top: 1px; color: var(--auth-primary); }
.auth-toast.toast-error .toast-icon { color: var(--auth-danger); }
.auth-toast.toast-warning .toast-icon { color: var(--auth-warn); }
.auth-toast .toast-title { color: var(--auth-ink); font-weight: 800; font-size: 0.92rem; margin-bottom: 2px; }
.auth-toast .toast-message { margin: 0; color: var(--auth-muted); font-size: 0.86rem; line-height: 1.4; }
.auth-toast .toast-close { margin-left: auto; padding: 0; border: 0; background: transparent; color: var(--auth-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.auth-toast .toast-close:hover { color: var(--auth-ink); }
@keyframes authToast { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Bottom-anchored simple toast (signup) */
.auth-toast-bottom {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1040;
  max-width: 380px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--auth-ink);
  color: var(--auth-surface);
  box-shadow: var(--auth-shadow-lift);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.auth-toast-bottom.show { transform: translateY(0); opacity: 1; }
.auth-toast-bottom.error { background: var(--auth-danger); color: #fff; }

.auth-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ---------- One shared breakpoint for both pages ---------- */
@media (max-width: 820px) {
  body.auth-body { align-items: flex-start; padding: 18px 14px; }
  .auth-shell { grid-template-columns: 1fr; max-width: 480px; }
  .auth-hero { display: none; }
  .auth-card { border-radius: 16px; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-toast-stack { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; opacity: 1; transform: none; }
  .auth-btn-primary, .auth-btn-ghost, .auth-reveal, .auth-ic { transition: none; }
  .auth-spinner { animation-duration: 1.4s; }
}

/* ==========================================================================
   Page preloader — see assets/preloader.js. Kept in step with the block in
   marketplace-theme.css so the login/signup pages get the same branded spinner.
   ========================================================================== */
html:not(.mkt-ready)::before {
  content: ""; position: fixed; inset: 0; z-index: 2147483646;
  background:
    radial-gradient(circle at 88% -4%, rgba(11, 183, 181, 0.10), transparent 34%),
    linear-gradient(180deg, #eef4f4 0%, #e4eded 100%);
  animation: mkt-preload-failsafe 0.3s linear 6s forwards;
}
html:not(.mkt-ready)::after {
  content: ""; position: fixed; top: 50%; left: 50%; z-index: 2147483647;
  width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border: 3px solid rgba(11, 183, 181, 0.22); border-top-color: #0bb7b5; border-radius: 50%;
  animation: mkt-preload-spin 0.7s linear infinite, mkt-preload-failsafe 0.3s linear 6s forwards;
}
html.mkt-ready::before, html.mkt-ready::after { display: none !important; }
@keyframes mkt-preload-spin { to { transform: rotate(360deg); } }
@keyframes mkt-preload-failsafe { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  html:not(.mkt-ready)::after { animation: mkt-preload-failsafe 0.3s linear 2s forwards; }
}
