/* ============================================================
   AUTH OVERLAY — Orbital Prism  (blue × grey palette)
   ============================================================ */

/* ── Google Font: Space Grotesk for display text ────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&display=swap');

/* ── CSS CUSTOM PROPS ───────────────────────────────────────── */
:root {
  --ab-bg-deep:   #06090f;
  --ab-bg-mid:    #0b1120;
  --ab-blue-1:    #3b82f6;
  --ab-blue-2:    #60a5fa;
  --ab-blue-3:    #93c5fd;
  --ab-cyan:      #22d3ee;
  --ab-grey-1:    #1e2a3a;
  --ab-grey-2:    #2d3f55;
  --ab-grey-3:    #64748b;
  --ab-grey-4:    #94a3b8;
  --ab-white:     #e2eaf5;
  --ab-glass:     rgba(15, 25, 50, 0.72);
  --ab-ring:      rgba(59, 130, 246, 0.22);
  --ab-glow:      rgba(96, 165, 250, 0.45);
  --ab-font:      'Space Grotesk', 'Inter', sans-serif;
}

/* ── AUTH BACKDROP ────────────────────────────────────────────── */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  /* Deep Space Gradient */
  background: 
    radial-gradient(circle at 35% 45%, rgba(16, 28, 64, 0.45) 0%, rgba(4, 7, 14, 0.98) 75%),
    linear-gradient(135deg, #050812 0%, #0b1122 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  font-family: var(--ab-font);
  overflow: hidden;
}

/* Cyber grid lines overlay */
.auth-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center center;
  pointer-events: none;
  z-index: 1;
}

/* Pulsing ambient glowing beacon */
.auth-backdrop::after {
  content: '';
  position: absolute;
  top: 30%;
  left: 20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.06) 0%, rgba(59, 130, 246, 0.03) 40%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 2;
  animation: pulseBeacon 8s ease-in-out infinite alternate;
}

@keyframes pulseBeacon {
  0% {
    transform: translate(-30px, -20px) scale(0.9);
    opacity: 0.7;
  }
  100% {
    transform: translate(30px, 20px) scale(1.1);
    opacity: 1;
  }
}

.auth-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

/* Canvas styling */
.auth-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* ── AUTH DRAWER ────────────────────────────────────────────── */
.auth-drawer {
  position: relative;
  width: min(420px, 100vw);
  height: 100%;
  background: linear-gradient(160deg, rgba(14, 24, 48, 0.96) 0%, rgba(8, 14, 30, 0.99) 100%);
  border-left: 1px solid rgba(59, 130, 246, 0.16);
  box-shadow: -24px 0 60px rgba(0,0,0,0.6);
  padding: 60px 40px 40px;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow-y: auto;
  z-index: 5; /* Sit on top of the canvas */
}

.auth-backdrop.visible .auth-drawer {
  transform: translateX(0);
}

/* ── DRAWER HEADER ──────────────────────────────────────────── */
.drawer-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 40px;
  text-align: center;
}

/* ── SIGN IN HEADING ────────────────────────────────────────── */
.ab-signin-heading {
  font-family: var(--ab-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ab-blue-2);
  text-align: center;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(59,130,246,0.14);
  position: relative;
}

.ab-signin-heading::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--ab-blue-1), var(--ab-cyan));
  box-shadow: 0 0 8px rgba(96,165,250,0.5);
  border-radius: 2px;
}

/* ── AUTH FORMS ─────────────────────────────────────────────── */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 18px;
}
.auth-form.active { display: flex; }

/* ── FLOATING LABEL INPUTS ──────────────────────────────────── */
.ab-field {
  position: relative;
}

.ab-field input {
  width: 100%;
  background: rgba(15, 28, 60, 0.60);
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 10px;
  color: var(--ab-white);
  font-family: var(--ab-font);
  font-size: 14px;
  font-weight: 400;
  padding: 18px 16px 8px;
  outline: none;
  transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
  caret-color: var(--ab-blue-2);
  box-sizing: border-box;
  letter-spacing: 0.01em;
}

