/* ═══════════════════════════════════════════════════════════════════════════
   ArbX Terminal Mode — Scoped under body.terminal-mode
   All styles only activate when the body has class "terminal-mode".
   Zero impact on the existing "simple" design when class is absent.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ───────────────────────────────────────────────────────── */
body.terminal-mode {
  --bg:        #07080a;
  --surface:   #0d0f12;
  --border:    rgba(255,255,255,0.07);
  --border-h:  rgba(255,255,255,0.14);
  --text:      #e8eaf0;
  --muted:     #5a5f6e;
  --accent:    #00e87c;
  --accent-d:  #00b85f;
  --accent-g:  rgba(0,232,124,0.12);
  --accent-s:  rgba(0,232,124,0.04);
  --red:       #ff4d6a;
  --amber:     #f5a623;
  --mono:      'IBM Plex Mono', monospace;
  --sans:      'Syne', sans-serif;

  font-family: var(--mono) !important;
  background: var(--bg) !important;
  color: var(--text) !important;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ─── Noise Grain Overlay ─────────────────────────────────────────────────── */
body.terminal-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ─── Spotlight Glow ──────────────────────────────────────────────────────── */
body.terminal-mode .spotlight {
  display: block;
  position: fixed;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 400px;
  background: radial-gradient(ellipse at center, rgba(0,232,124,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */
body.terminal-mode ::-webkit-scrollbar { width: 4px; }
body.terminal-mode ::-webkit-scrollbar-track { background: var(--bg); }
body.terminal-mode ::-webkit-scrollbar-thumb { background: rgba(0,232,124,0.25); border-radius: 2px; }

/* ─── Page Load Animations ────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.terminal-mode .fade-up { animation: fadeUp 0.35s ease both; }
body.terminal-mode .delay-1 { animation-delay: 0.05s; }
body.terminal-mode .delay-2 { animation-delay: 0.10s; }
body.terminal-mode .delay-3 { animation-delay: 0.15s; }

/* ═══════════════════════════════════════════════════════════════════════════
   NAVBAR OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode nav,
body.terminal-mode .navbar,
body.terminal-mode [class*="navbar"] {
  position: sticky !important;
  top: 0;
  z-index: 100;
  height: 56px;
  background: rgba(7,8,10,0.85) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border) !important;
  padding: 0 2rem !important;
}

body.terminal-mode nav a,
body.terminal-mode .navbar a {
  font-family: var(--mono) !important;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.15s, background 0.15s;
}

body.terminal-mode nav a:hover,
body.terminal-mode .navbar a:hover {
  color: var(--text) !important;
}

body.terminal-mode nav a.active,
body.terminal-mode .navbar a.active {
  color: var(--accent) !important;
  background: var(--accent-g) !important;
}

/* ─── Live Badge ──────────────────────────────────────────────────────────── */
body.terminal-mode .badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 3px 8px;
  background: var(--accent-g);
  border: 1px solid rgba(0,232,124,0.2);
  border-radius: 999px;
}

body.terminal-mode .badge-live::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TICKER STRIP (terminal mode only)
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .ticker-strip {
  display: flex !important;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 30px;
  overflow: hidden;
  align-items: center;
}

body.terminal-mode .ticker-track {
  display: flex;
  animation: ticker 35s linear infinite;
  white-space: nowrap;
}

body.terminal-mode .ticker-track:hover { animation-play-state: paused; }

@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

body.terminal-mode .tick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  height: 30px;
  font-size: 0.67rem;
}

body.terminal-mode .tick-sym  { font-weight: 600; color: var(--text); letter-spacing: 0.05em; }
body.terminal-mode .tick-price { color: var(--muted); }
body.terminal-mode .tick-change.pos { color: var(--accent); }
body.terminal-mode .tick-change.neg { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════════════
   CARD OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode [class*="bg-white"],
body.terminal-mode [class*="bg-gray-800"],
body.terminal-mode [class*="bg-gray-900"],
body.terminal-mode .card,
body.terminal-mode [class*="rounded-2xl"][class*="border"] {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  border-radius: 12px !important;
}

body.terminal-mode [class*="bg-white"]:hover,
body.terminal-mode .card:hover {
  background: #0f1115 !important;
}

/* Card density reduction */
body.terminal-mode .p-6 { padding: 14px 16px !important; }
body.terminal-mode .p-5 { padding: 12px 14px !important; }
body.terminal-mode .gap-6 { gap: 16px !important; }
body.terminal-mode .gap-8 { gap: 16px !important; }
body.terminal-mode .mb-6 { margin-bottom: 16px !important; }
body.terminal-mode .mb-8 { margin-bottom: 16px !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode,
body.terminal-mode div, body.terminal-mode span, body.terminal-mode p,
body.terminal-mode a, body.terminal-mode input, body.terminal-mode textarea,
body.terminal-mode select, body.terminal-mode button, body.terminal-mode label,
body.terminal-mode td, body.terminal-mode th, body.terminal-mode li,
body.terminal-mode h1, body.terminal-mode h2, body.terminal-mode h3,
body.terminal-mode h4, body.terminal-mode h5, body.terminal-mode h6 {
  font-family: var(--mono) !important;
}

body.terminal-mode h1,
body.terminal-mode h2,
body.terminal-mode .text-4xl,
body.terminal-mode .text-3xl,
body.terminal-mode .text-2xl,
body.terminal-mode .stat-value {
  font-family: var(--sans) !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em !important;
}

body.terminal-mode .text-gray-400,
body.terminal-mode .text-gray-500 {
  color: var(--muted) !important;
}

body.terminal-mode .text-white {
  color: var(--text) !important;
}

body.terminal-mode .text-green-400,
body.terminal-mode .text-green-500 {
  color: var(--accent) !important;
}

body.terminal-mode .text-red-400,
body.terminal-mode .text-red-500 {
  color: var(--red) !important;
}

body.terminal-mode .text-yellow-400,
body.terminal-mode .text-amber-400 {
  color: var(--amber) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode table {
  width: 100%;
  border-collapse: collapse;
}

body.terminal-mode table thead th {
  font-size: 0.6rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: var(--muted) !important;
  padding: 0 16px 10px !important;
  text-align: left;
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
}

body.terminal-mode table tbody tr {
  border-bottom: 1px solid var(--border) !important;
  transition: background 0.1s;
}

body.terminal-mode table tbody tr:last-child { border-bottom: none !important; }
body.terminal-mode table tbody tr:hover { background: rgba(255,255,255,0.025) !important; }

body.terminal-mode table td {
  padding: 10px 16px !important;
  font-size: 0.72rem !important;
  color: var(--text) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES / CHIPS
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .chip,
body.terminal-mode [class*="bg-green-500/20"],
body.terminal-mode [class*="bg-red-500/20"],
body.terminal-mode [class*="bg-yellow-500/20"],
body.terminal-mode [class*="bg-purple-500/20"] {
  font-size: 0.62rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
}

body.terminal-mode [class*="bg-green-500/20"] {
  background: rgba(0,232,124,0.08) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(0,232,124,0.15) !important;
}

body.terminal-mode [class*="bg-red-500/20"] {
  background: rgba(255,77,106,0.08) !important;
  color: var(--red) !important;
  border: 1px solid rgba(255,77,106,0.15) !important;
}

body.terminal-mode [class*="bg-yellow-500/20"],
body.terminal-mode [class*="bg-amber-500/20"] {
  background: rgba(245,166,35,0.08) !important;
  color: var(--amber) !important;
  border: 1px solid rgba(245,166,35,0.15) !important;
}

body.terminal-mode [class*="bg-purple-500/20"] {
  background: rgba(139,92,246,0.08) !important;
  color: #a78bfa !important;
  border: 1px solid rgba(139,92,246,0.15) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode input[type="text"],
body.terminal-mode input[type="number"],
body.terminal-mode input[type="email"],
body.terminal-mode input[type="password"],
body.terminal-mode input[type="search"],
body.terminal-mode textarea,
body.terminal-mode select {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 7px 12px !important;
  font-family: var(--mono) !important;
  font-size: 0.73rem !important;
  color: var(--text) !important;
  outline: none !important;
  transition: border-color 0.15s !important;
}

body.terminal-mode input::placeholder,
body.terminal-mode textarea::placeholder {
  color: var(--muted) !important;
}

body.terminal-mode input:focus,
body.terminal-mode textarea:focus,
body.terminal-mode select:focus {
  border-color: rgba(0,232,124,0.35) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .btn-primary,
body.terminal-mode [class*="bg-purple-500"]:not([class*="/"]),
body.terminal-mode button[class*="bg-purple-500"]:not([class*="/"]) {
  background: var(--accent) !important;
  color: #07080a !important;
  font-family: var(--mono) !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 7px 16px !important;
  transition: all 0.15s !important;
}

body.terminal-mode .btn-primary:hover,
body.terminal-mode [class*="bg-purple-500"]:not([class*="/"]):hover {
  background: #14ffaa !important;
  box-shadow: 0 0 20px rgba(0,232,124,0.3) !important;
}

body.terminal-mode .btn-ghost,
body.terminal-mode button[class*="border"][class*="bg-white/"] {
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  font-family: var(--mono) !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  transition: all 0.15s !important;
}

body.terminal-mode .btn-ghost:hover {
  color: var(--text) !important;
  border-color: var(--border-h) !important;
  background: rgba(255,255,255,0.04) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS / TOASTS
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode #globalNotifications {
  top: 68px !important;
}

body.terminal-mode #globalNotifications > div {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
  font-family: var(--mono) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STAT CARDS (dashboard metric boxes)
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .stat-card {
  background: var(--surface);
  padding: 14px 16px;
  position: relative;
  transition: background 0.15s;
}

body.terminal-mode .stat-card:hover { background: #0f1115; }

body.terminal-mode .stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.2s;
}

body.terminal-mode .stat-card:hover::after { background: var(--accent); }

body.terminal-mode .stat-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

body.terminal-mode .stat-value {
  font-family: var(--sans) !important;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 5px;
}

body.terminal-mode .stat-meta { font-size: 0.67rem; display: flex; align-items: center; gap: 4px; }
body.terminal-mode .stat-meta.pos { color: var(--accent); }
body.terminal-mode .stat-meta.neg { color: var(--red); }
body.terminal-mode .stat-meta.neu { color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVITY FEED
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  transition: background 0.1s;
}

body.terminal-mode .feed-item:last-child { border-bottom: none; }
body.terminal-mode .feed-item:hover { background: rgba(255,255,255,0.02); }

body.terminal-mode .feed-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
body.terminal-mode .feed-dot.g { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
body.terminal-mode .feed-dot.r { background: var(--red); }
body.terminal-mode .feed-dot.a { background: var(--amber); }

body.terminal-mode .feed-meta { color: var(--muted); margin-top: 2px; font-size: 0.62rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .bar-bg {
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}

body.terminal-mode .bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODE TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.mode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #5a5f6e;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-toggle:hover {
  color: #e8eaf0;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.04);
}

body.terminal-mode .mode-toggle {
  color: var(--accent);
  border-color: rgba(0,232,124,0.3);
  background: var(--accent-g);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BACKGROUND OVERRIDES (catch-all)
   ═══════════════════════════════════════════════════════════════════════════ */

body.terminal-mode .bg-\[\#0a0a0a\] { background: var(--bg) !important; }

body.terminal-mode [class*="border-white\\/"] {
  border-color: var(--border) !important;
}

body.terminal-mode [class*="backdrop-blur"] {
  backdrop-filter: blur(20px) saturate(180%) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  body.terminal-mode nav,
  body.terminal-mode .navbar { padding: 0 1rem !important; }
}
