/* ═══════════════════════════════════════════════════════════════
   PRISM AUTH PAGE  —  auth.css  (v2 — refined & elevated)
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --auth-bg:           #060c18;
  --auth-form-bg:      #0c1628;
  --auth-card-bg:      rgba(16, 26, 50, 0.97);
  --auth-border:       rgba(79, 110, 247, 0.22);
  --auth-border-soft:  rgba(255, 255, 255, 0.09);
  --accent:            #4F6EF7;
  --accent-bright:     #6080ff;
  --accent-glow:       rgba(79, 110, 247, 0.4);
  --accent-dim:        rgba(79, 110, 247, 0.1);
  --cyan:              #38bdf8;
  --text-primary:      #eef2f8;
  --text-secondary:    #8096b8;
  --text-muted:        #3d5070;
  --error:             #f87171;
  --success:           #34d399;
  --transition:        0.22s ease;

  /* ── Font scale (mirrors style.css — auth.css is standalone) ── */
  --fs-micro:   0.68rem;   /* 10.9px */
  --fs-xss:     0.72rem;   /* 11.5px */
  --fs-xs:      0.78rem;   /* 12.5px */
  --fs-sm:      0.85rem;   /* 13.6px — body / form text          */
  --fs-base:    0.90rem;   /* 14.4px */
  --fs-ui:      0.95rem;   /* 15.2px */
  --fs-md:      1.00rem;   /* 16px   — buttons, card titles      */
  --fs-subhead: 1.00rem;   /* 16px   */
  --fs-lg:      1.20rem;   /* 19.2px */
  --fs-xl:      1.40rem;   /* 22.4px */
  --fs-2xl:     1.75rem;   /* 28px   */
  --fs-xxl:     2.00rem;   /* 32px   */
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--auth-bg);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  animation: auth-fadein 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes auth-fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */
.auth-page {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   LEFT — VISUAL PANEL
   ═══════════════════════════════════════════════════════ */
.auth-visual {
  flex: 0 0 58%;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(56,100,220,0.14) 0%, transparent 42%),
    radial-gradient(ellipse at 80% 80%, rgba(56,189,248,0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 55% 42%, #0c2448 0%, #070f22 50%, #030810 100%);
}

#auth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
}

/* Top + bottom vignette */
.auth-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(3,8,16,0.45) 0%, transparent 14%),
    linear-gradient(to top,    rgba(3,8,16,0.52) 0%, transparent 18%),
    radial-gradient(ellipse at 42% 52%, rgba(79,110,247,0.055) 0%, transparent 60%);
  pointer-events: none;
}

/* Right-edge atmospheric bleed */
.auth-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to right, transparent 62%, rgba(5,11,22,0.72) 84%, #050b16 100%);
  pointer-events: none;
}

/* Divider glow stripe */
.auth-visual-edge-glow {
  position: absolute;
  right: 0;
  top: 12%;
  bottom: 12%;
  width: 1px;
  z-index: 3;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(79,110,247,0.28) 30%,
    rgba(56,189,248,0.22) 55%,
    rgba(79,110,247,0.20) 75%,
    transparent
  );
  box-shadow: 0 0 20px 3px rgba(79,110,247,0.1);
  pointer-events: none;
}

/* Content overlay — 3-zone vertical */
.auth-visual-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 0 52px 48px 16px;
  pointer-events: none;
}

/* TOP: logo — matches header left-edge exactly */
.auth-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  pointer-events: all;
  align-self: flex-start;
  flex-shrink: 0;
  height: 100px;           /* same as header bar height */
}
.auth-logo-img { height: 100px; width: auto; }

/* MIDDLE: headline — centered with optical pull */
.auth-visual-headline {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 500px;
  padding-bottom: 20px;
  position: relative;
}

