/*
 * Energy Healing — auth action handler styles.
 *
 * Design tokens, palette, type scale, shadows and radii are
 * lifted verbatim from the marketing site at
 * backend/php/index.html so the auth page reads as the same
 * product. The marketing site itself sampled these tokens from
 * the iOS app's AppTheme.swift, making the iOS app, the
 * marketing site, and this page one design system.
 *
 * Layout:
 *   - Animated blurred gradient blobs drift behind the card
 *     (purely decorative, respects prefers-reduced-motion).
 *   - Glassy brand header pins to the top.
 *   - The card itself floats centered in the remaining
 *     viewport with a tall shadow, mirroring the marketing
 *     site's elevation language.
 *
 * Dark-mode tokens are wired so the page automatically adapts
 * to prefers-color-scheme: dark, identical to the marketing
 * site.
 */

/* ── design tokens ──────────────────────────────────────────── */

:root {
  --bg:              #F0EFF5;
  --bg-elev:         #FFFFFF;
  --bg-soft:         #F7F5FB;
  --ink:             #15131E;
  --ink-soft:        #4F4C5A;
  --ink-muted:       #8A8794;
  --line:            rgba(140, 102, 217, 0.14);
  --line-strong:     rgba(140, 102, 217, 0.28);
  --purple:          #8C66D9;
  --purple-dark:     #6E48BF;
  --blue:            #5999E5;
  --gradient:        linear-gradient(135deg, var(--purple) 0%, var(--blue) 100%);
  --gradient-soft:   linear-gradient(135deg, rgba(140,102,217,0.10), rgba(89,153,229,0.10));
  --shadow-sm:       0 1px 2px rgba(28, 27, 34, 0.06), 0 1px 1px rgba(28, 27, 34, 0.04);
  --shadow:          0 8px 28px rgba(34, 28, 56, 0.08), 0 2px 6px rgba(34, 28, 56, 0.04);
  --shadow-lg:       0 20px 60px rgba(34, 28, 56, 0.12), 0 4px 12px rgba(34, 28, 56, 0.06);
  --radius-sm:       10px;
  --radius:          18px;
  --radius-lg:       28px;
  --transition:      cubic-bezier(0.16, 1, 0.3, 1);
  --success:         #2A9D5C;
  --danger:          #C8364B;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #15131E;
    --bg-elev:     #1F1C2A;
    --bg-soft:     #1A1825;
    --ink:         #F4F2FB;
    --ink-soft:    #B8B4C8;
    --ink-muted:   #6E6A7C;
    --line:        rgba(140, 102, 217, 0.20);
    --line-strong: rgba(140, 102, 217, 0.36);
    --shadow-sm:   0 1px 2px rgba(0,0,0,0.40);
    --shadow:      0 8px 28px rgba(0,0,0,0.50);
    --shadow-lg:   0 20px 60px rgba(0,0,0,0.60);
  }
}

/* ── reset + base ───────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter',
               'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* ── animated background blobs ──────────────────────────────── */

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  will-change: transform;
}
.blob.b1 {
  width: 620px; height: 620px;
  top: -180px; left: -160px;
  background: radial-gradient(circle at 30% 30%, var(--purple), transparent 70%);
  animation: drift1 22s ease-in-out infinite alternate;
}
.blob.b2 {
  width: 540px; height: 540px;
  top: 30%; right: -180px;
  background: radial-gradient(circle at 70% 30%, var(--blue), transparent 70%);
  animation: drift2 26s ease-in-out infinite alternate;
}
.blob.b3 {
  width: 480px; height: 480px;
  bottom: -120px; left: 30%;
  background: radial-gradient(circle at 50% 50%, var(--purple), transparent 70%);
  opacity: 0.35;
  animation: drift3 30s ease-in-out infinite alternate;
}
@keyframes drift1 { from { transform: translate(0, 0); } to { transform: translate(40px, 60px); } }
@keyframes drift2 { from { transform: translate(0, 0); } to { transform: translate(-50px, 40px); } }
@keyframes drift3 { from { transform: translate(0, 0); } to { transform: translate(60px, -40px); } }
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none !important; }
}

