/* ============================================================
   auth-base.css — shared auth-page foundation
   Created 2026-05-09 (auth-redesign Phase 1).

   Built on dashboard/css/tokens.css (light + dark + sport-mode).
   Zero hardcoded hex — every color via var(--token).

   Used by: auth/login.html · auth/connect-intervals.html
   · auth/confirm-profile.html
   ============================================================ */

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sys);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-image:
    radial-gradient(ellipse at 15% 60%, var(--accent-tint) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, var(--accent-tint) 0%, transparent 50%);
}

/* ---- Wrapper ------------------------------------------ */
.auth-wrapper {
  width: 100%;
  max-width: 420px;
}
.auth-wrapper--wide {
  max-width: 760px;
}

/* ---- Brand -------------------------------------------- */
.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}
.auth-brand-name {
  font-family: var(--sys);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--ink);
  text-transform: uppercase;
}
.auth-brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 5px;
}

/* ---- Loading state (page-level) ---------------------- */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.auth-page-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--accent-tint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}
.auth-small-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent-tint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}
.auth-spinner-inline {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #1f1f1f;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* ---- Card --------------------------------------------- */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}
.auth-card--padded {
  padding: 36px 32px;
}

/* ---- Form body ---------------------------------------- */
.auth-form-body {
  padding: 36px 28px 28px;
  text-align: center;
}
.auth-form-title {
  font-family: var(--sys);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: var(--ink);
}
.auth-form-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ---- Card title (used on connect-intervals + confirm-profile) ---- */
.auth-card-title {
  font-family: var(--sys);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  color: var(--ink);
}
.auth-card-sub {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 20px;
}

/* ---- Pill (accent-tinted badge) ----------------------- */
.auth-pill {
  display: inline-block;
  background: var(--accent-tint);
  border: 1px solid var(--accent-border, var(--accent));
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

/* ---- Google button ------------------------------------ */
.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-family: var(--sys);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s, opacity 0.15s;
}
.auth-google-btn:hover:not(:disabled) {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}
.auth-google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-google-g {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Classic button (used by connect/confirm — JS hooks rely on `.btn`) ---- */
.btn {
  padding: 12px 22px;
  border-radius: 6px;
  font-family: var(--sys);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
}
.btn:hover:not(:disabled) {
  background: var(--surface-3, var(--border));
  border-color: var(--border-2, var(--border));
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.btn-secondary {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.btn-secondary:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-2);
}
/* `.btn-outline-gold` — kept name for back-compat with connect-intervals JS;
   styled with --accent so the visual matches the new dashboard palette. */
.btn-outline-gold {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-outline-gold:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}
.btn-danger {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
}
.btn-danger:hover:not(:disabled) {
  background: var(--warn-tint);
}
.btn-signout {
  padding: 6px 12px;
  font-size: 12px;
}

/* ---- Generic button styles ---------------------------- */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 6px;
  font-family: var(--sys);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.05s;
  text-decoration: none;
}
.auth-btn:active:not(:disabled) { transform: translateY(1px); }
.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.auth-btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.auth-btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.auth-btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-2, var(--border));
}
.auth-btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--ink-3);
}
.auth-btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.auth-btn-ghost:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-2);
}
.auth-btn-danger {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
}
.auth-btn-danger:hover:not(:disabled) {
  background: var(--warn-tint);
}

/* ---- Message states (error / success / info) --------- */
.auth-message {
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  display: none;
}
.auth-message.error {
  display: block;
  background: var(--warn-tint);
  border: 1px solid var(--warn);
  color: var(--warn);
}
.auth-message.success {
  display: block;
  background: var(--good-tint);
  border: 1px solid var(--good);
  color: var(--good);
}
.auth-message.info {
  display: block;
  background: var(--accent-tint);
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* ---- Form inputs (text, textarea) -------------------- */
.auth-input,
.auth-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--sys);
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.auth-input:focus,
.auth-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.auth-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  font-family: var(--mono);
}
.auth-input::placeholder,
.auth-textarea::placeholder {
  color: var(--ink-3);
}

/* ---- Footer (small text under card) ------------------ */
.auth-card-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  letter-spacing: 0.5px;
}

/* ---- Sign-out button wrap (used by connect/confirm) -- */
.auth-signout-wrap {
  text-align: center;
  margin-top: 20px;
}

/* ---- Responsive --------------------------------------- */
@media (max-width: 480px) {
  body { padding: 16px; }
  .auth-form-body { padding: 30px 20px 22px; }
  .auth-card--padded { padding: 28px 22px; }
  .auth-card-footer { padding: 12px 20px; }
  .auth-form-title { font-size: 20px; }
  .auth-card-title { font-size: 22px; }
}

/* ---- Reduced motion ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  /* Spinners still rotate — they communicate progress.
     Only suppress decorative animations. */
  .auth-google-btn,
  .auth-btn { transition: none; }
}
