/* =========================================================================
   NoteX — design system (tokens) + login page components
   Dark mode only.
   ========================================================================= */

/* ---------------------------- design tokens ----------------------------- */

:root {
  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);

  --background: oklch(0.129 0.042 264.695);
  --foreground: oklch(0.984 0.003 247.858);
  --card: oklch(0.208 0.042 265.755);

  --primary: oklch(0.929 0.013 255.508);
  --primary-foreground: oklch(0.208 0.042 265.755);
  --primary-glow: oklch(0.66 0.17 288);

  --secondary: oklch(0.279 0.041 260.031);
  --secondary-foreground: oklch(0.984 0.003 247.858);

  --muted: oklch(0.279 0.041 260.031);
  --muted-foreground: oklch(0.704 0.04 256.788);

  --accent: oklch(0.279 0.041 260.031);
  --accent-foreground: oklch(0.984 0.003 247.858);

  --border: oklch(1 0 0 / 10%);
  --ring: oklch(0.551 0.027 264.364);

  --study: oklch(0.72 0.15 158);
  --study-foreground: oklch(0.16 0.03 158);
  --study-soft: oklch(0.24 0.04 158);

  --prepare: oklch(0.72 0.13 250);
  --prepare-foreground: oklch(0.16 0.03 250);
  --prepare-soft: oklch(0.24 0.04 250);

  --grow: oklch(0.72 0.17 300);
  --grow-foreground: oklch(0.16 0.03 300);
  --grow-soft: oklch(0.24 0.045 300);

  --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-glow));
  --gradient-surface: linear-gradient(180deg, oklch(0.22 0.045 265), oklch(0.19 0.04 265));
  --gradient-hero: radial-gradient(
    80% 60% at 50% 0%,
    color-mix(in oklab, var(--primary) 22%, transparent),
    transparent 70%
  );

  --shadow-soft: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 24px -12px oklch(0 0 0 / 0.5);
  --shadow-lift: 0 2px 4px oklch(0 0 0 / 0.3), 0 24px 48px -20px oklch(0 0 0 / 0.6);
  --shadow-glow: 0 20px 60px -24px color-mix(in oklab, var(--primary) 55%, transparent);

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

/* -------------------------------- reset ---------------------------------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border-color: var(--border); }

html {
  scroll-behavior: smooth;
  height: 100%;
  overflow: hidden; /* no page scroll on desktop or phone */
}

body {
  height: 100%;
  overflow: hidden; /* no page scroll on desktop or phone */
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.03em; text-wrap: balance; font-weight: 700; }

.container { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.hidden { display: none !important; }

/* ------------------------------ utilities -------------------------------- */

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.surface-card {
  background: var(--gradient-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-soft);
}

@keyframes notex-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.animate-rise { animation: notex-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes notex-spin { to { transform: rotate(360deg); } }
.spin { animation: notex-spin 0.8s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .animate-rise { animation: none; }
  .spin { animation: notex-spin 1.4s linear infinite; }
}

/* --------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius-xl);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  background: color-mix(in oklab, var(--primary) 92%, transparent);
}

.btn-sm { padding: 0.5rem 1rem; }
.btn-block { width: 100%; margin-top: 1.75rem; }

/* brand mark — kept because the login card head uses it (header removed) */

.brand-name { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; letter-spacing: -0.03em; }
.brand-tag { font-size: 0.75rem; font-weight: 500; color: var(--muted-foreground); }

/* ============================= LOGIN PAGE ================================ */

.login-section {
  position: relative;
  overflow: hidden;
  height: 100vh;
  padding: clamp(1rem, 4vh, 2.5rem) 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-section .hero-glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
}

.login-wrap {
  position: relative;
  width: 100%;
  max-width: 26rem;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-card {
  padding: clamp(1.25rem, 3vh, 2.5rem) clamp(1.25rem, 4vw, 2.5rem);
}

.login-card-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
  margin-bottom: clamp(1rem, 3vh, 1.75rem);
}

.brand-mark { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.brand-mark .brand-name { font-size: 1.375rem; }
.brand-mark .brand-tag { display: inline; font-size: 0.8rem; }

.login-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  text-align: center;
}

.login-sub {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted-foreground);
}
.login-sub strong { color: var(--foreground); font-weight: 600; }

.form-group { margin-top: clamp(1rem, 2.5vh, 1.5rem); }

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground);
}

