/* ── Sign in / Create account ─────────────────────────────────────────────
   One stylesheet for both auth pages, on the same palette and the same
   controls as the app behind them: signing in should not look like a
   different product from the one it opens.                                */

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

:root {
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --primary:   #6366f1;
  --primary-2: #8b5cf6;
  --danger:    #ef4444;
  --radius:    14px;
  --radius-md: 10px;

  /* Light */
  --bg:        #f4f4f7;
  --bg-glow:   radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.14), transparent 70%);
  --card:      #ffffff;
  --field:     #f4f4f6;
  --field-on:  #ffffff;
  --border:    rgba(0,0,0,.10);
  --border-2:  rgba(0,0,0,.16);
  --text:      #16161a;
  --text-sec:  #4a4a52;
  --text-mut:  #6e6e78;
  --shadow:    0 20px 50px rgba(16,16,26,.10);
}

/* The app remembers a theme; the door to it should too. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       #0a0a0f;
    --bg-glow:  radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.22), transparent 70%);
    --card:     #14141d;
    --field:    rgba(255,255,255,.05);
    --field-on: rgba(255,255,255,.08);
    --border:   rgba(255,255,255,.10);
    --border-2: rgba(255,255,255,.20);
    --text:     #f4f4f5;
    --text-sec: #c3c3ca;
    --text-mut: #8b8b96;
    --shadow:   0 20px 50px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --bg:       #0a0a0f;
  --bg-glow:  radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.22), transparent 70%);
  --card:     #14141d;
  --field:    rgba(255,255,255,.05);
  --field-on: rgba(255,255,255,.08);
  --border:   rgba(255,255,255,.10);
  --border-2: rgba(255,255,255,.20);
  --text:     #f4f4f5;
  --text-sec: #c3c3ca;
  --text-mut: #8b8b96;
  --shadow:   0 20px 50px rgba(0,0,0,.45);
}

body {
  font-family: var(--font);
  background: var(--bg-glow), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
}

/* ── The card ── */
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: var(--shadow);
}

/* ── Brand ── */
.auth-brand { text-align: center; margin-bottom: 1.6rem; }
.auth-brand .logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 15px; margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 22px rgba(99,102,241,.35);
}
.auth-brand .logo-mark svg {
  width: 27px; height: 27px; fill: none;
  stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.auth-brand h1 {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -.4px;
  color: var(--text); margin-bottom: .3rem;
}
.auth-brand p { font-size: .9rem; color: var(--text-mut); }

/* ── Errors: say what went wrong, where you can see it ── */
.error-area {
  display: flex; gap: .55rem; align-items: flex-start;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-md);
  padding: .7rem .85rem; margin-bottom: 1.1rem;
  font-size: .85rem; line-height: 1.45; color: var(--danger);
}
.error-area::before { content: "!"; font-weight: 800; flex-shrink: 0; }
.error-area ul { margin: 0; padding-left: 1.1rem; }
.error-area li { margin-bottom: .2rem; }
.error-area[hidden] { display: none; }

/* ── Fields ── */
.form-field { margin-bottom: 1rem; }
.form-field label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--text-sec); margin-bottom: .4rem;
}
.form-field input {
  width: 100%; height: 48px; padding: 0 1rem;
  /* 16px keeps iOS from zooming the page when the field takes focus. */
  font-size: 16px; font-family: inherit; color: var(--text);
  background: var(--field);
  border: 1.5px solid transparent; border-radius: var(--radius-md);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.form-field input::placeholder { color: var(--text-mut); }
.form-field input:hover { border-color: var(--border); }
.form-field input:focus {
  background: var(--field-on);
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}

/* ── Password reveal ── */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 3.25rem; }
.password-toggle {
  position: absolute; top: 50%; right: .35rem; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: transparent; border: none; border-radius: 10px;
  color: var(--text-mut); cursor: pointer;
  transition: color .15s, background .15s;
}
.password-toggle:hover { color: var(--text); background: var(--field); }
.password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle svg[hidden] { display: none; }

/* ── Submit ── */
.btn-primary, .btn-primary.full {
  width: 100%; min-height: 48px; margin-top: .5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: .95rem; font-weight: 600; font-family: inherit;
  border: none; border-radius: var(--radius-md); cursor: pointer;
  box-shadow: 0 6px 18px rgba(99,102,241,.32);
  transition: filter .15s, transform .1s, box-shadow .15s;
}
.btn-primary:hover:not(:disabled)  { filter: brightness(1.06); }
.btn-primary:active:not(:disabled) { transform: scale(.99); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ── Footer ── */
.auth-footer {
  text-align: center; margin-top: 1.4rem;
  font-size: .875rem; color: var(--text-mut);
}
.auth-footer a {
  /* A link people are meant to tap gets a finger-sized box, not a text row. */
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .4rem;
  color: var(--primary); text-decoration: none; font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* ── Small screens: the card becomes the page ── */
@media (max-width: 480px) {
  main { padding: 1.25rem .9rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
  .auth-card { padding: 1.5rem 1.25rem 1.35rem; border-radius: 16px; }
  .auth-brand { margin-bottom: 1.35rem; }
  .auth-brand h1 { font-size: 1.4rem; }
}
@media (max-width: 360px) {
  .auth-card { padding: 1.25rem 1rem 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
