/* ============================================================
   SAJEEL AI WALA — auth pages (signup.html + browser gate)
   Relies on tokens & .btn from styles.css
   ============================================================ */

/* ---------- page scaffold ---------- */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px clamp(20px, 4vw, 48px) 40px;
}

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 960px;
  width: 100%;
  margin-inline: auto;
}

.auth-shell .btn--back {
  font-size: 13.5px;
  color: var(--text-2);
}

.auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 0 20px;
}

/* ---------- card — Apple-style frosted glass ---------- */
.auth-card {
  position: relative;
  width: min(430px, 100%);
  padding: 34px 32px 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-xl);
  background: linear-gradient(165deg,
    rgba(255, 255, 255, 0.11),
    rgba(255, 255, 255, 0.04) 42%,
    rgba(255, 255, 255, 0.07));
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 40px 90px -28px rgba(0, 0, 0, 0.75),
    0 12px 32px -14px rgba(0, 0, 0, 0.5),
    0 0 90px -30px rgba(91, 156, 255, 0.4);
  animation: authIn 640ms var(--ease) both;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: -130px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 260px;
  background: radial-gradient(circle,
    rgba(91, 156, 255, 0.22),
    rgba(169, 123, 255, 0.10) 45%,
    transparent 70%);
  filter: blur(50px);
  pointer-events: none;
}
/* Specular sheen sweeping the glass once on entrance */
.auth-card::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -30%;
  width: 40%;
  height: 220%;
  background: linear-gradient(105deg,
    transparent,
    rgba(255, 255, 255, 0.14) 50%,
    transparent);
  transform: rotate(12deg) translateX(-140%);
  animation: glassSheen 1100ms var(--ease) 260ms forwards;
  pointer-events: none;
}
@keyframes glassSheen {
  to { transform: rotate(12deg) translateX(560%); }
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.auth-card__head { position: relative; text-align: center; margin-bottom: 24px; }
.auth-card__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 14px;
  animation: headIn 560ms var(--ease) 240ms both;
}
.auth-card__sub {
  margin-top: 7px;
  font-size: 13.5px;
  color: var(--text-2);
  animation: headIn 560ms var(--ease) 320ms both;
}
@keyframes headIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* avatar orb shown when signed in on the gate */
.auth-avatar {
  position: relative;
  display: block;
  width: 52px;
  height: 52px;
  margin-inline: auto;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 18px rgba(91, 156, 255, 0.55),
    0 8px 22px -8px rgba(0, 0, 0, 0.6);
}

/* Animated logo entrance: bloom-blur spring, then two soft rings */
.auth-card__head .auth-avatar {
  animation: logoIn 880ms cubic-bezier(0.22, 1.32, 0.36, 1) 140ms both;
}
@keyframes logoIn {
  0%   { opacity: 0; transform: scale(0.35) translateY(10px); filter: blur(12px); }
  55%  { opacity: 1; transform: scale(1.1) translateY(0); filter: blur(0); }
  76%  { transform: scale(0.965); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
.auth-card__head .auth-avatar::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(91, 156, 255, 0.55);
  animation: logoRing 2.4s var(--ease) 980ms 2;
  pointer-events: none;
}
@keyframes logoRing {
  0%   { transform: scale(0.92); opacity: 0.85; }
  100% { transform: scale(1.6); opacity: 0; }
}
.auth-avatar--initials {
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
}

/* brand orb: the site logo inside the entrance animation (signed-out state) */
.auth-avatar--logo {
  background: url("assets/img/logo.jpg") center / cover no-repeat;
  text-indent: -9999px;
  overflow: hidden;
}

/* owner chip: the signed-in person's initials in a soft tinted circle */
.auth-avatar--owner {
  background: rgba(91, 156, 255, 0.16);
  border: 1px solid rgba(91, 156, 255, 0.45);
  color: #cfe0ff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 14px rgba(91, 156, 255, 0.28),
    0 6px 18px -8px rgba(0, 0, 0, 0.55);
}

/* ---------- tabs ---------- */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.auth-tabs button {
  padding: 9px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.auth-tabs button.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line-strong) inset;
}

/* ---------- forms ---------- */
.auth-form { display: none; }
.auth-form.is-active { display: block; }