.form-hint {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* text input (name field) */

.text-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-input-wrap:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 18%, transparent);
}
.text-input-wrap.error { border-color: oklch(0.6 0.2 25); }

.text-input-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.75rem;
  color: var(--muted-foreground);
}

.text-input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.85rem 1rem 0.85rem 0;
  font-size: 0.95rem;
}
.text-input::placeholder { color: var(--muted-foreground); }

/* phone input */

.phone-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.phone-input-wrap:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 18%, transparent);
}
.phone-input-wrap.error { border-color: oklch(0.6 0.2 25); }

.phone-prefix {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.875rem;
  border-right: 1px solid var(--border);
  background: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}
.prefix-flag { font-size: 1rem; }

.phone-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.phone-input::placeholder { color: var(--muted-foreground); }

/* invisible recaptcha mount point */

.recaptcha-wrap {
  display: flex;
  justify-content: center;
  min-height: 0;
  margin-top: 1rem;
}

/* otp sent confirmation pill */

.otp-sent-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--study-soft);
  color: var(--study);
  font-size: 0.78rem;
  line-height: 1.4;
}
.otp-sent-msg strong { color: var(--foreground); font-weight: 600; }

/* otp boxes */

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}
@media (min-width: 400px) { .otp-boxes { gap: 0.65rem; } }

.otp-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.otp-box:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 18%, transparent);
}
.otp-box.error { border-color: oklch(0.6 0.2 25); }

.otp-timer-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.otp-timer { color: var(--muted-foreground); }
.otp-timer strong { color: var(--foreground); }
.otp-resend {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}
.otp-resend:hover { text-decoration: underline; }

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 1rem;
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}
.btn-back:hover { color: var(--foreground); }

/* success step */

.success-icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--study-soft);
  color: var(--study);
}

#step-success .login-title,
#step-success .login-sub { text-align: center; }

/* alerts */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  line-height: 1.4;
}
.alert svg { flex-shrink: 0; margin-top: 0.1rem; }
.alert-error {
  background: color-mix(in oklab, oklch(0.6 0.2 25) 10%, transparent);
  color: oklch(0.5 0.22 25);
  border: 1px solid color-mix(in oklab, oklch(0.6 0.2 25) 25%, transparent);
}

.card-footer-note {
  margin-top: clamp(1rem, 3vh, 1.75rem);
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}
.card-footer-note a { color: var(--primary); font-weight: 500; }
.card-footer-note a:hover { text-decoration: underline; }

/* promo / teaser card */

.promo-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
}
.promo-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-xl);
  background: var(--grow-soft);
  color: var(--grow);
  font-size: 1.15rem;
}
.promo-card strong { display: block; font-size: 0.875rem; font-weight: 600; }
.promo-card span { display: block; margin-top: 0.15rem; font-size: 0.78rem; color: var(--muted-foreground); }

/* small screens — shrink card further so it still fits without scrolling */
@media (max-width: 380px), (max-height: 700px) {
  .login-card { padding: 1.1rem 1rem; }
  .login-card-head { margin-bottom: 0.75rem; gap: 0.5rem; }
  .form-group { margin-top: 0.85rem; }
  .otp-box { font-size: 1rem; }
  .login-title { font-size: 1.25rem; }
  .login-sub { font-size: 0.8rem; }
}

/* very short viewports (landscape phones) */
@media (max-height: 560px) {
  .login-section { align-items: center; padding: 0.5rem 1.25rem; }
  .login-wrap { gap: 0.6rem; }
  .promo-card { display: none; } /* drop the teaser card first to reclaim vertical space */
}

/* accessibility */
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}