@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --primary: #0080ff;
  --secondary: #39ff14;
  --bg: #0a0e27;
  --bg-card: #0f1635;
  --bg-card-hover: #141b42;
  --text: #fff;
  --text-muted: #8b92b3;
  --border: #1e2650;
  --red: #ef4444;
  --red-bg: rgba(239,68,68,.1);
  --green: #39ff14;
  --green-bg: rgba(57,255,20,.1);
  --yellow: #eab308;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }
a { color: var(--primary); text-decoration: none; }

/* Glass card */
.glass-card {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15, 22, 53, 0.8);
  border: 1px solid rgba(30, 38, 80, 0.5);
  border-radius: 1rem;
}
.glass-card-hover { cursor: pointer; transition: all 0.3s; }
.glass-card-hover:hover {
  border-color: var(--primary);
  background: rgba(20, 27, 66, 0.9);
  box-shadow: 0 0 30px rgba(0, 128, 255, 0.15);
}

/* Glow effects */
.glow-primary { box-shadow: 0 0 20px rgba(0, 128, 255, 0.3); }
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Grid background */
.grid-bg {
  background-image:
    linear-gradient(rgba(30, 38, 80, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 38, 80, 0.3) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* Layout */
.app { max-width: 1400px; margin: 0 auto; padding: 24px; position: relative; z-index: 1; }

/* Ambient glow orbs */
.glow-orb {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(128px);
}
.glow-orb-1 { top: -100px; left: -100px; width: 400px; height: 400px; background: var(--primary); opacity: 0.12; }
.glow-orb-2 { bottom: -100px; right: -100px; width: 400px; height: 400px; background: var(--secondary); opacity: 0.06; }

/* ===== NAV ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(10, 14, 39, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
}
.nav-logo svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.nav-name { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; }

.nav-nodes { font-size: 12px; color: var(--text-muted); font-family: 'Space Grotesk', monospace; }
.nav-nodes span { color: var(--secondary); font-weight: 600; }

.nav-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
}
.nav-status.connected { color: var(--green); background: var(--green-bg); border-color: rgba(57,255,20,.2); }
.nav-status.disconnected { color: var(--red); background: var(--red-bg); border-color: rgba(239,68,68,.2); }
.nav-status.connecting { color: var(--yellow); background: rgba(234,179,8,.1); border-color: rgba(234,179,8,.2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.nav-status.connected .status-dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ===== HERO ===== */
.hero {
  position: relative; padding: 100px 0 40px; overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 500;
  color: var(--secondary); background: var(--green-bg);
  border: 1px solid rgba(57,255,20,.2); margin-bottom: 24px;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); animation: pulse 2s ease-in-out infinite; }
.hero h1 { font-size: 48px; font-weight: 700; line-height: 1.15; margin-bottom: 16px; letter-spacing: -0.02em; }
.hero p { color: var(--text-muted); font-size: 16px; line-height: 1.6; max-width: 480px; margin-bottom: 32px; }
.hero-features { display: flex; gap: 24px; color: var(--text-muted); font-size: 14px; }
.hero-features span { display: flex; align-items: center; gap: 6px; }
.hero-features svg { width: 18px; height: 18px; stroke: var(--secondary); fill: none; }

/* Hero chart card */
.hero-chart {
  position: relative;
}
.hero-chart .glass-card { padding: 24px; }
.hero-chart-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.hero-chart-symbol { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 600; }
.hero-chart-sub { font-size: 13px; color: var(--text-muted); }
.hero-chart-price { text-align: right; }
.hero-chart-price .val { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; }
.hero-chart-price .chg { font-size: 14px; color: var(--secondary); }

.hero-sparkline { height: 120px; position: relative; margin-bottom: 16px; }
.hero-sparkline svg { width: 100%; height: 100%; }

.hero-tf { display: flex; gap: 6px; }
.hero-tf button {
  padding: 6px 14px; border-radius: 8px; border: none;
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text-muted); background: transparent; transition: all 0.2s;
}
.hero-tf button.active { background: var(--primary); color: #fff; }
.hero-tf button:hover:not(.active) { color: var(--text); }

/* Terminal typewriter */
.terminal-cmd {
  margin-top: 12px; padding: 10px 16px; border-radius: 8px;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.08);
  font-family: 'Space Grotesk', monospace; font-size: 14px;
  display: inline-flex; align-items: center; color: var(--text-muted);
}
.terminal-prefix {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.terminal-typed { color: #fff; }
.terminal-cursor { color: var(--secondary); animation: blink 1s step-end infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

/* Floating badges */
.float-badge {
  position: absolute; padding: 12px 16px; z-index: 2;
}
.float-badge .inner { display: flex; align-items: center; gap: 10px; }
.float-badge .coin {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.float-badge .coin-btc { background: #F7931A; }
.float-badge .coin-eth { background: #627EEA; }
.float-badge .fb-price { font-size: 14px; font-weight: 500; }
.float-badge .fb-chg { font-size: 12px; color: var(--secondary); }
.float-top { top: -16px; right: -16px; }
.float-bottom { bottom: -16px; left: -16px; }

/* ===== STATS BAR ===== */
.stats-bar { margin: 32px 0; }
.stats-bar .glass-card { padding: 24px 32px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stat-item { text-align: center; }
.stat-val { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; }
.stat-val.gradient-text { font-size: 28px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text); margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--text-muted); }

/* ===== ARCHITECTURE CARDS ===== */
.arch-section { margin: 48px 0 32px; }
.arch-header { text-align: center; margin-bottom: 40px; }
.arch-header h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.arch-header p { color: var(--text-muted); font-size: 16px; max-width: 560px; margin: 0 auto; }
.arch-flow { padding: 20px 32px; line-height: 1.7; text-align: center; }
.arch-flow p { color: var(--text-muted); font-size: 15px; margin: 0; max-width: none; }
.arch-flow p + p { margin-top: 6px; }
.arch-flow strong { color: var(--text); }
.arch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.arch-card { padding: 24px; }
.arch-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,128,255,0.15), rgba(57,255,20,0.1));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; color: var(--primary);
}
.arch-icon svg { width: 24px; height: 24px; }
.arch-card h3 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.arch-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.arch-card code { font-size: 13px; color: var(--secondary); background: rgba(57,255,20,0.08); padding: 2px 6px; border-radius: 4px; }
.arch-card strong { color: var(--text); font-weight: 600; }
.arch-card .highlight-warn { color: var(--red); }
.arch-card .highlight-good { color: var(--secondary); }
.arch-tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--secondary); background: var(--green-bg); border: 1px solid rgba(57,255,20,0.15);
  padding: 4px 10px; border-radius: 100px; font-family: 'Space Grotesk', sans-serif;
}