.ab-field input:focus {
  border-color: rgba(96,165,250,0.50);
  background: rgba(20, 38, 80, 0.65);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12), inset 0 1px 0 rgba(147,197,253,0.08);
}

.ab-field label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--ab-font);
  font-size: 13px;
  color: var(--ab-grey-3);
  pointer-events: none;
  transition: top 0.2s ease, font-size 0.2s ease, color 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.04em;
}

.ab-field input:focus + label,
.ab-field input:not(:placeholder-shown) + label {
  top: 10px;
  transform: translateY(0);
  font-size: 10px;
  color: var(--ab-blue-3);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Icon inside field */
.ab-field-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ab-grey-3);
  font-size: 13px;
  pointer-events: none;
  transition: color 0.22s;
}

.ab-field input:focus ~ .ab-field-icon {
  color: var(--ab-blue-2);
}

/* ── SUBMIT BUTTON ──────────────────────────────────────────── */
.auth-submit {
  position: relative;
  width: 100%;
  padding: 0;
  height: 50px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(130deg, #1d4ed8 0%, #2563eb 40%, #0ea5e9 100%);
  font-family: var(--ab-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  transition: filter 0.22s, transform 0.15s;
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.35);
}

/* Shimmer sweep */
.auth-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%);
  transition: left 0.4s ease;
}

.auth-submit:hover::before { left: 160%; }

.auth-submit:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(37,99,235,0.50);
}

.auth-submit:active { transform: translateY(0); filter: brightness(0.95); }

.auth-submit:disabled {
  background: linear-gradient(130deg, #1e2a3a 0%, #1e2d40 100%);
  color: var(--ab-grey-3);
  box-shadow: none;
  cursor: default;
  transform: none;
  filter: none;
}

.submit-loader {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── MESSAGES ───────────────────────────────────────────────── */
.auth-msg {
  font-family: var(--ab-font);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  min-height: 16px;
  color: transparent;
  margin-top: -4px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.auth-msg.error   { color: #f87171; }
.auth-msg.success { color: #34d399; }

/* ── BRAND HEADER inside form panel ──────────────────── */
.ab-brand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  text-align: center;
}

.ab-brand-logo {
  font-size: 22px;
  color: var(--ab-blue-2);
  filter: drop-shadow(0 0 8px rgba(96,165,250,0.6));
  margin-bottom: 6px;
}

.ab-brand-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ab-white);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #e2eaf5 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ab-brand-tag {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 9.5px;
  font-weight: 400;
  color: var(--ab-grey-3);
  letter-spacing: 0.20em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 22px;
}

/* ── CLOSE BUTTON ───────────────────────────────────────────── */
.auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(30, 42, 58, 0.7);
  border: 1px solid rgba(59,130,246,0.15);
  color: var(--ab-grey-4);
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
  line-height: 1;
  padding: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.auth-close:hover {
  color: #fff;
  background: rgba(59,130,246,0.25);
  border-color: rgba(96,165,250,0.40);
}

/* Scanline hidden (not used in this theme) */
.scanline { display: none; }

/* ── USER BAR ───────────────────────────────────────────────── */
.user-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--ab-font);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
}

.user-bar.hidden { display: none; }
.user-bar.idle { opacity: 0.20; transform: translateX(20px); }
.user-bar:hover { opacity: 1 !important; transform: translateX(0) !important; }

