/* StudyBuddy native funnel — shared styles.
   Tokens and type mirror landing/index.html so the funnel reads as one product.
   Real DOM inputs here (unlike the Flutter canvas) so password managers fill
   natively — the reason this funnel is native. See DECISIONS 2026-07-25. */

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

/* Colour tokens (light AND dark) live in theme.css, which every funnel page
   links ahead of this file — same set the marketing page uses, so the funnel
   and the study app agree in both themes. `color-scheme` is set there too,
   which is what keeps the UA widgets (notably the autofill background on the
   --field-bg inputs) from fighting the surface they sit on. */

html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ─── Layout: centered card, matching the Flutter funnel's narrow column ─── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4rem 1.25rem 3rem;
}
.auth-card { width: 100%; max-width: 420px; }

/* Wordmark + underline, from the landing logo treatment */
.logo { display: inline-block; text-decoration: none; }
.wordmark {
  font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.5px; line-height: 1;
  text-decoration: none;
}
.wordmark em { font-style: italic; color: var(--indigo-text); }
.wordmark-underline {
  width: 100%; height: 2.5px; background: var(--indigo);
  border-radius: 2px; margin-top: 10px; opacity: 0.9;
}

.auth-headline {
  font-family: 'Lora', serif; font-size: 30px; line-height: 1.2;
  font-weight: 600; letter-spacing: -0.4px; color: var(--ink);
  margin: 1.75rem 0 1.5rem;
}

/* ─── Segmented Sign in / Sign up toggle ─── */
.seg {
  display: flex; background: var(--bg3); border-radius: 100px;
  padding: 4px; margin-bottom: 1.25rem;
}
.seg a {
  flex: 1; text-align: center; padding: 10px 0; border-radius: 100px;
  font-size: 14px; font-weight: 500; color: var(--ink3);
  text-decoration: none; transition: all 0.18s;
}
.seg a[aria-current="page"] {
  background: var(--seg-active); color: var(--ink);
  box-shadow: var(--shadow-seg);
}

/* ─── Fields (REAL inputs — the whole point) ─── */
.field { position: relative; margin-bottom: 14px; }
.field .icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--ink3); pointer-events: none;
}
.field input {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--field-bg); border: 1px solid transparent;
  border-radius: 14px; padding: 16px 16px 16px 46px;
  transition: border-color 0.15s, background 0.15s;
}
.field input::placeholder { color: var(--ink3); }
.field input:focus {
  outline: none; border-color: var(--indigo); background: var(--card);
}
.field input:disabled { opacity: 0.6; cursor: not-allowed; }

.field-hint { font-size: 12px; color: var(--ink3); margin: -4px 2px 14px; }

/* ─── Buttons ─── */
.btn {
  width: 100%; font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 15px; border-radius: 100px; border: none; cursor: pointer;
  transition: all 0.18s; display: flex; align-items: center;
  justify-content: center; gap: 10px;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover:not(:disabled) { background: var(--ink-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Generic secondary button on the raised surface (redemption code, cancel
   subscription). NOT the OAuth vendor buttons — those are below. */
.btn-oauth {
  background: var(--card); color: var(--ink); border: 1px solid var(--border);
  font-weight: 500;
}
.btn-oauth:hover { border-color: var(--border-strong); }
.btn-oauth .prov-icon { width: 18px; height: 18px; }

/* ─── OAuth buttons: vendor-fixed colours, deliberately NOT tokens ───
   Google and Apple both specify these exactly and they must not drift with our
   palette. Google: fill/text/stroke per the Identity branding guidelines.
   Apple: ASAuthorizationAppleIDButton.Style semantics — .black on a light
   background, .white on a dark one, no custom fills. Same values as
   _GoogleBrand / _AppleBrand in lib/screens/sign_in_screen.dart; if one side
   changes, change both. Google's dark fill sits ~1:1 against our dark page on
   purpose — the stroke is what defines the button, exactly as in light mode. */
.btn-oauth.google { background: #FFFFFF; color: #1F1F1F; border-color: #747775; }
.btn-oauth.google:hover { border-color: #1F1F1F; }
.btn-oauth.apple { background: #000000; color: #FFFFFF; border-color: #000000; }

:root[data-theme="dark"] .btn-oauth.google {
  background: #131314; color: #E3E3E3; border-color: #8E918F;
}
:root[data-theme="dark"] .btn-oauth.google:hover { border-color: #E3E3E3; }
:root[data-theme="dark"] .btn-oauth.apple {
  background: #FFFFFF; color: #000000; border-color: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-oauth.google {
    background: #131314; color: #E3E3E3; border-color: #8E918F;
  }
  :root:not([data-theme="light"]) .btn-oauth.google:hover { border-color: #E3E3E3; }
  :root:not([data-theme="light"]) .btn-oauth.apple {
    background: #FFFFFF; color: #000000; border-color: #FFFFFF;
  }
}

.link-btn {
  display: block; width: 100%; text-align: center; background: none;
  border: none; font-family: inherit; font-size: 14px; color: var(--ink3);
  cursor: pointer; padding: 12px; text-decoration: none;
}
.link-btn:hover { color: var(--ink); }
.link-inline { color: var(--indigo); font-weight: 600; text-decoration: none; }
.link-inline:hover { text-decoration: underline; }

.forgot { text-align: right; margin: -6px 2px 14px; }
.forgot a { font-size: 13px; color: var(--ink3); text-decoration: none; }
.forgot a:hover { color: var(--ink); }

/* ─── Divider ─── */
.divider {
  display: flex; align-items: center; gap: 14px;
  margin: 18px 0; color: var(--ink3); font-size: 12px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.stack { display: flex; flex-direction: column; gap: 10px; }

/* ─── Feedback ─── */
.alert {
  font-size: 13px; line-height: 1.5; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px;
}
.alert-error { background: var(--alert-error-bg); color: var(--alert-error-fg); }
.alert-info { background: var(--alert-info-bg); color: var(--alert-info-fg); }
.alert[hidden] { display: none; }

/* Spinner inside buttons. Rides the button's own text colour so it works on
   the primary button (which inverts with the theme) and on the vendor
   buttons (which don't) without a per-button rule. */
.spin {
  width: 18px; height: 18px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.foot-note { text-align: center; font-size: 13px; color: var(--ink3); margin-top: 16px; }

.secondary-card {
  margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .btn-primary:hover:not(:disabled) { transform: none; }
}

@media (max-width: 460px) {
  .auth-shell { padding-top: 2.5rem; }
  .auth-headline { font-size: 26px; }
}
