/* Visual match to Kelly-App's main layout (Kelly-App/src/index.css / KellyAvatar.tsx) -- this
   page is plain CSS, not Tailwind, since it's served static, before any session/build exists
   (see auth-guard.ts). Tokens copied by hand from index.css's .apple-glass-card / body rules. */

* {
  box-sizing: border-box;
}

/* Author-stylesheet `display` rules below (.stack, #biometricSection) have equal-or-higher
   specificity than the browser's own default `[hidden]{display:none}` UA rule, which loses the
   cascade to any author rule regardless of source order -- without this, an element that's both
   `hidden` and `.stack`/`#biometricSection` renders visible anyway. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background-color: #000000;
  color: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-page {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  max-width: 900px;
  width: 100%;
}

/* Video box -- same rounded-frame treatment as KellyAvatar.tsx's hero frame (480x680), scaled
   down to fit a login page instead of the full app shell. */
.video-frame {
  position: relative;
  width: 320px;
  height: 420px;
  border-radius: 36px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
  background: #111;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

.video-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, black, rgba(0, 0, 0, 0.15) 40%, transparent 70%);
  pointer-events: none;
}

/* The "digital box" panel -- where HoloScreen would render in the main app, holding the
   password/biometric/TOTP UI instead on this page. */
.card {
  background: rgba(24, 24, 28, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.card h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: #fff;
}

/* Session tier picker -- which cosmetic skin (avatar clips/logo/wallpaper) loads once signed in.
   Purely a UI choice like KellyAvatar.tsx's own tier system; the labels are deliberately not the
   internal tier names (see Kelly-App's types/index.ts SESSION_TIER_LABELS). */
.session-picker {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.session-option {
  flex: 1;
  background: none;
  border: none;
  border-radius: 999px;
  padding: 7px 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.25;
  color: #a1a1aa;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.session-option:hover {
  color: #f5f5f7;
}

.session-option.active {
  background: #fff;
  color: #000;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a1a1aa;
}

.field input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 11px 14px;
  color: #f5f5f7;
  font-size: 15px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn {
  background: #fff;
  color: #000;
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-error {
  color: #fb7185;
  font-size: 12px;
  margin: 0;
  min-height: 1em;
}

.link {
  background: none;
  border: none;
  color: #a1a1aa;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  padding: 0;
}

.link:hover {
  color: #f5f5f7;
}

.text-muted {
  color: #a1a1aa;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.qr-container {
  display: flex;
  justify-content: center;
  margin: 4px 0;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
}

.qr-container svg {
  width: 180px;
  height: 180px;
}

.totp-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
  word-break: break-all;
  color: #f5f5f7;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
}

#biometricSection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

#biometricSection p.hint {
  font-size: 12px;
  color: #a1a1aa;
  text-align: center;
  margin: 0;
}

@media (max-width: 700px) {
  .login-page {
    flex-direction: column;
    align-items: center;
  }
  .video-frame {
    width: 260px;
    height: 340px;
  }
  .card {
    width: 100%;
    max-width: 320px;
  }
}
