/* ============================================================
   DESIGN TOKENS (Premium Obsidian & Gold Theme)
   ============================================================ */
:root {
  --gold: #D4AF37;
  --gold-light: #F5D77F;
  --gold-glow: rgba(212, 175, 55, 0.15);
  --gold-glow-strong: rgba(212, 175, 55, 0.35);
  --dark-bg: #0A0A0A;
  --dark-card: #121212;
  --dark-card-light: #1E1E1E;
  --glass-border: rgba(212, 175, 55, 0.12);
  --glass-bg: rgba(18, 18, 18, 0.65);
  --text-primary: #F0EFED;
  --text-secondary: rgba(240, 239, 237, 0.7);
  --text-muted: rgba(240, 239, 237, 0.45);
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 45px rgba(212, 175, 55, 0.1);
  --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* ============================================================
   RESET & SYSTEM STYLES
   ============================================================ */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: var(--dark-bg);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 40px 0;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   AMBIENT BACKGROUND SPHERES
   ============================================================ */
.bg-sphere {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
  animation: floatSphere 20s infinite ease-in-out alternate;
}
.bg-sphere-1 {
  width: 400px;
  height: 400px;
  background: var(--gold);
  top: -100px;
  left: -100px;
}
.bg-sphere-2 {
  width: 500px;
  height: 500px;
  background: #5c4308;
  bottom: -150px;
  right: -150px;
  animation-delay: -5s;
}

@keyframes floatSphere {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.15); }
}