/* Soft ambient glow behind headline */
.auth-visual-headline::before {
  content: '';
  position: absolute;
  inset: -80px -60px;
  background: radial-gradient(ellipse at 40% 50%, rgba(79,110,247,0.09) 0%, transparent 68%);
  pointer-events: none;
  z-index: -1;
}
.auth-visual-headline h1 {
  font-size: clamp(1.9rem, 2.8vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: #eef2f8;
  margin-bottom: 16px;
}
.auth-visual-headline h1 em {
  font-style: normal;
  background: linear-gradient(115deg, #5b7bff 0%, #38bdf8 55%, #9ba8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-visual-headline p {
  font-size: var(--fs-base);
  color: #6a85a8;
  line-height: 1.7;
  max-width: 390px;
}

/* BOTTOM: pills */
.auth-visual-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-self: flex-start;
  flex-shrink: 0;
}
.auth-metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 99px;
  padding: 7px 15px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #7e93b0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.25s, color 0.25s;
}
.auth-metric-chip:hover { border-color: rgba(79,110,247,0.3); color: #a8bdd4; }
.auth-metric-chip svg { color: var(--accent); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   RIGHT — FORM PANEL
   ═══════════════════════════════════════════════════════ */
.auth-form-side {
  flex: 0 0 42%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 52px;
  overflow-y: auto;
  background: linear-gradient(160deg, #0e1b32 0%, #0b1628 45%, #08121e 100%);
  position: relative;
}

/* Dot-grid — very faint, atmospheric, masked to center */
.auth-form-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(79,110,247,0.065) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at 50% 50%, black 25%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 25%, transparent 72%);
}

/* Subtle top-edge ambient light from left panel */
.auth-form-side::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 8%,
    rgba(79,110,247,0.15) 28%,
    rgba(56,189,248,0.12) 52%,
    rgba(79,110,247,0.13) 72%,
    transparent 92%
  );
  pointer-events: none;
}

/* Elevated auth card */
.auth-card {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  background: linear-gradient(165deg, rgba(22, 36, 66, 0.98) 0%, rgba(14, 22, 44, 0.99) 100%);
  border: 1px solid rgba(255,255,255,0.095);
  border-radius: 20px;
  padding: 36px 36px 30px;
  box-shadow:
    0 0 0 1px rgba(79,110,247,0.07),
    0 2px 8px rgba(0,0,0,0.35),
    0 8px 32px rgba(0,0,0,0.45),
    0 24px 64px rgba(0,0,0,0.35),
    0 1px 0 rgba(255,255,255,0.07) inset,
    0 -1px 0 rgba(0,0,0,0.2) inset;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Top highlight line on card */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 14%; right: 14%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(100,140,255,0.55), rgba(56,189,248,0.35), rgba(100,140,255,0.45), transparent);
  border-radius: 99px;
}

/* ═══════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════ */
.auth-tabs {
  display: flex;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 26px;
}
.auth-tab {
  flex: 1;
  padding: 8.5px 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  letter-spacing: 0.01em;
}
.auth-tab.active {
  background: rgba(79,110,247,0.12);
  color: #c0d0f0;
  border-color: rgba(79,110,247,0.2);
}
.auth-tab:not(.active):hover { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════
   HEADING
   ═══════════════════════════════════════════════════════ */
.auth-heading { margin-bottom: 22px; }
.auth-heading h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 5px;
}
.auth-heading p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════
   ALERT
   ═══════════════════════════════════════════════════════ */
.auth-alert {
  padding: 10px 13px;
  border-radius: 8px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid transparent;
  display: none;
  margin-bottom: 6px;
}
.auth-alert.show { display: block; }
.auth-alert.error  { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); color: #fca5a5; }
.auth-alert.success{ background: rgba(52,211,153,0.08);  border-color: rgba(52,211,153,0.25);  color: #6ee7b7; }

/* ═══════════════════════════════════════════════════════
   PANELS
   ═══════════════════════════════════════════════════════ */
.auth-panel { display: none; }
.auth-panel.active { display: flex; flex-direction: column; gap: 12px; }

/* ═══════════════════════════════════════════════════════
   FIELDS
   ═══════════════════════════════════════════════════════ */
.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label {
  font-size: var(--fs-xss);
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #5a7498;
  text-transform: uppercase;
}
.auth-field input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.042);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 9px;
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}.auth-field input::placeholder { color: #364d68; }
.auth-field input:hover:not(:focus) {
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.055);
}
.auth-field input:focus {
  border-color: rgba(79,110,247,0.5);
  background: rgba(79,110,247,0.04);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.09), 0 0 14px rgba(79,110,247,0.06);
}
.auth-field input.error { border-color: rgba(248,113,113,0.45); }

