/* auth.css — shared login/register page: the full festival-gradient welcome.
   Old variable names stay so every rule below keeps working. */

:root {
  --forest: #5b21b6;
  --forest-deep: #3b0764;
  --cream: #faf7ff;
  --amber: #f97316;
  --amber-dark: #ea580c;
  --sage: #f3e8ff;
  --ink: #241b35;
  --muted: #776d91;
  --line: #e9e2f4;
  --danger: #e11d48;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
  min-height: 100vh;
}

/* Left: mission panel — the festival gradient in full */
.auth-side {
  background:
    radial-gradient(42rem 26rem at 0% 0%, rgba(13, 148, 136, 0.5), transparent 55%),
    radial-gradient(36rem 22rem at 100% 20%, rgba(236, 72, 153, 0.45), transparent 60%),
    radial-gradient(30rem 20rem at 40% 110%, rgba(249, 115, 22, 0.5), transparent 60%),
    linear-gradient(160deg, #3b0764 0%, #6d28d9 50%, #a21caf 100%);
  color: #fdf3ff;
  display: flex;
  align-items: center;
  padding: 3rem;
}

.side-inner {
  max-width: 30rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  margin-bottom: 2.5rem;
}

.side-headline {
  font-family: "Playfair Display", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.side-copy {
  color: #f0dffc;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.side-points {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.side-points li {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.6rem;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  backdrop-filter: blur(3px);
}

/* Right: form panel */
.auth-panel {
  background: #fff;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--cream);
  border-radius: 0.7rem;
  padding: 0.3rem;
  margin-bottom: 2rem;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  padding: 0.65rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--forest);
  color: #fff;
}

.auth-form h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

.auth-form label,
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
}

.auth-form input,
.auth-form select {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s;
}

.auth-form input:focus,
.auth-form select:focus {
  outline: none;
  border-color: var(--forest);
}

.auth-form input[readonly] {
  background: var(--cream);
  color: var(--muted);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.role-card {
  border: 1.5px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.9rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.role-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-card:has(input:checked) {
  border-color: var(--forest);
  background: var(--sage);
}

.role-emoji {
  font-size: 1.5rem;
}

.role-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.geo-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.6rem;
  align-items: end;
}

.geo-field label {
  margin-top: 0.9rem;
}

.btn-primary {
  width: 100%;
  margin-top: 1.5rem;
  background: linear-gradient(115deg, #f97316 0%, #ec4899 100%);
  color: #fff;
  border: none;
  font: inherit;
  font-weight: 700;
  padding: 0.85rem;
  border-radius: 0.6rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(236, 72, 153, 0.35);
  transition: box-shadow 0.15s, transform 0.1s, filter 0.15s;
}

.btn-primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 11px 28px rgba(236, 72, 153, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-ghost {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--sage);
  color: var(--forest);
  border: 1.5px solid var(--forest);
  border-radius: 0.55rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-ghost:hover {
  background: #c4ecca;
}

.auth-error {
  margin-top: 1.25rem;
  background: #fdecec;
  color: var(--danger);
  border: 1px solid #f5c2c2;
  border-radius: 0.55rem;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 840px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-side {
    padding: 2rem 1.5rem;
  }

  .auth-panel {
    padding: 2rem 1.5rem;
  }
}

/* NGO extra: non-veg opt-in checkbox */
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}
.check-line input {
  width: auto;
  margin: 0;
}

/* Optional-field hint on the referral input */
.optional-tag {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Verification (KYC) fieldset on register */
.verify-fieldset {
  margin-top: 1.2rem;
  border: 1.5px dashed var(--forest);
  border-radius: 0.8rem;
  padding: 0.4rem 1rem 1rem;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.05), transparent);
}

.verify-fieldset legend {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--forest);
  padding: 0 0.4rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 0.4rem;
}

.auth-form input[type="file"] {
  padding: 0.5rem;
  font-size: 0.85rem;
  border-style: dashed;
  cursor: pointer;
}

/* Links under the login form (forgot password / admin console) */
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
  font-size: 0.85rem;
}

.auth-links a {
  color: var(--forest);
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ===========================================================================
   Dark theme — the mission side keeps its festival gradient; the form panel
   and its controls darken against the shared --fr tokens.
   =========================================================================== */
:root[data-theme="dark"] {
  --muted: #a297c2;
  --line: #322a4f;
  --amber: #fb923c;
  --amber-dark: #f97316;
  --sage: #2c2350;
}
:root[data-theme="dark"] body { background: var(--fr-page); color: var(--fr-ink); }
:root[data-theme="dark"] .auth-side {
  background:
    radial-gradient(42rem 26rem at 0% 0%, rgba(15, 118, 110, 0.4), transparent 55%),
    radial-gradient(36rem 22rem at 100% 20%, rgba(190, 24, 93, 0.35), transparent 60%),
    linear-gradient(160deg, #1d0f38 0%, #3b1878 50%, #701a75 100%);
}
:root[data-theme="dark"] .auth-panel { background: var(--fr-surface); color: var(--fr-ink); }
:root[data-theme="dark"] .tabs { background: var(--fr-surface-2); }
:root[data-theme="dark"] .tab { color: var(--muted); }
:root[data-theme="dark"] .auth-form h2 { color: var(--fr-ink); }
:root[data-theme="dark"] .auth-form input,
:root[data-theme="dark"] .auth-form select { background: var(--fr-surface-2); color: var(--fr-ink); border-color: var(--line); }
:root[data-theme="dark"] .auth-form input[readonly] { background: #171129; color: var(--muted); }
:root[data-theme="dark"] .role-card { border-color: var(--line); }
:root[data-theme="dark"] .role-card:has(input:checked) { background: #33174b; border-color: var(--fr-brand-2); }
:root[data-theme="dark"] .role-name { color: var(--fr-ink); }
:root[data-theme="dark"] .btn-ghost { background: #33174b; color: var(--fr-brand-2); border-color: var(--fr-brand-2); }
:root[data-theme="dark"] .btn-ghost:hover { background: #3d1c59; }
:root[data-theme="dark"] .auth-error { background: #3a1e1e; color: #f87171; border-color: #5c2a2a; }
:root[data-theme="dark"] .verify-fieldset { border-color: var(--fr-brand-2); background: rgba(124, 58, 237, 0.09); }
:root[data-theme="dark"] .verify-fieldset legend { color: var(--fr-brand-2); }
:root[data-theme="dark"] .auth-links a { color: var(--fr-brand-2); }

/* Signup email-OTP verification */
.email-verify-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.45rem 0 0.2rem; }
.email-verified-badge { font-size: 0.82rem; font-weight: 700; color: #059669; }
:root[data-theme="dark"] .email-verified-badge { color: #34d399; }

/* Signup OTP input — big, spaced digits like a real verification field */
#reg-otp {
  letter-spacing: 0.45em;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Phone-first: brand strip stays compact so the form is immediately visible */
@media (max-width: 640px) {
  .auth-side { padding: 1.4rem 1.25rem 1.2rem; }
  .side-headline { font-size: clamp(1.45rem, 6.5vw, 1.9rem); margin: 0.4rem 0; }
  .side-copy { font-size: 0.88rem; margin-bottom: 0.4rem; }
  .side-points { display: none; }   /* the pitch lives on; the form comes first */
  .auth-panel { padding: 1.4rem 1.1rem 2rem; }
  .role-grid { gap: 0.5rem; }
  .geo-row { grid-template-columns: 1fr 1fr; }
  .geo-row .btn-ghost { grid-column: 1 / -1; }
}