/* ── glassy brand header ────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-row {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(20px, 4vw, 32px);
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

/* Language toggle in the header */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang-switcher button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.lang-switcher button[aria-pressed="true"] {
  background: var(--bg-elev);
  color: var(--purple-dark);
  box-shadow: var(--shadow-sm);
}
@media (prefers-color-scheme: dark) {
  .lang-switcher button[aria-pressed="true"] { color: #C9B6F4; }
}

/* ── page layout ────────────────────────────────────────────── */

#app {
  min-height: calc(100dvh - 70px); /* header height */
  display: grid;
  place-items: center;
  padding: clamp(24px, 6vw, 56px) clamp(20px, 4vw, 32px);
}

/* ── card ───────────────────────────────────────────────────── */

.card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: clamp(32px, 5vw, 48px) clamp(24px, 4vw, 40px);
  text-align: center;
  position: relative;
}

.logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  display: block;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

/* Eyebrow pill — small uppercase label above the headline.
   Mirrors the marketing site's section eyebrow style. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--gradient-soft);
  color: var(--purple-dark);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
  border: 1px solid var(--line-strong);
}
@media (prefers-color-scheme: dark) {
  .eyebrow { color: #C9B6F4; }
}
.eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 0 4px rgba(140, 102, 217, 0.18);
}

.headline {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.subhead {
  margin: 0 auto 24px;
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 36ch;
}

.subhead strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── form ───────────────────────────────────────────────────── */

.form {
  text-align: left;
  margin-top: 8px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: -0.005em;
}

.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 16px; /* 16px prevents iOS Safari zoom-on-focus */
  font-family: inherit;
  color: var(--ink);
  background: var(--bg-soft);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--purple);
  background: var(--bg-elev);
  box-shadow: 0 0 0 4px rgba(140, 102, 217, 0.12);
}

.field .hint {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.78;
  margin-top: 6px;
}

.field-error {
  display: block;
  font-size: 0.88rem;
  color: var(--danger);
  margin: 12px 0 0;
  min-height: 1.2em;
  text-align: center;
}

/* ── buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--transition), box-shadow 0.15s var(--transition), opacity 0.15s;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
  -webkit-appearance: none;
  letter-spacing: -0.005em;
}

.btn-primary {
  background: var(--gradient);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(140, 102, 217, 0.34);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(140, 102, 217, 0.42);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 6px 20px rgba(140, 102, 217, 0.20);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  margin-top: 10px;
}

.btn-secondary:hover { background: var(--bg-soft); }

/* Stack of buttons inside the card */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* ── status icon (success / error) ──────────────────────────── */

.status-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

.status-icon.success {
  background: rgba(42, 157, 92, 0.12);
  color: var(--success);
  box-shadow: 0 0 0 6px rgba(42, 157, 92, 0.06);
}

.status-icon.error {
  background: rgba(200, 54, 75, 0.10);
  color: var(--danger);
  box-shadow: 0 0 0 6px rgba(200, 54, 75, 0.05);
}

/* ── spinner (mid-action loading) ───────────────────────────── */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(140, 102, 217, 0.18);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 16px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .pre-spinner { animation: none; }
}

/* ── card footer (legal-ish micro-copy) ─────────────────────── */

.card-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.card-foot a {
  color: var(--purple-dark);
  text-decoration: none;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  .card-foot a { color: #C9B6F4; }
}
.card-foot a:hover { text-decoration: underline; }

/* ── accessibility ──────────────────────────────────────────── */

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

/* Hide the marketing-only brand label on extreme-small screens
   so it doesn't crowd the language switcher. */
@media (max-width: 380px) {
  .brand span { display: none; }
}