.auth-field-error { font-size: var(--fs-xs); color: var(--error); display: none; margin-top: 1px; }
.auth-field input.error + .auth-field-error { display: block; }

/* remember / forgot */
.auth-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1px 0 3px;
}
.auth-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.auth-remember input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.auth-forgot { font-size: var(--fs-sm); color: #4060c0; text-decoration: none; transition: color 0.2s; }
.auth-forgot:hover { color: var(--accent-bright); }

/* ═══════════════════════════════════════════════════════
   PRIMARY BUTTON
   ═══════════════════════════════════════════════════════ */
.auth-btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4a68f0 0%, #5b7bff 100%);
  border: 1px solid rgba(79,110,247,0.35);
  border-radius: 10px;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  letter-spacing: 0.015em;
}
.auth-btn-primary:hover {
  box-shadow: 0 4px 22px rgba(79,110,247,0.38), 0 1px 4px rgba(0,0,0,0.4);
  transform: translateY(-1px);
}
.auth-btn-primary:active { transform: translateY(0); box-shadow: none; }
.auth-btn-primary .btn-spinner {
  display: none;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.auth-btn-primary.loading .btn-spinner { display: block; }
.auth-btn-primary.loading .btn-label  { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 55%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s ease;
}
.auth-btn-primary:hover::after { left: 160%; }

/* ═══════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════ */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.055);
}
.auth-divider span {
  font-size: var(--fs-xss);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════
   OAUTH BUTTONS
   ═══════════════════════════════════════════════════════ */
.auth-oauth-row { display: flex; gap: 9px; }
.auth-oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.038);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 9px;
  color: #6e88a8;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
}
.auth-oauth-btn:hover {
  background: rgba(255,255,255,0.075);
  border-color: rgba(255,255,255,0.16);
  color: #b4c8e0;
  transform: translateY(-1px);
}
.auth-oauth-btn:active { transform: translateY(0); }
.auth-oauth-btn svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   SWITCH LINK
   ═══════════════════════════════════════════════════════ */
.auth-switch {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 18px;
}
.auth-switch a, .auth-switch button {
  color: #4a68d4;
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  transition: color 0.2s;
}
.auth-switch a:hover, .auth-switch button:hover { color: var(--accent-bright); }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  html, body { overflow: auto; }
  .auth-page { flex-direction: column; height: auto; min-height: 100vh; }
  .auth-visual { flex: none; height: 240px; }
  .auth-visual-headline { display: none; }
  .auth-visual-metrics  { display: none; }
  .auth-visual-content  { padding: 22px 28px; }
  .auth-form-side { flex: none; padding: 36px 28px 52px; }
  .auth-card { padding: 28px 24px 22px; }
}

@media (max-width: 480px) {
  .auth-form-side { padding: 24px 16px 40px; }
  .auth-card { padding: 22px 16px 18px; border-radius: 16px; }
  .auth-oauth-row { flex-direction: column; }
}

/* ── Top-center toast notification ─────────────────────────── */
.auth-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.04);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  z-index: 9999;
  cursor: pointer;
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}
.auth-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Error — red tint */
.auth-toast--error {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.50);
  color: #fca5a5;
}
.auth-toast--error svg { color: #f87171; flex-shrink: 0; }

/* Success — green tint */
.auth-toast--success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.48);
  color: #86efac;
}
.auth-toast--success svg { color: #4ade80; flex-shrink: 0; }

/* Warning — yellow tint (server-side / config errors) */
.auth-toast--warning {
  background: rgba(234, 179, 8, 0.11);
  border-color: rgba(234, 179, 8, 0.48);
  color: #fde68a;
}
.auth-toast--warning svg { color: #facc15; flex-shrink: 0; }
