/* ============================================================
   ExamPilot AI - Auth Pages Styles (Signup / Verify / Login)
   Matches welcome.css: Linear-inspired premium dark theme
   ============================================================ */

:root {
  --bg: #08090a;
  --panel: #0f1011;
  --surface: #191a1b;
  --surface-2: #28282c;
  --text-1: #f7f8f8;
  --text-2: #d0d6e0;
  --text-3: #8a8f98;
  --text-4: #62666d;
  --brand: #5e6ad2;
  --accent: #7170ff;
  --accent-hover: #828fff;
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --green: #27a644;
  --emerald: #10b981;
  --red: #f87171;
  --radius: 8px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

body {
  font-family: var(--font);
  font-feature-settings: 'cv01', 'ss03';
  background: var(--bg);
  color: var(--text-2);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
}

::selection { background: rgba(113, 112, 255, 0.3); color: #fff; }

/* ---------- Ambient background (shared with welcome) ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 75%);
  pointer-events: none;
}

#vanta-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Auth shell (split screen) ---------- */
.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 45% 55%;
  min-height: 100vh;
}

/* --- Left brand panel --- */
.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  background: rgba(15, 16, 17, 0.6);
  border-right: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  width: fit-content;
}

.auth-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(113, 112, 255, 0.35);
}

.auth-brand-mark svg { width: 18px; height: 18px; }

.auth-brand-text {
  color: var(--text-1);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.auth-brand-text span { color: var(--accent); }

.auth-copy { margin: 48px 0; }

.auth-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
}

.auth-copy h1 {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--text-1);
  margin-bottom: 16px;
}

.auth-copy p {
  font-size: 15px;
  color: var(--text-3);
  line-height: 1.65;
  max-width: 420px;
}

.auth-highlights {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-highlight {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 110px;
}

.auth-highlight strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.auth-highlight span {
  font-size: 12px;
  color: var(--text-4);
}

/* --- Right form panel --- */
.auth-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-card-inner {
  width: 100%;
  max-width: 420px;
}

.auth-card-heading { margin-bottom: 32px; }

.auth-card-heading h2 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 8px;
}

.auth-card-heading span {
  font-size: 14px;
  color: var(--text-3);
}

/* ---------- Form fields ---------- */
.auth-form { display: flex; flex-direction: column; gap: 20px; }

/* The `hidden` attribute must always win over display rules (e.g.
   .auth-form { display:flex } would otherwise keep hidden steps
   visible - the "Sending…" stuck button bug, Aug 7 2026). */
[hidden] { display: none !important; }

.field-group { display: flex; flex-direction: column; gap: 8px; }

.field-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field-group input {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-group input::placeholder { color: var(--text-4); }

.field-group select.select-input {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  cursor: pointer;
}

.field-group select.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(113, 112, 255, 0.15);
}

.field-group select.select-input option {
  background: var(--surface);
  color: var(--text-1);
}

.field-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(113, 112, 255, 0.15);
}

.field-group input.invalid {
  border-color: rgba(248, 113, 113, 0.6);
}

.field-hint {
  font-size: 12px;
  color: var(--text-4);
}

.field-hint.error { color: var(--red); }
.field-hint.ok { color: var(--emerald); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: none;
  font-feature-settings: 'cv01', 'ss03';
  width: 100%;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset, 0 4px 20px rgba(94, 106, 210, 0.25);
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
  border: 1px solid rgb(36, 40, 44);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-1); }

/* ---------- Alerts ---------- */
.alert {
  display: none;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.alert.show { display: block; }

.alert-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* ---------- reCAPTCHA placeholder ---------- */
.recaptcha-wrap { display: flex; flex-direction: column; gap: 8px; }

.recaptcha-placeholder {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-4);
  background: rgba(255, 255, 255, 0.01);
}

/* ---------- Switch link ---------- */
.switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}

.switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.switch a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Verify OTP specific ---------- */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.otp-inputs input {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  padding: 14px 0;
  letter-spacing: 0.1em;
}

.resend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  padding: 4px 0;
  text-decoration: none;
}

.resend-btn:hover { color: var(--accent-hover); text-decoration: underline; }

.resend-btn:disabled {
  color: var(--text-4);
  cursor: not-allowed;
  text-decoration: none;
}

.countdown {
  font-size: 12px;
  color: var(--text-4);
  font-family: var(--mono);
}

.verify-steps {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.verify-step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.verify-step span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

.verify-step strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 24px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .auth-copy { margin: 32px 0; }
  .auth-copy h1 { font-size: 28px; }
  .auth-card { padding: 32px 24px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .auth-highlights { flex-direction: column; }
}

/* ============================================================
   LOGIN PAGE - Premium centered admin console card
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #08090a;
  padding: 24px;
}

/* Static subtle background (no Vanta - welcome screen only) */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 40%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 40%, black 20%, transparent 75%);
}

.login-glow {
  position: absolute;
  width: 560px;
  height: 560px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(94, 106, 210, 0.13) 0%, transparent 65%);
  filter: blur(30px);
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-card {
  width: 100%;
  background: rgba(15, 16, 17, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 24px 70px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.login-card-head {
  text-align: center;
  margin-bottom: 26px;
}

.login-card-head .auth-brand {
  justify-content: center;
  margin-bottom: 22px;
}

.login-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-4);
}

.login-card .auth-form {
  width: 100%;
  margin: 0;
}

/* Input with leading icon + optional trailing toggle */
.input-wrap {
  position: relative;
}

.input-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-4);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  padding-left: 38px;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-4);
  cursor: pointer;
  padding: 6px;
  border-radius: 5px;
  display: flex;
  align-items: center;
}

.password-toggle svg { width: 16px; height: 16px; }

.password-toggle:hover { color: var(--text-2); background: rgba(255, 255, 255, 0.04); }

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 18px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-3);
  user-select: none;
}

.remember input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.login-forgot {
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
}

.login-forgot:hover { color: var(--text-1); }

.login-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 14.5px;
  margin-top: 4px;
}

.login-btn svg { width: 16px; height: 16px; }

.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-4);
}

.login-foot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green, #10b981);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.login-back {
  margin-top: 20px;
  font-size: 13px;
}

.login-back a {
  color: var(--text-4);
  text-decoration: none;
}

.login-back a:hover { color: var(--text-2); }

/* ============================================================
   Passwordless OTP login - Aug 7 2026
   ============================================================ */
.otp-timer {
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}

.otp-timer strong {
  color: var(--text-1);
  font-family: var(--mono, 'JetBrains Mono', monospace);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.otp-row {
  justify-content: space-between;
  margin: 14px 0 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.12s ease;
}

.link-btn:hover:not(:disabled) { color: var(--text-1); }

.link-btn:disabled {
  color: var(--text-4);
  cursor: default;
}

#otpInput {
  font-size: 20px;
  letter-spacing: 0.5em;
  font-family: var(--mono, 'JetBrains Mono', monospace);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#otpInput::placeholder { letter-spacing: 0.3em; }
