/* ═══════════════════════════════════════════════════════════════════════════
   NERDBISCUIT DESIGN SYSTEM v2.0 — ULTRA
   Premium trading platform design tokens, animations, and shared components
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── FONTS ────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── DESIGN TOKENS ────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary: #06060b;
  --bg-secondary: #08080e;
  --surface-1: #0e0e1a;
  --surface-2: #12122a;
  --surface-3: #1a1a3a;
  --bg-card: linear-gradient(135deg, #0d0d1a 0%, #141428 100%);
  --bg-glass: rgba(15, 15, 30, 0.7);

  /* Accents */
  --gold: #f0c832;
  --gold-dim: #c4a028;
  --purple: #a855f7;
  --green: #00e676;
  --red: #ff3d57;
  --cyan: #00e5ff;
  --blue: #5b8cff;
  --orange: #ff6b35;

  /* Text */
  --text-primary: #e8e8f0;
  --text-secondary: #888899;
  --text-dim: #555566;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(168, 85, 247, 0.2);
  --border-gold: rgba(240, 200, 50, 0.2);

  /* Shadows & Glows */
  --gold-glow: 0 0 20px rgba(240, 200, 50, 0.15);
  --purple-glow: 0 0 20px rgba(168, 85, 247, 0.15);
  --green-glow: 0 0 15px rgba(0, 230, 118, 0.15);
  --red-glow: 0 0 15px rgba(255, 61, 87, 0.15);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --card-hover-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(168, 85, 247, 0.05);

  /* Typography */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Outfit', 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', 'Space Mono', monospace;

  /* Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── GLOBAL RESETS ────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
::selection { background: rgba(240, 200, 50, 0.3); color: #fff; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(240, 200, 50, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(240, 200, 50, 0.4); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3); }

/* ── GLASSMORPHISM COMPONENTS ─────────────────────────────────────────────── */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s var(--ease-out-expo), border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-hover-shadow);
  border-color: var(--border-glow);
}

.glass-card:active {
  transform: translateY(-1px) scale(0.99);
}

/* ── ANIMATED BACKGROUND ──────────────────────────────────────────────────── */
.bg-mesh {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(168, 85, 247, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(240, 200, 50, 0.04), transparent),
    radial-gradient(ellipse 50% 50% at 50% 0%, rgba(91, 140, 255, 0.04), transparent),
    var(--bg-primary);
  animation: meshShift 30s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0% { background-position: 0% 0%, 100% 100%, 50% 0%; }
  50% { background-position: 30% 20%, 70% 60%, 40% 10%; }
  100% { background-position: 10% 40%, 90% 30%, 60% 20%; }
}

/* HUD Grid overlay */
.bg-grid {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* ── KEYFRAME ANIMATIONS ──────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(240,200,50,0.1); }
  50% { box-shadow: 0 0 25px rgba(240,200,50,0.25); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes flashGreen {
  0% { color: var(--green); text-shadow: 0 0 12px rgba(0,230,118,0.5); }
  100% { color: var(--text-primary); text-shadow: none; }
}

@keyframes flashRed {
  0% { color: var(--red); text-shadow: 0 0 12px rgba(255,61,87,0.5); }
  100% { color: var(--text-primary); text-shadow: none; }
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(0,230,118,0); }
}

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

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

/* Staggered entry utility */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* ── SKELETON LOADING ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text { height: 12px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 120px; border-radius: 16px; }

/* ── BOTTOM NAV — SHARED ──────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(8, 8, 14, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 1000;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 8px;
  font-family: var(--font-mono);
  padding: 4px 2px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.bottom-nav a.active {
  color: var(--gold);
}

.bottom-nav a:hover {
  color: var(--text-secondary);
}

.bottom-nav a .nav-icon {
  font-size: 18px;
  transition: transform 0.2s var(--ease-spring);
}

.bottom-nav a:active .nav-icon {
  transform: scale(1.25);
}

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #000;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--gold-glow);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
}

.btn-glass:hover {
  border-color: var(--border-glow);
  transform: translateY(-1px);
  box-shadow: var(--purple-glow);
}

/* ── BADGES ───────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 9px; font-weight: 700; font-family: var(--font-mono); }
.badge-green { background: rgba(0,230,118,0.1); color: var(--green); border: 1px solid rgba(0,230,118,0.2); }
.badge-red { background: rgba(255,61,87,0.1); color: var(--red); border: 1px solid rgba(255,61,87,0.2); }
.badge-gold { background: rgba(240,200,50,0.1); color: var(--gold); border: 1px solid rgba(240,200,50,0.2); }
.badge-purple { background: rgba(168,85,247,0.1); color: var(--purple); border: 1px solid rgba(168,85,247,0.2); }
.badge-cyan { background: rgba(0,229,255,0.1); color: var(--cyan); border: 1px solid rgba(0,229,255,0.2); }

/* ── STATUS DOTS ──────────────────────────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--green);
  animation: statusPulse 2s infinite;
}

.status-dot.offline { background: var(--red); }

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  display: none;
  animation: fadeInUp 0.3s var(--ease-out-expo);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.on { display: block; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }

/* ── SECTION HEADERS ──────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-gold), transparent);
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── INPUTS ───────────────────────────────────────────────────────────────── */
.input-glass {
  width: 100%;
  background: rgba(15, 15, 30, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.input-glass:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.input-glass::placeholder {
  color: var(--text-dim);
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .glass-card {
    border-radius: 10px;
  }
  .glass-card:hover {
    transform: none;
  }
  .btn-primary {
    padding: 14px 24px;
    min-height: 44px;
  }
  .btn-glass {
    padding: 12px 20px;
    min-height: 44px;
  }
  .bottom-nav a {
    padding: 10px 4px;
    font-size: 8px;
    min-height: 44px;
    justify-content: center;
  }
  .bottom-nav a .nav-icon {
    font-size: 18px;
  }
  .toast {
    left: 16px;
    right: 16px;
    max-width: none;
    padding: 14px 20px;
  }
}

@media (max-width: 480px) {
  .glass-card {
    border-radius: 8px;
  }
  .bottom-nav a { font-size: 7px; }
  .bottom-nav a .nav-icon { font-size: 16px; }
  .section-header h2 { font-size: 11px; letter-spacing: 1px; }
  .input-glass {
    padding: 14px 16px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  .badge { font-size: 8px; padding: 2px 6px; }
}