/* Floating particles */
.bg-particles {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-particles .p {
  position: absolute;
  width: 2px; height: 2px;
  background: var(--gold-light);
  border-radius: 50%;
  opacity: 0;
  animation: floatP 8s ease-in-out infinite;
}
.bg-particles .p:nth-child(1) { left: 12%; top: 18%; animation-delay: 0s; animation-duration: 7s; }
.bg-particles .p:nth-child(2) { left: 30%; top: 65%; animation-delay: 1.2s; animation-duration: 9s; }
.bg-particles .p:nth-child(3) { left: 55%; top: 25%; animation-delay: 2.4s; animation-duration: 6.5s; }
.bg-particles .p:nth-child(4) { left: 75%; top: 55%; animation-delay: 3.6s; animation-duration: 8.5s; }
.bg-particles .p:nth-child(5) { left: 88%; top: 20%; animation-delay: 1s; animation-duration: 10s; }
.bg-particles .p:nth-child(6) { left: 42%; top: 78%; animation-delay: 4.2s; animation-duration: 7.5s; }

@keyframes floatP {
  0%, 100% { opacity: 0; transform: translateY(0) scale(1); }
  20% { opacity: 0.5; }
  50% { opacity: 0.25; transform: translateY(-50px) scale(1.4); }
  80% { opacity: 0.4; }
}

/* ============================================================
   AUTH CARD - GLASSMORPHISM
   ============================================================ */
.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 20px;
  animation: cardEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card {
  background: var(--glass-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 44px 36px 36px;
  box-shadow:
    var(--shadow-card),
    var(--shadow-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

/* Subtle top-edge gold shine */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ── Logo ── */
.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.auth-logo {
  width: 68px; height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(212, 175, 55, 0.15);
  filter: drop-shadow(0 0 20px var(--gold-glow-strong));
  transition: var(--transition-smooth);
}
.auth-logo:hover {
  transform: scale(1.06);
  border-color: var(--gold);
}

/* ── Heading ── */
.auth-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  letter-spacing: 0.3px;
}

/* ============================================================
   FORM FIELDS & FLOATING LABELS
   ============================================================ */
.form-group {
  margin-bottom: 22px;
  position: relative;
  padding-top: 8px; /* space for floated label */
}

.form-label {
  position: absolute;
  top: 24px;
  left: 18px;
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  pointer-events: none;
  letter-spacing: 0.5px;
  background: transparent;
  padding: 0;
  z-index: 2;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
  position: relative;
  z-index: 1;
}

/* Floating behavior using :has() or sibling selectors */
.form-group:has(.form-input:focus) .form-label,
.form-group:has(.form-input:not(:placeholder-shown)) .form-label {
  top: -2px;
  left: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0 6px;
  background: #121212;
  z-index: 3;
}

/* Validation glows */
.form-input:focus {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.04);
  box-shadow:
    0 0 0 3px rgba(212, 175, 55, 0.12),
    0 0 20px rgba(212, 175, 55, 0.08);
}

.form-input:focus:invalid:not(:placeholder-shown) {
  border-color: var(--error);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
}

.form-input:focus:valid:not(:placeholder-shown) {
  border-color: var(--success);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.25);
}

.form-input:hover:not(:focus) {
  border-color: rgba(212, 175, 55, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

/* Two-column layout */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Password Toggle */
.password-wrapper {
  position: relative;
  z-index: 1;
}
.password-toggle {
  position: absolute;
  right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  transition: color 0.3s ease;
  z-index: 2;
}
.password-toggle:hover { color: var(--gold-light); }
.password-toggle svg { width: 18px; height: 18px; }

/* ============================================================
   PASSWORD STRENGTH BAR
   ============================================================ */
.strength-bar-wrap {
  margin-top: 8px;
  display: none;
}
.strength-bar-wrap.visible { display: block; }

.strength-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.strength-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.4s ease, background 0.4s ease;
}
.strength-label {
  font-size: 11px;
  margin-top: 4px;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.strength-0 .strength-bar-fill { width: 0%; background: transparent; }
.strength-1 .strength-bar-fill { width: 25%; background: var(--error); }
.strength-1 .strength-label { color: #fca5a5; }
.strength-2 .strength-bar-fill { width: 50%; background: var(--warning); }
.strength-2 .strength-label { color: #fcd34d; }
.strength-3 .strength-bar-fill { width: 75%; background: #60a5fa; }
.strength-3 .strength-label { color: #93c5fd; }
.strength-4 .strength-bar-fill { width: 100%; background: var(--success); }
.strength-4 .strength-label { color: #86efac; }

/* ============================================================
   CUSTOM PREMIUM CHECKBOXES
   ============================================================ */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}
.checkbox-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--glass-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.checkbox-group input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.checkbox-group input[type="checkbox"]:checked::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  position: absolute;
  top: 2px;
}
.checkbox-group input[type="checkbox"]:focus {
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}
.checkbox-group label {
  cursor: pointer;
}
.checkbox-group a {
  color: var(--gold);
  font-weight: 600;
  transition: var(--transition-smooth);
}
.checkbox-group a:hover {
  color: var(--gold-light);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-auth {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #000;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-bounce);
  box-shadow: 0 6px 24px var(--gold-glow-strong);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-auth::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.btn-auth:hover::after { transform: translateX(100%); }
.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px var(--gold-glow-strong);
}
.btn-auth:active { transform: translateY(0) scale(0.98); }
.btn-auth:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner inside button */
.btn-auth .spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
}
.btn-auth.loading .spinner { display: inline-block; }
.btn-auth.loading .btn-text { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Google Sign-In Button ── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-top: 16px;
}
.btn-google:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}
.btn-google svg {
  width: 18px;
  height: 18px;
}

/* ============================================================
   LINKS & DIVIDERS
   ============================================================ */
.auth-links {
  margin-top: 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-link {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}
.auth-link:hover { color: var(--gold-light); }
.auth-link strong {
  color: var(--gold);
  font-weight: 600;
}
.auth-link:hover strong { color: var(--gold-light); }

.auth-divider {
  width: 40px; height: 1px;
  background: var(--glass-border);
  margin: 0 auto;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  transition: color 0.3s ease;
}
.auth-back:hover { color: var(--text-primary); }
.auth-back svg { width: 14px; height: 14px; }

/* ============================================================
   ERROR / SUCCESS MESSAGES
   ============================================================ */
.auth-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  display: none;
  animation: fadeMsg 0.4s ease;
  line-height: 1.5;
}
.auth-message.show { display: block; }
.auth-message.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.auth-message.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}
@keyframes fadeMsg {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 520px) {
  .auth-card { padding: 32px 22px 28px; border-radius: var(--radius-md); }
  .auth-title { font-size: 21px; }
  .auth-logo { width: 56px; height: 56px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   CINEMATIC SPLIT PRELOADER & PAGE ZOOM
   ============================================================ */
.auth-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  pointer-events: auto;
}

.auth-loader-panel {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: #08080a; /* Obsidian black */
  transition: transform 1.2s cubic-bezier(0.85, 0, 0.15, 1);
  z-index: 1;
}

.auth-loader-panel.left-panel {
  left: 0;
  border-right: 1.5px solid rgba(212, 175, 55, 0.08);
}

.auth-loader-panel.right-panel {
  right: 0;
  border-left: 1.5px solid rgba(212, 175, 55, 0.08);
}

.auth-content-wrap,
.auth-loader-content-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* When preloader is done */
.auth-loader.done {
  pointer-events: none;
}

.auth-loader.done .auth-loader-content-wrap {
  opacity: 0;
  transform: scale(1.12);
}

.auth-loader.done .auth-loader-panel.left-panel {
  transform: translateX(-100%);
}

.auth-loader.done .auth-loader-panel.right-panel {
  transform: translateX(100%);
}

.auth-loader-logo-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.auth-loader-logo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  animation: loaderPulse 2.2s cubic-bezier(0.445, 0.05, 0.55, 0.95) infinite;
  filter: drop-shadow(0 0 25px rgba(212, 175, 55, 0.35)); /* Gold Glow */
  border: 1px solid rgba(212, 175, 55, 0.15);
  padding: 2px;
  z-index: 2;
}

.auth-loader-ring {
  width: 104px;
  height: 104px;
  position: absolute;
  border: 2px solid transparent;
  border-top: 2px solid var(--gold); /* Gold Accent */
  border-bottom: 2px solid var(--gold-light);
  border-radius: 50%;
  animation: loaderSpin 1.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  z-index: 1;
}

.auth-loader-pulse-wave {
  position: absolute;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  opacity: 0;
  animation: loaderPulseRadar 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
  z-index: 0;
}

.auth-loader-text {
  margin-top: 24px;
  font-size: 12px;
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: 700;
  background: linear-gradient(90deg, #fff 0%, var(--gold-light) 30%, var(--gold) 50%, var(--gold-light) 70%, #fff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shinePreloaderText 3s linear infinite;
}

.auth-loader-progress-wrap {
  width: 150px;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin-top: 20px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.01);
}

.auth-loader-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Page Wrapper 3D Cinematic Zoom for Auth Pages */
.page-wrapper {
  opacity: 0 !important;
  filter: blur(12px) !important;
  transform: scale(0.94) translateY(15px) !important;
  transition: opacity 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

body.loaded .page-wrapper {
  opacity: 1 !important;
  filter: blur(0) !important;
  transform: scale(1) translateY(0) !important;
}

@keyframes shinePreloaderText {
  to { background-position: 200% center; }
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.75; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes loaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes loaderPulseRadar {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ============================================================
   ACCESSIBILITY: PREFERS REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .bg-sphere {
    animation: none !important;
  }
  .bg-particles .p {
    animation: none !important;
    opacity: 0.3 !important;
  }
}
