/* ─── TOKENS – LIGHT (Trắng hồng sữa) ─── */
:root {
  --bg: #FEF2F6;           /* hồng sữa nhạt */
  --surface: #FFFFFF;
  --card: rgba(255,255,255,0.96);
  --card-border: rgba(216,100,180,0.18);
  --ink: #1A0A14;
  --muted: #7A5868;
  --line: #F0D8E8;
  --gold: #C05090;
  --gold-light: #D060A0;
  --gold-faint: rgba(192,80,144,0.08);
  --purple: #9B3EBE;
  --purple-light: #B55ED4;
  --purple-faint: rgba(155,62,190,0.08);
  --cyan: #0891B2;
  --green: #059669;
  --red: #DC2626;
  --btn-primary-bg: linear-gradient(135deg,#C44FAC 0%,#9B3EBE 50%,#7C3AED 100%);
  --btn-primary-hover: linear-gradient(135deg,#B03A9A 0%,#8B30AA 100%);
  --btn-primary-fg: #FFFFFF;
  --field-bg: #FFF8FC;
  --field-label: #2A0E1E;
  --focus-ring: rgba(196,79,172,0.18);
  --soft-shadow: rgba(80,10,40,0.08);
  --shadow-card: 0 4px 16px rgba(80,10,40,0.06), 0 24px 64px rgba(80,10,40,0.10);
  --shadow-btn: 0 4px 20px rgba(196,79,172,0.30);
  --timer-bg: #FDF2FA;
  --resend-bg: #F0FDF4;
  --resend-hover: #DCFCE7;
  --resend-border: #86EFAC;
  --resend-border-hover: #22C55E;
  --resend-icon-bg: #BBF7D0;
  --warning-bg: #FFF9F0;
  --warning-border: #F8C8A0;
  --warning-text: #92400E;
  --strength-track: #F0D8E8;
  --account-card-bg: #FFF5FA;
  --secondary-bg: #FFF8FC;
  --secondary-hover: #FFE8F4;
  --secondary-border-hover: #C44FAC;
  --separator: #C8A8B8;
  --google-bg: #FFFBFD;
  --google-hover: #FFF0F8;
  --button-spinner-ring: rgba(196,79,172,0.22);
  color-scheme: light;
}

/* ─── TOKENS – DARK ─── */
[data-theme="dark"] {
  --bg: #07060F;
  --surface: #0D0B1A;
  --card: rgba(15,12,28,0.92);
  --card-border: rgba(124,58,237,0.22);
  --ink: #EAE8F8;
  --muted: #8A87A8;
  --line: #1E1B30;
  --gold: #F59E0B;
  --gold-light: #FBBF24;
  --gold-faint: rgba(245,158,11,0.10);
  --purple: #8B5CF6;
  --purple-light: #A78BFA;
  --purple-faint: rgba(139,92,246,0.12);
  --cyan: #22D3EE;
  --green: #34D399;
  --red: #F87171;
  --btn-primary-bg: linear-gradient(135deg,#7C3AED 0%,#9333EA 50%,#A855F7 100%);
  --btn-primary-hover: linear-gradient(135deg,#8B5CF6 0%,#A855F7 100%);
  --btn-primary-fg: #FFFFFF;
  --field-bg: #0A091A;
  --field-label: #C4C0E0;
  --focus-ring: rgba(139,92,246,0.28);
  --soft-shadow: rgba(0,0,0,0.50);
  --shadow-card: 0 4px 16px rgba(0,0,0,0.40), 0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(124,58,237,0.16);
  --shadow-btn: 0 4px 24px rgba(139,92,246,0.45);
  --timer-bg: #0A0820;
  --resend-bg: #061410;
  --resend-hover: #0A1E16;
  --resend-border: #166534;
  --resend-border-hover: #16A34A;
  --resend-icon-bg: #052E16;
  --warning-bg: #1A1000;
  --warning-border: #78350F;
  --warning-text: #FCD34D;
  --strength-track: #1A1830;
  --account-card-bg: #0C0A1E;
  --secondary-bg: #0D0B1E;
  --secondary-hover: #16122E;
  --secondary-border-hover: #7C3AED;
  --separator: #46426A;
  --google-bg: #0C0A1A;
  --google-hover: #13102A;
  --button-spinner-ring: rgba(139,92,246,0.28);
  color-scheme: dark;
}

/* ─── RESET ─── */
*,*::before,*::after { box-sizing: border-box; }

html {
  background: var(--bg);
  transition: background-color 0.9s ease;
}
[data-theme="dark"] html { background: #07060F; }
[data-theme="light"] html { background: #FEF2F6; }

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font-family: "Be Vietnam Pro","Segoe UI",Arial,sans-serif;
  transition: color 0.5s ease;
  overflow-x: hidden;
}

/* Smooth color transitions cho auth page elements */
.auth-panel, .brand-panel, input, .primary-button,
.secondary-button, .google-button, .text-link,
label, h1, h2, p, .auth-links {
  transition:
    background-color 0.8s ease,
    border-color     0.6s ease,
    color            0.5s ease;
}

/* Auth page content above wave layer */
.auth-page, .theme-toggle { position: relative; z-index: 1; }

button,input { font: inherit; }
button:disabled,.is-loading { cursor: wait; opacity: 0.70; }
.is-loading { pointer-events: none; }

/* ─── THEME TOGGLE ─── */
.theme-toggle {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 30;
  min-width: 96px; min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 8px 32px var(--soft-shadow);
  cursor: pointer;
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 150ms, box-shadow 150ms;
}
.theme-toggle:hover {
  border-color: var(--purple);
  box-shadow: 0 8px 32px var(--soft-shadow), 0 0 0 2px var(--purple-faint);
}
.theme-toggle-icon {
  position: relative; width: 17px; height: 17px;
  border-radius: 50%; background: var(--purple); flex-shrink: 0;
  transition: background 200ms, box-shadow 200ms;
}
[data-theme="dark"] .theme-toggle-icon {
  background: transparent;
  border: 2px solid var(--ink);
  box-shadow: inset -5px -4px 0 var(--surface);
}

/* ─── LAYOUT ─── */
.auth-page {
  width: min(1140px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 460px;
  align-items: center;
  gap: 64px;
  padding: 56px 0;
}

/* ─── BRAND PANEL ─── */
.brand-panel {
  min-height: 600px;
  display: flex; flex-direction: column; justify-content: center; gap: 32px;
  padding: 8px 0;
}

.brand {
  width: fit-content;
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--ink); text-decoration: none;
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
}
.brand img {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--card-border), 0 8px 24px var(--soft-shadow);
}
.brand-name-text { line-height: 1; }
.brand-name-sub { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; letter-spacing: 0.04em; }

.brand-copy { max-width: 600px; }

.domain {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 20px;
  color: var(--purple-light);
  font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.domain::before {
  content: "";
  display: inline-block;
  width: 28px; height: 2px;
  background: linear-gradient(90deg, var(--purple), transparent);
  border-radius: 1px;
}

/* gradient badge */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  margin-bottom: 18px;
  padding: 5px 14px 5px 10px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--purple-faint);
  color: var(--purple-light);
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
}
.badge::before { content: "◆"; font-size: 8px; }

h1 {
  margin: 0;
  font-size: clamp(32px,4.8vw,58px);
  line-height: 1.07; letter-spacing: -0.025em; font-weight: 800;
  text-wrap: balance;
  background: linear-gradient(135deg, var(--ink) 0%, var(--purple-light) 55%, var(--cyan) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="light"] h1 {
  background: linear-gradient(135deg, #1E0A4A 0%, #7C3AED 55%, #0891B2 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-copy > p:last-of-type {
  max-width: 520px; margin: 20px 0 0;
  color: var(--muted); font-size: 16px; line-height: 1.7;
}

/* ─── FEATURE SHOWCASE ─── */
.feature-showcase {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  max-width: 540px;
}
.showcase-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  font-size: 13.5px; font-weight: 700;
  transition: border-color 200ms, box-shadow 200ms;
  backdrop-filter: blur(12px);
}
.showcase-item:hover {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--purple-faint);
}
.showcase-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  background: var(--purple-faint);
  border: 1px solid var(--card-border);
}
.showcase-item-info strong { display: block; font-size: 13px; font-weight: 700; color: var(--ink); }
.showcase-item-info span  { font-size: 11.5px; color: var(--muted); }

/* ─── TRUST STATS ─── */
.brand-stats {
  display: flex; align-items: center; gap: 28px;
  padding: 18px 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  max-width: 460px;
  backdrop-filter: blur(12px);
}
.brand-stat { text-align: center; }
.brand-stat strong {
  display: block; font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), var(--purple-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-stat span { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.brand-stat-divider { width: 1px; height: 36px; background: var(--line); flex-shrink: 0; }

/* ─── AUTH CARD ─── */
.auth-panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 30px 28px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: relative;
  overflow: hidden;
}
.auth-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--cyan), var(--purple));
  border-radius: 18px 18px 0 0;
}