.auth-form.is-busy { pointer-events: none; opacity: 0.65; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.field input::placeholder { color: var(--text-3); }
.field input:focus {
  outline: none;
  border-color: rgba(91, 156, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(91, 156, 255, 0.18);
}
.field__hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.auth-submit { width: 100%; margin-top: 6px; }

/* ---------- GitHub button + divider ---------- */
.btn--github {
  width: 100%;
  color: #fff;
  background: #f4f6fb;
  border-color: transparent;
  color: #0d1117;
  font-weight: 600;
}
.btn--github:hover {
  transform: translateY(-2px) scale(1.01);
  background: #ffffff;
  box-shadow: 0 14px 34px -14px rgba(240, 246, 252, 0.45);
}
.btn--github .gh-mark { width: 19px; height: 19px; fill: currentColor; }

/* Google button — white like GitHub's, with the four-color G */
.btn--google {
  width: 100%;
  background: #ffffff;
  border-color: transparent;
  color: #1f1f1f;
  font-weight: 600;
  margin-bottom: 10px;
}
.btn--google:hover {
  transform: translateY(-2px) scale(1.01);
  background: #f6f8fc;
  box-shadow: 0 14px 34px -14px rgba(240, 246, 252, 0.45);
}
.btn--google .g-mark { width: 18px; height: 18px; flex: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- status / messages ---------- */
.auth-status {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid var(--line-strong);
}
.auth-status.is-visible { display: block; }
.auth-status.is-error {
  border-color: rgba(255, 99, 99, 0.4);
  background: rgba(255, 71, 87, 0.09);
  color: #ffb3ba;
}
.auth-status.is-ok {
  border-color: rgba(79, 216, 232, 0.4);
  background: rgba(79, 216, 232, 0.08);
  color: #b8ecf3;
}
.auth-status.is-info {
  border-color: rgba(91, 156, 255, 0.4);
  background: rgba(91, 156, 255, 0.09);
  color: #cfe0ff;
}

.auth-status ol {
  margin: 8px 0 0;
  padding-left: 18px;
  list-style: decimal;
}
.auth-status ol li { margin: 4px 0; }
.auth-status code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
}

/* ---------- fine print ---------- */
.auth-note {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}
.auth-note a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- gate overlay (browser.html when signed out) ---------- */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 5, 9, 0.62);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  animation: authIn 400ms var(--ease) both;
}
.auth-gate.is-hidden { display: none; }

/* boot state: gate is hidden by default on browser.html so signed-in users
   never see the login card flash while session validation round-trips.
   browser.js reveals the gate only when validation says signed-out. */
.auth-gate.is-booting { display: none; }

/* ---------- glass companions: inputs & tabs go translucent ---------- */
.field input {
  background: rgba(10, 13, 22, 0.48);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.auth-tabs { background: rgba(255, 255, 255, 0.05); }
.auth-tabs button.is-active { background: rgba(255, 255, 255, 0.13); }

/* ---------- fallbacks ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth-card { background: rgba(15, 18, 28, 0.97); }
  .auth-gate { background: rgba(4, 5, 9, 0.88); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-card::after,
  .auth-card__title,
  .auth-card__sub,
  .auth-card__head .auth-avatar,
  .auth-card__head .auth-avatar::after {
    animation: none !important;
  }
}

/* ---------- confetti burst (GitHub sign-in success) ---------- */
.confetti-host {
  position: fixed;
  z-index: 200;
  width: 0;
  height: 0;
  pointer-events: none;
}
.confetti-host i {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  border-radius: 2px;
}

/* ---------- mini card (download sign-up gate on index.html) ---------- */
.auth-card--mini { width: min(400px, 100%); text-align: center; }
.auth-card__actions {
  position: relative;
  display: grid;
  gap: 10px;
}
.auth-card__actions .btn { width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .auth-card { padding: 26px 20px 22px; }
  .auth-shell { flex-wrap: wrap; }
}

/* ================= EMAIL OTP (passwordless) ================= */
.btn--otp {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, rgba(76,194,255,.14), rgba(122,107,255,.10));
  border: 1px solid rgba(76,194,255,.35);
  color: #dff4ff;
}
.btn--otp:hover { border-color: rgba(76,194,255,.6); background: linear-gradient(135deg, rgba(76,194,255,.2), rgba(122,107,255,.14)); }
.otp-mark { font-size: 16px; line-height: 1; }

.otp-overlay {
  margin-top: 14px;
  padding: 16px 14px 14px;
  border-radius: 14px;
  background: rgba(13,17,27,.55);
  border: 1px solid rgba(76,194,255,.22);
  display: flex; flex-direction: column; gap: 10px;
  animation: otpIn .25s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes otpIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.otp-overlay[hidden] { display: none; }
.otp__title { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; color: #cfe9f7; text-align: center; }
.otp__input {
  width: 100%; padding: 11px 14px; border-radius: 11px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05);
  color: #fff; font-size: 14px; outline: none;
}
.otp__input:focus { border-color: rgba(76,194,255,.6); }
.otp__sentto { margin: 0; font-size: 12px; color: #8f97ad; text-align: center; }
.otp__boxes { display: flex; gap: 8px; justify-content: center; }
.otp__box {
  width: 44px; height: 54px; text-align: center;
  font-size: 22px; font-weight: 800; color: #fff;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; outline: none; caret-color: #4cc2ff;
  transition: border-color .15s, background .15s;
}
.otp__box:focus { border-color: #4cc2ff; background: rgba(76,194,255,.08); }
.otp__links { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12px; color: #6b7288; }
.otp__cancel { margin-top: 2px; text-align: center; }
