/* Phase 4.i.2 — auth UI v2.
   Shared stylesheet for /login.html, /register.html, /forgot-password.html,
   /reset-password.html, /verify-2fa.html. Glassmorphic depth, sans-serif
   heading, starfield backdrop, carved-in inputs, dark specular button. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #050507;
  color: #f5f5f7;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Backdrop — multi-layered: dark base + cosmic dust + subtle
   light-leak gradients. The dust is procedural radial-gradients
   (no asset to load). The gradients suggest a single warm light
   source above the scene without painting any hard color cast.
   ============================================================ */

body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 15%, rgba(70, 90, 150, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 85%, rgba(120, 80, 180, 0.07) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Procedural starfield. Each radial-gradient is ONE star. Tiny size
   keeps them sharp; low opacity keeps them subtle. Spread them across
   the viewport with different positions. */
body::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 22%, rgba(255,255,255,0.42) 0%, transparent 0.10%),
    radial-gradient(circle at 23% 73%, rgba(255,255,255,0.32) 0%, transparent 0.08%),
    radial-gradient(circle at 8% 88%, rgba(255,255,255,0.5) 0%, transparent 0.10%),
    radial-gradient(circle at 41% 12%, rgba(255,255,255,0.28) 0%, transparent 0.06%),
    radial-gradient(circle at 68% 27%, rgba(255,255,255,0.55) 0%, transparent 0.10%),
    radial-gradient(circle at 84% 55%, rgba(255,255,255,0.36) 0%, transparent 0.08%),
    radial-gradient(circle at 91% 18%, rgba(255,255,255,0.40) 0%, transparent 0.08%),
    radial-gradient(circle at 78% 92%, rgba(255,255,255,0.30) 0%, transparent 0.06%),
    radial-gradient(circle at 47% 62%, rgba(255,255,255,0.22) 0%, transparent 0.06%),
    radial-gradient(circle at 33% 38%, rgba(255,255,255,0.18) 0%, transparent 0.06%),
    radial-gradient(circle at 56% 8%, rgba(255,255,255,0.30) 0%, transparent 0.06%),
    radial-gradient(circle at 19% 46%, rgba(255,255,255,0.16) 0%, transparent 0.06%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   Brand wordmark above the card
   ============================================================ */

.brand {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}
.brand .name {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}
.brand .tagline {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  margin-top: 5px;
}

/* ============================================================
   Card — central glass surface with real depth
   ============================================================ */

.auth-card {
  position: relative;
  z-index: 1;
  max-width: 460px;
  width: 100%;
  padding: 42px 40px 30px;
  /* Subtle warm-to-cool gradient: a touch brighter at top to suggest
     light hitting the upper edge. */
  background: linear-gradient(165deg,
    rgba(32, 34, 42, 0.62) 0%,
    rgba(18, 19, 24, 0.72) 50%,
    rgba(10, 11, 14, 0.82) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  /* Stacked shadows:
     - inset top highlight (rim of light catching the top edge)
     - inset bottom shadow (darkness pooling at the lower lip)
     - outer drop shadow for lift
     - inset hairline outer shadow for definition against the page */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 30px 60px rgba(0, 0, 0, 0.5),
    0 80px 100px -40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 0, 0, 0.5);
}

/* Light-source pseudo-element: simulates a soft warm light hitting
   the top-left of the card. Positioned absolute inside the card
   with overflow allowed via filter:blur. */
.auth-card::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(ellipse at 30% 30%,
    rgba(110, 130, 200, 0.16) 0%,
    rgba(80, 100, 180, 0.06) 30%,
    transparent 60%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

/* Subtle blue edge-glow leaking from the LEFT side of the card —
   the signature touch from the reference. Outside the card, blurred,
   barely visible but adds the "expensive" cue. */
.auth-card::after {
  content: '';
  position: absolute;
  top: 12%;
  left: -30px;
  width: 60px;
  height: 50%;
  background: radial-gradient(ellipse at center,
    rgba(80, 130, 230, 0.35) 0%,
    rgba(80, 130, 230, 0.0) 70%);
  filter: blur(28px);
  pointer-events: none;
  z-index: -1;
}

/* All card content sits above the pseudo elements */
.auth-card > * { position: relative; z-index: 1; }

/* ============================================================
   Header — sans-serif, weighted, no Georgia
   ============================================================ */

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: 30px;
  font-weight: 600;
  color: #f5f5f7;
  letter-spacing: -0.018em;
  margin: 0 0 10px;
  line-height: 1.1;
}
.auth-header p {
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 auto;
  max-width: 340px;
  font-weight: 400;
}

/* ============================================================
   Input fields — carved-in feel
   ============================================================ */

.field {
  position: relative;
  margin-bottom: 12px;
}
.field-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.40);
  pointer-events: none;
  width: 16px;
  height: 16px;
  z-index: 2;
}
.field input[type=text],
.field input[type=email],
.field input[type=password] {
  width: 100%;
  padding: 14px 16px 14px 44px;
  /* Slightly DARKER at top (light-from-above implies the well goes deeper)
     and a touch lighter at the bottom — opposite of the card. */
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.30) 0%,
    rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  /* Inset shadows: dark at top-inside (depth) + light at bottom-inside
     (catching ambient light). Subtle outer glow on focus only. */
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.field input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 400;
}
.field input:focus {
  outline: none;
  border-color: rgba(140, 160, 220, 0.30);
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.28) 0%,
    rgba(255, 255, 255, 0.03) 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 3px rgba(140, 160, 220, 0.08);
}