/* ─── FORMS ─── */
.auth-form { display: none; padding-top: 4px; }
.auth-form.active { display: block; }

h2 {
  margin: 0 0 22px;
  font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
}

label {
  display: block; margin: 14px 0;
  color: var(--field-label); font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
}

input {
  display: block; width: 100%; min-height: 48px; margin-top: 6px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg); color: var(--ink); outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  font-size: 14px;
}
input::placeholder { color: var(--muted); opacity: 0.7; }
input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ─── BUTTONS ─── */
.primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px;
  margin-top: 12px; padding: 0 20px;
  border: 0; border-radius: 10px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  cursor: pointer; font-weight: 800; font-size: 15px; letter-spacing: 0.01em;
  box-shadow: var(--shadow-btn);
  transition: opacity 150ms, transform 150ms, box-shadow 150ms;
}
.primary-button:hover:not(:disabled) {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(139,92,246,0.50);
}
.primary-button:active:not(:disabled) { transform: translateY(0); }

.secondary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 46px;
  margin-top: 10px; padding: 0 20px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--secondary-bg); color: var(--ink);
  cursor: pointer; font-weight: 700; font-size: 14px;
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.secondary-button:hover:not(:disabled) {
  background: var(--secondary-hover);
  border-color: var(--secondary-border-hover);
  transform: translateY(-1px);
}

