/* ===================================================================
   GrooVVee — Auth Module Styles
   =================================================================== */

/* ── Auth Container Layout ──────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  position: relative;
  z-index: 1;
}

/* ── Auth Card ──────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 1.5rem);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 2rem);
  backdrop-filter: blur(32px);
  box-shadow: var(--shadow-xl), 0 0 80px rgba(28, 28, 30, 0.12);
  animation: auth-card-enter 0.6s var(--ease-out) forwards;
  position: relative;
  overflow: auto;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(28, 28, 30,0.6), rgba(28, 28, 30,0.4), transparent);
}

@keyframes auth-card-enter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Auth Logo / Header ─────────────────────────────────────────── */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.auth-logo .logo-icon-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

/* Shrink padding/margins on short phone screens so less of the card needs
   scrolling to reach — the card (logo + tabs + form + demo hints) is
   comfortably taller than a typical phone viewport otherwise. */
@media (max-width: 480px) {
  .auth-page {
    padding: 0;
    min-height: 100dvh;
  }

  .auth-card {
    max-height: 100dvh;
    border-radius: 0;
    padding: 1rem 1rem 1.25rem;
    width: 100%;
    max-width: none;
  }

  .auth-logo { margin-bottom: 1rem; }
  .auth-demo-hint { margin-top: var(--space-4); padding: var(--space-3) var(--space-4); }
  .auth-form { gap: 1rem; }
  .auth-tabs { margin-bottom: 1rem; }
}

.auth-logo .logo-icon {
  width: 40px;
  height: 40px;
}

.auth-logo .logo-text {
  font-size: 1.75rem;
}

.auth-tagline {
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: -var(--space-6);
  margin-bottom: var(--space-6);
}

/* ── Auth Tabs ──────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.04);
  border-radius: var(--radius-lg);
  padding: 3px;
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-7);
}

.auth-tab {
  flex: 1;
  padding: 0.5625rem var(--space-4);
  border-radius: calc(var(--radius-lg) - 3px);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-base);
  cursor: pointer;
  background: none;
  border: none;
  text-align: center;
}

.auth-tab.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  box-shadow: none;
}

.auth-tab:hover:not(.active) {
  color: var(--text-secondary);
}

/* ── Auth Form ──────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.auth-form .form-group { gap: var(--space-2); }

.dob-date-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) auto minmax(0, 0.8fr) auto minmax(0, 0.8fr);
  align-items: center;
  gap: var(--space-2);
  padding-left: 2.75rem;
}

.dob-date-fields .form-input {
  min-width: 0;
  padding-inline: 0.25rem;
  text-align: center;
}

.dob-date-fields > span { color: var(--text-muted); }

/* ── Submit button ──────────────────────────────────────────────── */
.auth-submit {
  margin-top: var(--space-2);
  position: relative;
}

.auth-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn--loading .auth-loading-spinner { display: block; }
.btn--loading .btn-label { display: none; }

/* ── Footer links ───────────────────────────────────────────────── */
.auth-footer {
  margin-top: var(--space-6);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-footer a, .auth-link {
  color: var(--primary-600);
  cursor: pointer;
  font-weight: 500;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  font-size: inherit;
  text-decoration: none;
}

.auth-footer a:hover, .auth-link:hover { color: var(--primary-700); }

/* ── Forgot password view ───────────────────────────────────────── */
.auth-back {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-6);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color var(--transition-fast);
}

.auth-back:hover { color: var(--text-primary); }
.auth-back svg { width: 16px; height: 16px; }

/* ── View transitions ───────────────────────────────────────────── */
.auth-view {
  animation: auth-view-enter var(--duration-base) var(--ease-out) forwards;
}

@keyframes auth-view-enter {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0);    }
}

/* ── Success state ──────────────────────────────────────────────── */
.auth-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-6) 0;
  animation: auth-view-enter var(--duration-base) var(--ease-out) forwards;
}

.auth-success__icon {
  width: 64px;
  height: 64px;
  background: rgba(28, 28, 30, 0.15);
  border: 2px solid rgba(28, 28, 30, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success-500);
}

.auth-success__icon svg { width: 32px; height: 32px; }