/* Avatar button */
.user-avatar-btn {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1e3a6e, #07101f);
  border: 1.5px solid rgba(96,165,250,0.35);
  color: var(--ab-blue-2);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(96,165,250,0.18), 0 4px 20px rgba(0,0,0,0.6);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.user-avatar-btn:hover,
.user-avatar-btn.active {
  border-color: rgba(96,165,250,0.70);
  box-shadow: 0 0 24px rgba(96,165,250,0.35), 0 4px 24px rgba(0,0,0,0.7);
  transform: scale(1.06);
}

/* Online dot */
.user-online-dot {
  position: absolute;
  bottom: 3px; right: 3px;
  width: 9px; height: 9px;
  background: #34d399;
  border-radius: 50%;
  border: 2px solid #07101f;
  box-shadow: 0 0 6px #34d399;
  animation: pulseLed 2s ease-in-out infinite;
}

@keyframes pulseLed {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* Dropdown */
.user-dropdown {
  position: absolute;
  bottom: 54px;
  right: 0;
  min-width: 215px;
  background: linear-gradient(145deg, #0d1b33, #07101f);
  border: 1px solid rgba(96,165,250,0.20);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 20px rgba(59,130,246,0.06);
  padding: 14px 0 8px;
  animation: udSlideIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

@keyframes udSlideIn {
  from { opacity: 0; transform: scale(0.88) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.ud-info {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 16px 12px;
}

.ud-avatar-icon {
  font-size: 28px;
  color: var(--ab-blue-2);
  opacity: 0.85;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(96,165,250,0.4));
}

.ud-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ud-label {
  font-size: 9px;
  color: var(--ab-grey-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ab-blue-3);
  letter-spacing: 0.04em;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ud-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,0.18), transparent);
  margin: 0 12px 8px;
}

.user-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--ab-grey-3);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--ab-font);
  cursor: pointer;
  padding: 7px 16px;
  transition: color 0.18s, background 0.18s;
}

.user-logout:hover {
  color: #f87171;
  background: rgba(248,113,113,0.07);
}

/* Storage indicator */
.ud-storage {
  padding: 4px 16px 8px;
}

.ud-storage-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.ud-storage-label {
  font-size: 9px;
  color: var(--ab-grey-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ud-storage-text {
  font-size: 9px;
  color: var(--ab-blue-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.ud-storage-track {
  height: 3px;
  background: rgba(59,130,246,0.12);
  border-radius: 99px;
  overflow: hidden;
}

.ud-storage-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--ab-blue-1), var(--ab-cyan));
  transition: width 0.4s ease;
  min-width: 2px;
}

.ud-storage-fill.warn     { background: #f59e0b; }
.ud-storage-fill.critical { background: #ef4444; }

/* ── AUTH TRIGGER DOT ───────────────────────────────────────── */
.cmd-icon-btn.auth-btn { position: relative; }

.auth-btn-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ab-blue-2);
  box-shadow: 0 0 6px var(--ab-blue-2);
  display: none;
  animation: pulseLed 2s ease-in-out infinite;
}
.auth-btn-dot.show { display: block; }

/* ── DIVIDER TEXT ───────────────────────────────────────────── */
.ab-divider-text {
  text-align: center;
  font-size: 10px;
  color: var(--ab-grey-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  margin: 2px 0;
}

.ab-divider-text::before,
.ab-divider-text::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.18));
}

.ab-divider-text::before { right: 58%; }
.ab-divider-text::after  { left: 58%; background: linear-gradient(270deg, transparent, rgba(59,130,246,0.18)); }

/* ── HORIZONTAL SEPARATOR INSIDE GATE ──────────────────────── */
/* replaces old brand panel; not needed */
.auth-brand { display: none; }
.auth-form-panel {
  display: contents;  /* passthrough — form is inside ab-form-panel now */
}

/* ── TOUCH ──────────────────────────────────────────────────── */
.auth-submit, .auth-close, .user-logout {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 520px) {
  .ab-orbital-wrap { width: 260px; height: 260px; }
  .ab-ring-1 { width: 260px; height: 260px; }
  .ab-ring-2 { width: 210px; height: 210px; }
  .ab-ring-3 { width: 165px; height: 165px; }
  .ab-core { width: 158px; height: 158px; }
  .ab-progress-ring { width: 174px; height: 174px; }
  .ab-form-panel { padding: 44px 22px 24px; }
  .auth-gate { width: 95vw; }

  .user-bar {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    right: 0.5rem;
  }
}