.resend-button { color: var(--green); background: var(--resend-bg); border-color: var(--resend-border); }
.resend-button:hover:not(:disabled) { background: var(--resend-hover); border-color: var(--resend-border-hover); }

.resend-icon {
  width: 22px; height: 22px;
  display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--resend-icon-bg);
  color: var(--green); font-size: 13px; flex-shrink: 0;
}

.button-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid var(--button-spinner-ring);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 650ms linear infinite;
}
.primary-button .button-spinner {
  border-color: rgba(255,255,255,0.25); border-top-color: #fff;
}

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

/* ─── GOOGLE BUTTON ─── */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0;
  color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.google-button {
  width: 100%; min-height: 50px;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--google-bg); color: var(--ink);
  text-decoration: none; font-size: 14px; font-weight: 700;
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.google-button:hover {
  background: var(--google-hover); border-color: var(--secondary-border-hover);
  transform: translateY(-1px);
}
.google-logo { width: 20px; height: 20px; flex-shrink: 0; }

.google-missing {
  display: none; margin: 8px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--warning-border); border-radius: 8px;
  background: var(--warning-bg); color: var(--warning-text);
  font-size: 12.5px; font-weight: 700; text-align: center;
}
.google-not-configured .google-button { opacity: 0.5; pointer-events: none; }
.google-not-configured .google-missing { display: block; }

/* ─── AUTH STATUS OVERLAY ─── */
.auth-status-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(5,4,15,0.65);
  backdrop-filter: blur(8px);
}
.auth-status-overlay.active { display: flex; }
.auth-status-box {
  width: min(390px,100%);
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--card-border); border-radius: 14px;
  background: var(--card); color: var(--ink);
  box-shadow: 0 24px 70px rgba(0,0,0,0.50);
}
.auth-status-spinner {
  width: 34px; height: 34px; flex: 0 0 34px;
  border: 3px solid var(--button-spinner-ring);
  border-top-color: var(--purple); border-radius: 50%;
  animation: spin 650ms linear infinite;
}
.auth-status-copy { min-width: 0; }
.auth-status-title { margin: 0 0 4px; font-size: 15px; font-weight: 800; }
.auth-status-detail { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.45; }