/* ===== TICKER TABLE ===== */
.ticker-section { margin-top: 16px; }
.ticker-section .glass-card { overflow: hidden; }
.ticker-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid rgba(30,38,80,0.5);
}
.ticker-bar h3 { font-size: 16px; font-weight: 600; }
.ticker-bar .count { font-size: 12px; color: var(--text-muted); font-family: 'Space Grotesk', sans-serif; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 24px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); border-bottom: 1px solid rgba(30,38,80,0.5);
  background: var(--bg-card);
}
thead th:last-child, tbody td:last-child { text-align: right; }
tbody tr {
  border-bottom: 1px solid rgba(30,38,80,0.3);
  cursor: pointer; transition: all 0.2s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td { padding: 14px 24px; font-size: 14px; }

.sym-cell { display: flex; align-items: center; gap: 12px; }
.sym-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,128,255,0.15), rgba(57,255,20,0.1));
  border: 1px solid rgba(0,128,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--primary);
  font-family: 'Space Grotesk', sans-serif;
}
.sym-name { font-weight: 600; font-family: 'Space Grotesk', sans-serif; font-size: 14px; }
.sym-full { font-size: 11px; color: var(--text-muted); }
.price { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 15px; }
.change {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif; font-size: 12px; font-weight: 600;
}
.change.up { color: var(--green); background: var(--green-bg); }
.change.down { color: var(--red); background: var(--red-bg); }
.change.flat { color: var(--text-muted); background: rgba(15,22,53,0.5); }
.volume { font-family: 'Space Grotesk', sans-serif; color: var(--text-muted); font-size: 13px; }
.latency { font-family: 'Space Grotesk', sans-serif; color: var(--text-muted); font-size: 12px; }

.empty-state { text-align: center; padding: 80px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

@keyframes flash-green { 0% { background: rgba(57,255,20,0.1); } 100% { background: transparent; } }
@keyframes flash-red { 0% { background: rgba(239,68,68,0.1); } 100% { background: transparent; } }
tr.flash-up { animation: flash-green 0.6s ease-out; }
tr.flash-down { animation: flash-red 0.6s ease-out; }

/* ===== TRADE PAGE ===== */
.trade-header {
  display: flex; align-items: center; gap: 16px;
  padding: 80px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.back-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: 'DM Sans', sans-serif;
}
.back-btn:hover { border-color: var(--primary); color: var(--text); }
.trade-symbol { font-size: 24px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.trade-price { font-size: 24px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; margin-left: auto; }
.trade-change {
  font-size: 14px; font-weight: 600; font-family: 'Space Grotesk', sans-serif;
  padding: 6px 14px; border-radius: 8px;
}

.trade-body { display: grid; grid-template-columns: 1fr 320px; gap: 16px; height: calc(100vh - 180px); overflow: hidden; }
.chart-panel {
  overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
.chart-panel.glass-card { border-radius: 1rem; }
.chart-toolbar {
  display: flex; gap: 4px; padding: 12px 16px;
  border-bottom: 1px solid rgba(30,38,80,0.5);
}
.chart-toolbar button {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: 'Space Grotesk', sans-serif;
  transition: all 0.2s;
}
.chart-toolbar button:hover, .chart-toolbar button.active {
  border-color: var(--primary); color: var(--primary);
  background: rgba(0,128,255,0.1);
}
.chart-container { flex: 1; min-height: 0; overflow: hidden; }

.side-panel { display: flex; flex-direction: column; gap: 16px; }
.info-card { padding: 20px; }
.info-card h3 {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 14px;
}
.info-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid rgba(30,38,80,0.3); font-size: 13px;
}
.info-row:last-child { border: none; }
.info-row .label { color: var(--text-muted); }
.info-row .val { font-family: 'Space Grotesk', sans-serif; font-weight: 500; }

.trades-card { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.trades-card h3 {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 16px 20px; border-bottom: 1px solid rgba(30,38,80,0.5);
}
.trades-list { flex: 1; overflow-y: auto; padding: 0 20px; }
.trade-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 12px; font-family: 'Space Grotesk', sans-serif;
  border-bottom: 1px solid rgba(30,38,80,0.15);
}
.trade-row .t-price { font-weight: 500; }
.trade-row .t-vol { color: var(--text-muted); }
.trade-row .t-time { color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 36px; }
  .hero-chart { margin-top: 32px; }
  .float-badge { display: none; }
  .arch-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .app { padding: 16px; }
  .hero h1 { font-size: 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .arch-grid { grid-template-columns: 1fr; }
  .arch-header h2 { font-size: 24px; }
  thead th, tbody td { padding: 10px 14px; }
  .sym-icon { display: none; }
  .trade-body { grid-template-columns: 1fr; height: auto; }
  .chart-container { min-height: 400px; }
  .nav-name { display: none; }
}
