/* ===== Design tokens (shared with Profileora landing page) ===== */
:root {
  --bg: #f7f6f3;
  --text: #17171c;
  --accent: #8370ec;
  --accent-dark: #6c58d9;
  --pale-lavender: #e7e2fb;
  --charcoal: #17171c;
  --card: #ffffff;
  --border: rgba(23, 23, 28, 0.08);
  --shadow: 0 20px 50px rgba(23, 23, 28, 0.08);
  --muted: rgba(23, 23, 28, 0.62);
  --header-bg: rgba(247, 246, 243, 0.85);
  --radius-lg: 28px;
  --radius-md: 18px;
  --font-en: "Inter", system-ui, sans-serif;
  --font-en-serif: "Fraunces", Georgia, serif;
  --font-ar: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg: #121116;
  --text: #f2f0f7;
  --accent: #a598f5;
  --accent-dark: #8f7ef2;
  --pale-lavender: #2b2740;
  --charcoal: #f2f0f7;
  --card: #1b1a22;
  --border: rgba(242, 240, 247, 0.1);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --muted: rgba(242, 240, 247, 0.6);
  --header-bg: rgba(18, 17, 22, 0.85);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en);
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

html[lang="ar"] body { font-family: var(--font-ar); }
html[lang="ar"] h1 { font-family: var(--font-ar); }

h1 { font-family: var(--font-en-serif); font-weight: 500; margin: 0; }
p { margin: 0; }
a { color: inherit; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ===== Top controls (lang + theme) ===== */
.top-controls {
  position: fixed; top: 20px; inset-inline-end: 20px; z-index: 20;
  display: flex; align-items: center; gap: 14px;
}
.lang-switch {
  display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600;
  white-space: nowrap;
}
.lang-btn { background: none; border: none; cursor: pointer; color: var(--text); opacity: 0.55; padding: 4px 2px; font: inherit; }
.lang-btn[aria-pressed="true"] { opacity: 1; color: var(--accent); }
.lang-sep { opacity: 0.4; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ===== Layout ===== */
.auth-main {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}
.auth-wrap {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; align-items: center;
}

.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: #f7f6f3;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-en-serif); font-weight: 600; font-size: 1.2rem;
  margin-bottom: 14px;
}
.brand-name {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.18em;
  color: var(--muted); margin-bottom: 28px;
}
.brand-logo { margin-bottom: 30px; color: var(--text); }

.auth-card {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 40px 36px; text-align: center;
}
.auth-card h1 { font-size: 1.7rem; letter-spacing: -0.01em; }
.auth-sub { margin-top: 12px; font-size: 0.98rem; color: var(--muted); line-height: 1.6; }

/* ===== Google button ===== */
.google-btn {
  position: relative;
  -webkit-appearance: none; appearance: none;
  width: 100%; margin-top: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--charcoal); color: var(--bg);
  border: none; border-radius: 999px; padding: 15px 24px;
  font-family: inherit; font-size: 0.98rem; font-weight: 600;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.google-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(23, 23, 28, 0.18); }
.google-btn:disabled { background: var(--charcoal); color: var(--bg); }
.google-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.google-btn-content {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.google-icon { background: #fff; border-radius: 50%; padding: 2px; flex-shrink: 0; }

.google-btn.is-loading .google-btn-content { visibility: hidden; }
.google-btn.is-loading { cursor: progress; opacity: 0.9; }
.spinner {
  display: none; position: absolute; inset: 0; margin: auto;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(247, 246, 243, 0.35); border-top-color: var(--bg);
  animation: spin 0.8s linear infinite;
}
.google-btn.is-loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.auth-error {
  margin-top: 16px; font-size: 0.85rem; color: #c94f4f;
  background: rgba(201, 79, 79, 0.08); border: 1px solid rgba(201, 79, 79, 0.25);
  border-radius: var(--radius-md); padding: 10px 14px; text-align: start;
}

.back-link {
  display: inline-block; margin-top: 24px; font-size: 0.9rem; font-weight: 500;
  color: var(--muted); text-decoration: none;
}
.back-link:hover { text-decoration: underline; color: var(--text); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

@media (max-width: 480px) {
  .auth-card { padding: 32px 24px; }
  .top-controls { top: 14px; inset-inline-end: 14px; }
}