/* ── Demo credentials hint ──────────────────────────────────────── */
.auth-demo-hint {
  margin-top: var(--space-5);
  padding: var(--space-4);
  background: rgba(28, 28, 30, 0.06);
  border: 1px solid rgba(28, 28, 30, 0.15);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.auth-demo-hint strong { color: var(--accent-700); }

.auth-demo-hint__title {
  font-weight: 600;
  color: var(--accent-700);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ===================================================================
   Figma auth screens ("sign in options", "sign in with email",
   "sign up with email") — flat on the cream watermark background, no
   floating card; title row with a back arrow; olive pill submit; cream
   outlined social pills under an "Or continue with" rule.
   =================================================================== */
.auth-card {
  max-width: 420px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}
.auth-card::before { display: none; }

.auth-logo { margin-bottom: var(--space-6); }
.auth-logo__wordmark { width: 160px; height: auto; display: block; }

.auth-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.auth-title-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-left: -4px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}
.auth-title-back svg { width: 24px; height: 24px; }
.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0;
}

.auth-form .form-label { font-size: 0.9375rem; }
.auth-submit { height: 52px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0 var(--space-4);
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.auth-divider span { flex: 1; height: 1px; background: rgba(37, 37, 37, 0.2); }

.auth-social { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-social .btn { height: 52px; font-weight: 400; gap: var(--space-3); }
.auth-social .btn svg { width: 22px; height: 22px; }

.auth-switch {
  margin-top: var(--space-6);
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-primary);
}
.auth-switch .auth-link { color: var(--primary-800); font-weight: 600; font-size: 1rem; padding: 0 2px; }

.auth-footer { font-size: 0.8125rem; color: var(--text-primary); }
.auth-footer a { color: var(--primary-800); font-weight: 600; text-decoration: underline; }

@media (max-width: 480px) {
  .auth-card { padding: var(--space-6) var(--space-4) var(--space-8); }
  .auth-logo { margin-bottom: var(--space-6); }
}

/* ===================================================================
   Figma onboarding: welcome carousel, sign-in / sign-up options,
   Choose Your Interests. App colours (tokens) only.
   =================================================================== */
.auth-card--bare .auth-logo { display: none; }

.auth-welcome { display: flex; flex-direction: column; min-height: calc(100dvh - 120px); }
.auth-welcome__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; flex: 1; }
.auth-welcome__track::-webkit-scrollbar { display: none; }
.auth-welcome__slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; padding: var(--space-4) var(--space-2); }
.auth-welcome__art {
  position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin-bottom: var(--space-6);
  border-radius: 28px; background: var(--bg-surface); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg);
}
/* The GrooVVee logo poster fills the card — no dark tile. */
.auth-welcome__mark { width: 100%; height: 100%; object-fit: cover; border-radius: 28px; }
.auth-welcome__bubble {
  position: absolute; width: 56px; height: 56px; border-radius: 50%; background: var(--bg-surface); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md);
}
.auth-welcome__bubble svg { width: 26px; height: 26px; }
.auth-welcome__bubble:nth-of-type(1) { top: -14px; left: -10px; }
.auth-welcome__bubble:nth-of-type(2) { top: 30%; right: -18px; }
.auth-welcome__bubble:nth-of-type(3) { bottom: -16px; left: 22%; }
.auth-welcome__title { margin: 0 0 var(--space-2); font-weight: 700; color: var(--text-primary); }
.auth-welcome__text { margin: 0; color: var(--text-secondary); max-width: 340px; }
.auth-welcome__dots { display: flex; justify-content: center; gap: 6px; margin: var(--space-5) 0; }
.auth-welcome__dot { width: 8px; height: 8px; border-radius: 4px; border: none; padding: 0; background: var(--border-strong); cursor: pointer; transition: width 200ms; }
.auth-welcome__dot.is-active { width: 28px; background: var(--primary-800); }

.auth-options__title { margin: 0 0 var(--space-8); text-align: center; font-weight: 600; color: var(--text-primary); }
.auth-options .auth-divider { margin-top: var(--space-5); }
.auth-options #phone-signin-link { width: 100%; }

