/* ==========================================================================
   SIFRA INTELLIGENCE — Sovereign Authentication Architecture
   Inspired by Apple ID & NVIDIA Enterprise Account standard
   Precision dark mode, zero clutter, cinema-grade glassmorphism
   ========================================================================== */

/* Strict Utility lock */
.auth-step-hidden {
  display: none !important;
}

/* Page Viewport Stage */
.auth-viewport {
  position: relative;
  min-height: calc(100vh - var(--nav-h, 66px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 72px) 20px clamp(48px, 8vw, 96px);
  background:
    radial-gradient(ellipse 700px 350px at 50% 0%, rgba(59, 130, 246, 0.12), transparent 70%),
    radial-gradient(circle 600px at 50% 100%, rgba(30, 58, 138, 0.08), transparent 70%),
    var(--bg, #060815);
  overflow: hidden;
}

/* Subtle background precision grid */
.auth-viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
  mask-image: radial-gradient(circle at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* Centered Authentication Terminal Box */
.auth-card-clean {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: rgba(10, 14, 28, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  padding: clamp(28px, 5vw, 40px) clamp(22px, 4vw, 36px);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 
    0 30px 80px -20px rgba(0, 0, 9, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition: border-color 0.3s ease;
}

/* Card Header */
.auth-head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg-2, #b8c2d6);
  text-transform: uppercase;
}

.auth-brand-badge .brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ember, #3b82f6);
  box-shadow: 0 0 8px var(--ember, #3b82f6);
}

.auth-title {
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif);
  font-size: clamp(22px, 3.2vw, 27px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 0 0 6px;
  line-height: 1.25;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--muted, #7e8aa3);
  margin: 0;
  line-height: 1.5;
}

/* Mode Switcher Pills (Top Segmented Control) */
.auth-segment {
  display: flex;
  padding: 4px;
  background: rgba(5, 8, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  margin-bottom: 24px;
  gap: 4px;
}

.auth-segment-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #7e8aa3);
  text-decoration: none;
  transition: all 0.2s ease;
  user-select: none;
}

.auth-segment-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}

.auth-segment-tab.active {
  color: #ffffff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Alert Boxes */
.auth-msg {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.auth-msg.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.auth-msg.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.auth-msg.hidden {
  display: none !important;
}

/* Mandatory Compliance Consent Cards */
.auth-consent-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-consent-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s ease;
  cursor: pointer;
}

.auth-consent-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.035);
}

.auth-consent-card.checked {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 16px -4px rgba(59, 130, 246, 0.2);
}

.auth-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 2px 0 0;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(5, 8, 20, 0.8);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.auth-checkbox:hover {
  border-color: var(--ember, #3b82f6);
}

.auth-checkbox:checked {
  background: var(--ember, #3b82f6);
  border-color: var(--ember, #3b82f6);
}

.auth-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-consent-text {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--fg-2, #cbd5e1);
  user-select: none;
  margin: 0;
}

.auth-consent-text a {
  color: #60a5fa;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.auth-consent-text a:hover {
  color: #93c5fd;
}

/* Live Calculated Age Badge & Minor Guardian Consent */
.auth-age-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  width: fit-content;
  border: 1px solid transparent;
}
.auth-age-badge.hidden { display: none; }
.auth-age-badge.adult {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.auth-age-badge.minor {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.38);
  color: #fcd34d;
}
.auth-age-badge.blocked {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.38);
  color: #fca5a5;
}

.auth-guardian-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.28);
}
.auth-guardian-box.hidden { display: none; }
.auth-guardian-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.auth-guardian-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #fcd34d;
  line-height: 1.3;
}
.auth-guardian-sub {
  font-size: 11px;
  color: var(--fg-2, #cbd5e1);
  margin-top: 2px;
  line-height: 1.4;
}

/* Real-Time Password Strength & Match Meter */
.auth-pass-meter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: -4px;
}
.auth-pass-meter.hidden { display: none; }
.auth-pass-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.auth-pass-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease;
}
.auth-pass-bar.weak { background: #ef4444; }
.auth-pass-bar.fair { background: #f59e0b; }
.auth-pass-bar.good { background: #3b82f6; }
.auth-pass-bar.strong { background: #10b981; }
.auth-pass-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  gap: 8px;
}
.auth-pass-label { color: var(--fg-2, #cbd5e1); font-weight: 500; }
.auth-pass-match { font-weight: 600; }
.auth-pass-match.ok { color: #6ee7b7; }
.auth-pass-match.bad { color: #fca5a5; }

/* Google OAuth Button */
.auth-btn-google {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.auth-btn-google:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-0.5px);
}

.auth-btn-google:active:not(:disabled) {
  transform: translateY(0);
}

.auth-btn-google:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.8);
}

.auth-btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Hairline Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--muted, #7e8aa3);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

/* Form Layout */
.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.auth-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2, #b8c2d6);
  letter-spacing: 0.02em;
}

.auth-label .req {
  color: #60a5fa;
  font-weight: 700;
  margin-left: 3px;
}

.auth-label .auth-link-inline {
  font-size: 11.5px;
  font-weight: 500;
  color: #60a5fa;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-label .auth-link-inline:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: rgba(6, 9, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.auth-input.has-toggle {
  padding-right: 42px;
}

.auth-input::placeholder {
  color: rgba(148, 163, 184, 0.45);
}

.auth-input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.auth-input:focus {
  border-color: var(--ember, #3b82f6);
  background: rgba(6, 9, 22, 0.95);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

/* Custom calendar color picker */
.auth-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.auth-input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.auth-toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted, #7e8aa3);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s ease;
}

.auth-toggle-pass:hover {
  color: #ffffff;
}

/* 2-Column Row for Desktop */
.auth-row-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .auth-row-dual {
    grid-template-columns: 1fr;
  }
}

/* Primary CTA Button */
.auth-btn-primary {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  user-select: none;
}

.auth-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-0.5px);
}

.auth-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.auth-btn-primary:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  filter: grayscale(0.6);
}

/* Step 2: OTP Verification Card */
.auth-otp-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.auth-otp-icon-wrap {
  width: 52px;
  height: 52px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
}

.auth-otp-head {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.auth-otp-sub {
  font-size: 13px;
  color: var(--muted, #7e8aa3);
  margin: 0;
  line-height: 1.45;
}

.auth-otp-target {
  color: #ffffff;
  font-family: var(--mono, monospace);
  font-weight: 600;
}

.auth-otp-input {
  width: 100%;
  height: 54px;
  padding: 0 12px;
  background: rgba(6, 9, 22, 0.85);
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  border-radius: 12px;
  color: #60a5fa;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 12px;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.auth-otp-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
  background: rgba(6, 9, 22, 0.98);
}

.auth-otp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--muted, #7e8aa3);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.2s ease;
}

.auth-link-btn:hover {
  color: #60a5fa;
}

/* Card Bottom Footer */
.auth-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
  font-size: 13px;
  color: var(--muted, #7e8aa3);
}

.auth-foot a {
  color: #60a5fa;
  font-weight: 600;
  margin-left: 4px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-foot a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* Security Ribbon */
.auth-security-note {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.6);
  font-family: var(--mono, monospace);
  letter-spacing: 0.02em;
}

.auth-security-note span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Spinner */
.auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}
