/* ================================================================
   auth.css  —  OptiTweaks Auth Card
   Matches the main site aesthetic: dark glass, blue/cyan, Bebas Neue
   All styles scoped under .auth-card — nothing leaks into main site.
   Uses the site CSS variables already on :root.
   ================================================================ */

/* ── Card shell ──────────────────────────────────────────────── */
.auth-card {
  max-width: 430px;
  margin: 0 auto;
  background: linear-gradient(160deg, rgba(8,14,38,.96) 0%, rgba(4,8,24,.98) 100%);
  border: 1px solid rgba(26,92,255,.24);
  border-radius: var(--r-xl);
  padding: 40px 36px 36px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(36px);
  -webkit-backdrop-filter: blur(36px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.028) inset,
    0 32px 96px rgba(0,0,0,.72),
    0 0 80px rgba(26,92,255,.06);
  animation: ac-enter .48s cubic-bezier(.22,1,.36,1) both;
}
@keyframes ac-enter {
  from { opacity: 0; transform: translateY(20px) scale(.972); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Cyan shimmer line that sweeps across the top */
.auth-card__beam {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(74,127,255,0) 6%,
    rgba(74,127,255,.7) 36%, rgba(0,229,255,1) 50%,
    rgba(74,127,255,.7) 64%, rgba(74,127,255,0) 94%,
    transparent 100%);
  animation: ac-beam 3.8s ease-in-out infinite;
}
@keyframes ac-beam {
  0%   { transform: translateX(-100%); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

/* Subtle inner glow at the bottom */
.auth-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(26,92,255,.18), transparent);
  pointer-events: none;
}

/* ── Sub-views ───────────────────────────────────────────────── */
.auth-view { display: flex; flex-direction: column; }
.auth-view[hidden] { display: none; }
.auth-view--active { animation: av-enter .3s cubic-bezier(.22,1,.36,1) both; }
@keyframes av-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── View header ─────────────────────────────────────────────── */
.av-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 500;
  letter-spacing: 2.8px; text-transform: uppercase;
  color: var(--blue-hi); margin-bottom: 10px;
}

.av-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px; letter-spacing: 2px; line-height: 1;
  background: linear-gradient(160deg, #fff 30%, #9ab4ff 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 7px;
}

.av-sub {
  font-size: 13.5px; color: var(--muted);
  font-weight: 300; line-height: 1.65; margin-bottom: 26px;
}

/* ── Back button ─────────────────────────────────────────────── */
.auth-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 500; letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted); padding: 0; margin-bottom: 20px;
  transition: color .2s;
}
.auth-back:hover { color: var(--blue-hi); }
.auth-back svg { flex-shrink: 0; transition: transform .2s; }
.auth-back:hover svg { transform: translateX(-3px); }

/* ── Discord button ──────────────────────────────────────────── */
.auth-discord {
  width: 100%; padding: 13px 16px;
  background: rgba(88,101,242,.1);
  border: 1px solid rgba(88,101,242,.28);
  border-radius: var(--r-md);
  color: rgba(190,200,255,.88);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 20px;
  transition: background .22s, border-color .22s, color .22s, box-shadow .22s, transform .15s;
}
.auth-discord:hover {
  background: rgba(88,101,242,.2);
  border-color: rgba(88,101,242,.5);
  color: #fff;
  box-shadow: 0 4px 28px rgba(88,101,242,.2);
  transform: translateY(-1px);
}
.auth-discord:active { transform: translateY(0); }

/* ── Divider ─────────────────────────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted2);
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(26,92,255,.18), transparent);
}

/* ── Alert banners ───────────────────────────────────────────── */
.auth-alert {
  display: none;
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  text-align: center; margin-bottom: 15px;
  animation: av-enter .22s both;
}
.auth-alert--err {
  display: block;
  background: rgba(255,58,92,.09); border: 1px solid rgba(255,58,92,.28);
  color: #ff8099;
}
.auth-alert--ok {
  display: block;
  background: rgba(0,255,136,.07); border: 1px solid rgba(0,255,136,.24);
  color: var(--green);
}

/* ── Fields ──────────────────────────────────────────────────── */
.af { margin-bottom: 15px; }

.af-meta {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 7px;
}
.af-label {
  display: flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 500; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 7px;
}
.af-meta .af-label,
.auth-otp-set .af-label { margin-bottom: 0; }
.auth-otp-set .af-label { margin-bottom: 10px; }

.af-hint {
  font-size: 9px; font-weight: 400; letter-spacing: .3px;
  text-transform: lowercase; font-style: italic; color: var(--muted2);
}

/* Forgot password inline link */
.af-link {
  background: none; border: none; cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12.5px; font-weight: 500; color: var(--blue-hi);
  padding: 0; transition: color .2s; white-space: nowrap;
}
.af-link:hover { color: var(--cyan); }

/* Input wrapper */
.af-wrap { position: relative; }