.auth-interests__intro { margin: -8px 0 var(--space-5); color: var(--text-secondary); }
.auth-interests__group { margin-bottom: var(--space-5); }
.auth-interests__group h2 { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--space-3); font-weight: 500; }
.auth-interests__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.auth-chip { padding: 8px 16px; border-radius: var(--radius-full); border: none; background: var(--bg-overlay); color: var(--text-primary); font-weight: 600; cursor: pointer; }
.auth-chip[aria-pressed="true"] { background: var(--primary-800); color: #fff; }
.auth-interests__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-6); }
.auth-interests__actions .btn { height: 52px; }

/* Battle invite screen (_renderInvite): for people who do not have GrooVVee yet. */
.auth-invite { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); }
.auth-invite__logo { width: 170px; height: auto; margin-bottom: var(--space-2); }
.auth-invite__badge { padding: 4px 12px; border-radius: var(--radius-full); background: var(--bg-elevated); color: var(--text-secondary); font-weight: 600; }
.auth-invite__title { margin: var(--space-2) 0 0; font-weight: 700; color: var(--text-primary); }
.auth-invite__battle { margin: 0; min-height: 1.4em; color: var(--text-secondary); }
.auth-invite__steps { width: 100%; margin: var(--space-4) 0; padding: 0; list-style: none; counter-reset: step; text-align: left; display: flex; flex-direction: column; gap: var(--space-3); }
.auth-invite__steps li { position: relative; padding: var(--space-3) var(--space-3) var(--space-3) 52px; border-radius: 14px; background: var(--bg-surface); box-shadow: var(--shadow-sm); counter-increment: step; display: flex; flex-direction: column; gap: 2px; }
.auth-invite__steps li::before { content: counter(step); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--primary-800); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.auth-invite__steps li span { color: var(--text-secondary); }
.auth-invite__actions { width: 100%; display: flex; flex-direction: column; gap: var(--space-3); }
.auth-invite__actions a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.auth-invite__hint { margin: 0; color: var(--text-muted); }

.auth-logo { display: flex; justify-content: center; }
.auth-logo { width: fit-content; margin-left: auto; margin-right: auto; }

