/* ============================================================
   CULTURILY — AUTH PAGES
   Covers: login.html, register.html, onboarding.html
   Requires: global.css, components.css
   ============================================================ */

/* ── Page shell ─────────────────────────────────────────────── */

.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 40px;
  background: var(--bg);
}

.auth-inner {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Logo / brand ───────────────────────────────────────────── */

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  gap: 10px;
  text-decoration: none;
}

.auth-logo-mark {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-logo-mark svg {
  width: 22px;
  height: 22px;
  fill: #0e0e0e;
}

.auth-logo-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ── Headings ───────────────────────────────────────────────── */

.auth-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  text-align: center;
  margin: 0 0 8px;
}

.auth-subheading {
  font-size: 0.9375rem;
  color: var(--text-subtle);
  text-align: center;
  margin: 0 0 32px;
  line-height: 1.5;
}

/* ── Google button ──────────────────────────────────────────── */

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  text-decoration: none;
}

.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-google:active {
  opacity: 0.85;
}

.btn-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── OR divider ─────────────────────────────────────────────── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Form ───────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Forgot password link ───────────────────────────────────── */

.auth-forgot {
  display: block;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  text-decoration: none;
  transition: color var(--transition);
  margin-top: -8px;
}

.auth-forgot:hover {
  color: var(--accent);
}

/* ── Submit button spacing ──────────────────────────────────── */

.auth-form .btn {
  margin-top: 4px;
}

/* ── Switch page link ───────────────────────────────────────── */

.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 0.9rem;
}

.auth-switch a,
.auth-switch button {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  transition: color var(--transition);
}

.auth-switch a:hover,
.auth-switch button:hover {
  color: var(--accent-hover);
}

/* ── Terms note ─────────────────────────────────────────────── */

.auth-terms {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 16px;
  line-height: 1.5;
}

.auth-terms a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Email-sent state (register) ────────────────────────────── */

.auth-sent-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 8px 0;
}

.auth-sent-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-sent-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
  fill: none;
}

.auth-sent-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.auth-sent-body {
  font-size: 0.9375rem;
  color: var(--text-subtle);
  line-height: 1.6;
  margin: 0;
  max-width: 300px;
}

.auth-sent-email {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Inline toast (auth pages, before app shell loads) ──────── */

.auth-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-3);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  max-width: min(360px, calc(100vw - 40px));
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.auth-toast--error {
  border-color: rgba(255, 80, 80, 0.35);
  background: rgba(255, 50, 50, 0.12);
  color: #ff9a9a;
}

.auth-toast--success {
  border-color: rgba(204, 255, 0, 0.3);
  background: rgba(204, 255, 0, 0.08);
  color: var(--accent);
}

/* ── Password visibility toggle ─────────────────────────────── */

.input-password-wrap {
  position: relative;
}

.input-password-wrap .form-input {
  padding-right: 48px;
}

.btn-pw-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.btn-pw-toggle:hover {
  color: var(--text-primary);
}

.btn-pw-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Onboarding layout ──────────────────────────────────────── */

.onboarding-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px 48px;
  background: var(--bg);
}

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

.onboarding-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}

.onboarding-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 6px;
  line-height: 1.2;
}

.onboarding-subheading {
  font-size: 0.9375rem;
  color: var(--text-subtle);
  text-align: center;
  margin: 0 0 32px;
}

/* ── Section titles inside onboarding form ──────────────────── */

.onboarding-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0 0 12px;
}

/* ── Avatar grid ────────────────────────────────────────────── */

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

@media (max-width: 360px) {
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.avatar-option {
  position: relative;
  cursor: pointer;
  border-radius: 50%;
  outline: 3px solid transparent;
  outline-offset: 3px;
  transition: outline-color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.avatar-option:hover {
  transform: scale(1.08);
}

.avatar-option.selected {
  outline-color: var(--accent);
  transform: scale(1.1);
}

.avatar-option .avatar {
  pointer-events: none;
}

/* No overlay — selection is shown purely by the lime ring on .avatar-option.selected */

/* ── Country select ─────────────────────────────────────────── */

.country-select-wrap {
  position: relative;
  margin-bottom: 28px;
}

.country-select-wrap::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-subtle);
  pointer-events: none;
}

.country-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 14px 44px 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}

.country-select:focus {
  border-color: var(--accent);
  background: var(--surface-2);
}

.country-select option {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ── Onboarding form spacing ────────────────────────────────── */

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.onboarding-form .form-group {
  margin-bottom: 28px;
}

/* ── Avatar preview in name section ─────────────────────────── */

.name-avatar-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.name-avatar-preview .avatar {
  flex-shrink: 0;
}

.name-avatar-preview-text {
  font-size: 0.875rem;
  color: var(--text-subtle);
  line-height: 1.4;
}

/* ── Loading overlay (during onboarding save) ───────────────── */

.auth-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 14, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.auth-loading-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.auth-loading-overlay p {
  font-size: 0.9375rem;
  color: var(--text-subtle);
}

/* Light mode: darken auth link so lime is readable on pale background */
html.theme-light .auth-switch a,
html.theme-light .auth-switch button {
  color: #7aaa00;
}
html.theme-light .auth-switch a:hover,
html.theme-light .auth-switch button:hover {
  color: #5e8500;
}