/* All text/email/password inputs */
.af-input {
  width: 100%; padding: 12px 16px;
  background: rgba(0,0,0,.46);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px; outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.af-input::placeholder { color: var(--muted2); opacity: .7; }
.af-input:hover:not(:focus) { border-color: rgba(255,255,255,.11); }
.af-input:focus {
  border-color: rgba(26,92,255,.7);
  background: rgba(0,0,0,.58);
  box-shadow: 0 0 0 3px rgba(26,92,255,.13);
}
/* Validation states applied by JS */
.af-input.is-err {
  border-color: rgba(255,58,92,.45) !important;
  box-shadow: 0 0 0 3px rgba(255,58,92,.1) !important;
}
.af-input.is-ok {
  border-color: rgba(0,255,136,.35) !important;
}
/* Password fields need room for the eye button */
.af-wrap .af-input { padding-right: 48px; }

/* Eye toggle */
.af-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  padding: 4px; display: flex; align-items: center; justify-content: center;
  color: var(--muted2); border-radius: 4px; transition: color .2s;
}
.af-eye:hover { color: var(--blue-hi); }
.af-eye-hide { display: none; }
.af-eye[data-visible="true"] .af-eye-show { display: none; }
.af-eye[data-visible="true"] .af-eye-hide { display: block; }

/* ── Password strength bar ───────────────────────────────────── */
.af-strength {
  height: 3px; margin-top: 7px; border-radius: 2px;
  background: rgba(255,255,255,.06); overflow: hidden;
}
.af-strength__fill {
  height: 100%; border-radius: 2px; width: 0%;
  transition: width .35s ease, background-color .35s ease;
}

/* ── Confirm password match label ────────────────────────────── */
.af-match {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: .5px;
  margin-top: 6px; min-height: 14px;
  transition: color .2s;
}
.af-match.is-ok  { color: var(--green); }
.af-match.is-err { color: #ff8099; }

/* ── Submit button ───────────────────────────────────────────── */
.auth-btn {
  width: 100%; padding: 14px 20px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dim) 100%);
  border: none; border-radius: var(--r-md);
  color: #fff; font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px; font-weight: 700; letter-spacing: .2px; cursor: pointer;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  transition: box-shadow .22s, transform .15s;
  box-shadow: 0 4px 22px rgba(26,92,255,.32);
}
.auth-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.09) 0%, transparent 55%);
  pointer-events: none;
}
.auth-btn:hover { box-shadow: 0 6px 38px rgba(26,92,255,.52); transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Loading spinner inside button */
.auth-btn__spin {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.22); border-top-color: #fff;
  border-radius: 50%; flex-shrink: 0;
  animation: auth-spin .65s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-btn.loading { pointer-events: none; }
.auth-btn.loading .auth-btn__label { opacity: .42; }
.auth-btn.loading .auth-btn__spin  { display: block; }

/* ── Switch / inline text links ──────────────────────────────── */
.auth-switch {
  text-align: center; color: var(--muted);
  font-size: 13px; margin-top: 18px;
}
.auth-tlink {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: inherit;
  font-weight: 600; color: var(--blue-hi); padding: 0;
  transition: color .2s;
}
.auth-tlink:hover { color: var(--cyan); }

/* ── OTP boxes (6-digit code) ────────────────────────────────── */
.auth-otp-set { border: none; margin-bottom: 15px; }
.auth-otp-row { display: flex; align-items: center; gap: 7px; }

.auth-otp-box {
  flex: 1; aspect-ratio: 1 / 1.1; min-width: 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 700; line-height: 1;
  background: rgba(0,0,0,.46);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  color: var(--text); outline: none; padding: 0;
  caret-color: transparent;
  transition: border-color .18s, box-shadow .18s, color .18s, background .18s;
}
.auth-otp-box:hover:not(:focus) { border-color: rgba(255,255,255,.12); }
.auth-otp-box:focus {
  border-color: rgba(26,92,255,.7);
  background: rgba(0,0,0,.6);
  box-shadow: 0 0 0 3px rgba(26,92,255,.14);
}
/* JS adds .filled when a digit is entered */
.auth-otp-box.filled {
  border-color: rgba(0,229,255,.38);
  color: var(--cyan);
  background: rgba(0,229,255,.03);
  box-shadow: 0 0 14px rgba(0,229,255,.1);
}
/* JS adds .shake on wrong code */
.auth-otp-box.shake { animation: otp-shake .38s ease; }
@keyframes otp-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-5px); }
  40%     { transform: translateX(5px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

.auth-otp-sep {
  color: var(--muted2); font-family: 'JetBrains Mono', monospace;
  font-size: 17px; flex-shrink: 0; user-select: none; padding: 0 1px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 500px) {
  .auth-card    { padding: 28px 18px 26px; border-radius: var(--r-lg); }
  .av-title     { font-size: 30px; }
  .auth-otp-row { gap: 5px; }
  .auth-otp-box { font-size: 18px; }
  .auth-otp-sep { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-view--active, .auth-card__beam,
  .auth-btn__spin, .auth-otp-box.shake,
  .af-strength__fill { animation: none !important; transition: none !important; }
}