/* ============================================================
   Form rows / labels
   ============================================================ */

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 22px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
}
.form-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.form-row input[type=checkbox] {
  accent-color: #c9a96a;
  width: 14px;
  height: 14px;
}
.form-row a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.15s;
}
.form-row a:hover { color: #c9a96a; }

/* For pages that use labels above inputs (forgot-password, reset-password) */
.field-label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin: 14px 0 8px;
  font-weight: 500;
}
.field-hint {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.42);
  margin: 6px 2px 14px;
  line-height: 1.45;
}

/* ============================================================
   Submit button — dark, carved-in, with specular highlight
   ============================================================ */

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: linear-gradient(180deg,
    rgba(28, 30, 36, 0.95) 0%,
    rgba(10, 11, 14, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s, border-color 0.18s, transform 0.1s, box-shadow 0.18s;
  /* Specular: bright top-edge highlight + deep outer shadow + inner bottom shadow */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    0 6px 18px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.5);
}
.btn:hover {
  background: linear-gradient(180deg,
    rgba(36, 38, 46, 0.95) 0%,
    rgba(14, 15, 19, 0.95) 100%);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    0 10px 24px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.5);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: wait; }

/* ============================================================
   Footer
   ============================================================ */

.auth-footer {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}
.auth-footer a {
  color: #c9a96a;
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* ============================================================
   Error / success messages
   ============================================================ */

.auth-error,
.auth-success {
  display: none;
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}
.auth-error.visible {
  display: block;
  background: rgba(255, 90, 90, 0.07);
  border: 1px solid rgba(255, 90, 90, 0.22);
  color: #ffb0b0;
}
.auth-success.visible {
  display: block;
  background: rgba(90, 235, 170, 0.07);
  border: 1px solid rgba(90, 235, 170, 0.22);
  color: #a6f0c8;
}

/* ============================================================
   Password strength bar (register page)
   ============================================================ */

.pw-strength {
  height: 3px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}
.pw-strength-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c9a96a 0%, #e6c789 100%);
  transition: width 0.25s, background 0.25s;
  border-radius: 2px;
}
.pw-strength-bar.weak   { width: 33%; background: linear-gradient(90deg, #d96a6a 0%, #e69090 100%); }
.pw-strength-bar.medium { width: 66%; background: linear-gradient(90deg, #d9a36a 0%, #e6c789 100%); }
.pw-strength-bar.strong { width: 100%; background: linear-gradient(90deg, #6ad9a3 0%, #89e6c0 100%); }

.form-hint {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.42);
  margin: 6px 2px 0;
  line-height: 1.45;
}

/* ============================================================
   TOTP input (verify-2fa page)
   ============================================================ */

.totp-input {
  width: 100%;
  padding: 18px 16px;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.30) 0%,
    rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  color: #fff;
  font-family: 'Inter', monospace;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.5em;
  text-align: center;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}
.totp-input::placeholder {
  color: rgba(255, 255, 255, 0.20);
  letter-spacing: 0.5em;
}
.totp-input:focus {
  outline: none;
  border-color: rgba(140, 160, 220, 0.30);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 3px rgba(140, 160, 220, 0.08);
}

/* ============================================================
   Generic message (used by forgot/reset pages)
   ============================================================ */

.msg {
  margin-top: 18px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  display: none;
}
.msg.ok {
  display: block;
  background: rgba(90, 235, 170, 0.07);
  border: 1px solid rgba(90, 235, 170, 0.22);
  color: #a6f0c8;
}
.msg.err {
  display: block;
  background: rgba(255, 90, 90, 0.07);
  border: 1px solid rgba(255, 90, 90, 0.22);
  color: #ffb0b0;
}

/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 540px) {
  .auth-card { padding: 34px 26px 26px; }
  .brand { top: 22px; }
  .auth-header h1 { font-size: 26px; }
  .auth-card::after { display: none; } /* edge glow doesn't read on small screens */
}