/* ── Phase 1 (Figma): welcome collage, account type, complete profile, verification ── */
.auth-welcome { position: fixed; inset: 0; z-index: 20; min-height: 0; background: #0b0b0f; overflow: hidden; }
.auth-welcome__bg { position: absolute; inset: -8% -20% 30% -20%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; transform: rotate(-12deg); }
.auth-welcome__tile { display: block; aspect-ratio: 2 / 3; border-radius: 16px; background: #222 center/cover no-repeat; }
.auth-welcome__tile--0 { background-color: #FCF600; }
.auth-welcome__tile--1 { background-color: #2a2a31; }
.auth-welcome__tile--2 { background-color: #f4f4f5; }
.auth-welcome__tile--3 { background-color: #4a4a55; }
.auth-welcome__tile:nth-child(4n+1) { transform: translateY(-14%); }
.auth-welcome__tile:nth-child(4n+3) { transform: translateY(10%); }
.auth-welcome__shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.05) 0%, rgba(0,0,0,.2) 35%, rgba(0,0,0,.88) 72%, #000 100%); }
.auth-welcome__bottom { position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; padding: 0 var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; }
.auth-welcome__track { flex: none; }
.auth-welcome__slide { padding: 0 var(--space-2); }
.auth-welcome__title { color: #fff; font-size: 1.5rem; line-height: 1.25; }
.auth-welcome__text { color: rgba(255,255,255,.9); max-width: none; }
.auth-welcome__dot { background: rgba(255,255,255,.45); }
.auth-welcome__dot.is-active { background: #FCF600; }
.auth-welcome .auth-switch { color: #fff; }
.auth-welcome .auth-link { color: #FCF600; }

.auth-type__intro, .auth-verify__intro { margin: 0 0 var(--space-4); }
.auth-type__cards { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-6); }
.auth-type__card { display: flex; gap: var(--space-3); align-items: flex-start; text-align: left; padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-surface); font: inherit; cursor: pointer; }
.auth-type__card strong { display: block; font-size: 1rem; }
.auth-type__card span span { display: block; color: var(--text-secondary); margin-top: 2px; }
.auth-type__card.is-selected { border-color: #000; background: #FCF600; }
.auth-type__icon { flex-shrink: 0; }
#account-type-continue:disabled { opacity: .45; cursor: not-allowed; }

.auth-profile__title { font-size: 1.375rem; margin: 0 0 var(--space-3); }
.auth-profile__photo { display: flex; justify-content: center; margin-bottom: var(--space-4); }
.auth-profile__avatar { position: relative; width: 110px; height: 110px; cursor: pointer; }
.auth-profile__avatar > span:first-of-type { display: flex; align-items: center; justify-content: center; width: 110px; height: 110px; border-radius: 50%; background: #FCF600 center/cover no-repeat; border: 2px solid #000; color: #000; }
.auth-profile__cam { position: absolute; right: 2px; bottom: 2px; width: 28px; height: 28px; border-radius: 50%; background: #000; color: #FCF600; display: flex; align-items: center; justify-content: center; }
.auth-phone { display: flex; gap: var(--space-2); }
.auth-phone__cc { flex: 0 0 120px; }
.auth-phone input { flex: 1; min-width: 0; }
.auth-dob { display: grid; grid-template-columns: 1.4fr 0.8fr 1fr; gap: var(--space-2); }
.auth-profile__where { display: flex; gap: 8px; align-items: center; margin: var(--space-2) 0; color: var(--text-secondary); }
.auth-profile__buddy { display: flex; gap: 8px; align-items: center; margin-bottom: var(--space-4); }
.auth-profile__logout { display: block; margin: var(--space-3) auto 0; font-weight: 700; }

.auth-verify__via { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--space-4); }
.auth-verify__via div { border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 12px; background: var(--bg-surface); }
.auth-verify__via span { display: block; font-size: .8125rem; color: var(--text-secondary); }
.otp-boxes { display: flex; justify-content: center; gap: 10px; margin: var(--space-4) 0; }
.otp-box { width: 48px; height: 58px; text-align: center; font: inherit; font-size: 1.5rem; font-weight: 700; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-surface); color: var(--text-primary); }
.otp-box:focus { outline: none; border-color: #000; box-shadow: 0 0 0 2px #FCF600; }
.otp-box.is-filled { border-color: #000; }
#twofactor-btn:disabled { opacity: .45; }

.auth-done { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-done__card { width: 100%; max-width: 360px; background: #fff; color: #000; border-radius: 16px; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.auth-done__card h2 { margin: 0; }
.auth-done__card p { margin: 0 0 8px; color: #333; }
.auth-done__tick { color: #000; }

/* The welcome carousel is full-bleed: the card (and the page around it) lose their frame for that one view. */
.auth-page:has(.auth-card--welcome) { padding: 0; }
.auth-card--welcome { max-width: none; max-height: none; width: 100%; height: 100dvh; border: 0; border-radius: 0; padding: 0; background: #000; box-shadow: none; backdrop-filter: none; overflow: hidden; }
.auth-card--welcome::before { display: none; }
.auth-welcome { position: relative; inset: auto; width: 100%; height: 100dvh; }
.auth-card--welcome .auth-welcome { position: absolute; inset: 0; height: auto; width: auto; }
.auth-card--welcome #auth-language-btn { position: absolute; top: 12px; right: 12px; z-index: 30; color: #fff; }

/* Short or wide screens (laptops, desktops): the welcome text and "Already have an account? Login" always fit — the
   screen scrolls instead of cutting them off — and the sign-up form has one scrollbar (the page's), not a second one
   inside the card. */
.auth-welcome { overflow-y: auto; justify-content: flex-end; }
.auth-welcome__bottom { position: relative; margin-top: auto; width: 100%; }
@media (min-width: 768px) {
  .auth-card { max-height: none; overflow: visible; }
  .auth-page { overflow: visible; }
}
@media (max-height: 640px) {
  .auth-welcome__art { width: 120px; height: 120px; }
}
.auth-container--welcome { padding: 0 !important; overflow: hidden; }
.auth-page--welcome { padding: 0; min-height: 0; }