/* ─── AUTH LINKS ─── */
.auth-links {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 8px;
  margin-top: 16px; color: var(--muted); font-size: 13px;
}
.text-link {
  border: 0; background: transparent;
  color: var(--purple); cursor: pointer;
  font-size: 13px; font-weight: 800; padding: 0;
  transition: color 150ms;
}
.text-link:hover { color: var(--purple-light); text-decoration: underline; }
.dot-separator { color: var(--separator); }

/* ─── TURNSTILE ─── */
.turnstile-wrap { min-height: 72px; margin: 16px 0 4px; display: flex; align-items: center; justify-content: center; }
.turnstile-widget { min-height: 65px; }
.turnstile-missing {
  display: none; margin: 0; padding: 10px 14px;
  border: 1px solid var(--warning-border); border-radius: 8px;
  background: var(--warning-bg); color: var(--warning-text);
  font-size: 13px; font-weight: 700; text-align: center;
}
.turnstile-not-configured .turnstile-missing { display: block; }
.turnstile-not-configured .turnstile-widget { display: none; }

/* ─── PASSWORD STRENGTH ─── */
.strength { margin: -4px 0 8px; }
.strength-track { height: 6px; border-radius: 999px; background: var(--strength-track); overflow: hidden; }
#strength-bar {
  display: block; width: 0; height: 100%; border-radius: inherit;
  background: var(--red); transition: width 200ms ease, background 200ms ease;
}
#strength-bar[data-score="3"] { background: var(--gold); }
#strength-bar[data-score="4"],
#strength-bar[data-score="5"] { background: var(--green); }
#strength-text { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-weight: 700; }

/* ─── CODE TIMER ─── */
.code-timer {
  display: none; margin: -2px 0 12px; padding: 9px 12px;
  border-radius: 8px; background: var(--timer-bg);
  color: var(--green); font-size: 12.5px; font-weight: 800; text-align: center;
}
.code-timer.active { display: block; }

/* ─── MISC ─── */
.hidden { display: none !important; }
.reset-step { display: none; }
.reset-step.active { display: block; }
.reset-hint { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ─── ACCOUNT VIEW ─── */
.account-view { padding-top: 8px; }
.account-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.account-header img { width: 52px; height: 52px; object-fit: cover; border-radius: 12px; box-shadow: 0 4px 12px var(--soft-shadow); }
.account-header p { margin: 0 0 4px; color: var(--purple-light); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.account-header h2 { margin: 0; }
.account-card {
  display: grid; gap: 4px; margin-top: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--account-card-bg);
}
.account-card span { color: var(--muted); font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.account-card strong { overflow-wrap: anywhere; font-size: 15px; font-weight: 700; }
.account-note { margin: 16px 0 6px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ─── MESSAGES ─── */
.form-message { min-height: 20px; margin: 14px 0 0; font-size: 13.5px; font-weight: 700; line-height: 1.5; }
.ok    { color: var(--green); }
.error { color: var(--red);   }

/* ─── BRAND DIVIDER (legacy compat) ─── */
.brand-divider { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.brand-divider span { display: block; height: 2px; border-radius: 1px; }
.brand-divider .d1 { width: 48px; background: var(--purple); }
.brand-divider .d2 { width: 24px; background: var(--purple-light); opacity: 0.5; }
.brand-divider .d3 { width: 8px;  background: var(--purple); opacity: 0.2; }

/* ─── THEME RIPPLE OVERLAY ─── */
#theme-ripple {
  position: fixed; inset: 0; z-index: 99997;
  pointer-events: none;
  will-change: clip-path;
  transition: clip-path 0.65s cubic-bezier(0.22,0.61,0.36,1);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; gap: 32px; align-items: start; padding: 32px 0; }
  .brand-panel { min-height: auto; gap: 24px; }
  .feature-showcase { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .feature-showcase { grid-template-columns: 1fr 1fr; gap: 8px; }
  .brand-stats { gap: 16px; padding: 14px 18px; }
  .brand-stat strong { font-size: 18px; }
}
@media (max-width: 540px) {
  .auth-page { width: calc(100% - 24px); }
  .theme-toggle { top: 12px; right: 12px; min-width: 86px; min-height: 38px; }
  .auth-panel { padding: 20px 18px; border-radius: 14px; }
  h1 { font-size: 28px; }
  .feature-showcase { grid-template-columns: 1fr; }
}
