/* OptionAlpha Agent — Institutional Dark Glassmorphism CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg:            #08090d;
  --surface:       #0e1117;
  --surface-2:     #141923;
  --surface-hover: #1b2230;
  --border:        rgba(255, 255, 255, 0.07);
  --border-active: rgba(124, 58, 237, 0.4);
  --accent:        #7c3aed;
  --accent-light:  #9061f9;
  --accent-glow:   rgba(124, 58, 237, 0.28);
  --green:         #10b981;
  --green-glow:    rgba(16, 185, 129, 0.2);
  --red:           #ef4444;
  --red-glow:      rgba(239, 68, 68, 0.2);
  --yellow:        #f59e0b;
  --yellow-glow:   rgba(245, 158, 11, 0.2);
  --blue:          #3b82f6;
  --cyan:          #06b6d4;
  --text:          #f8fafc;
  --text-muted:    #94a3b8;
  --text-dim:      #64748b;
  --mono:          'JetBrains Mono', monospace;
  --sans:          'Inter', sans-serif;
  --r:             12px;
  --r-sm:          8px;
  --shadow:        0 8px 32px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 0 60px;
  overflow-x: hidden;
  background-image: 
    radial-gradient(ellipse at 15% 10%, rgba(124, 58, 237, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
  background-attachment: fixed;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 13, 0.88);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.logo-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 0 24px var(--accent-glow);
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50%      { box-shadow: 0 0 35px rgba(124, 58, 237, 0.45); }
}

.brand { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.header-right { display: flex; align-items: center; gap: 14px; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  animation: blink 2s ease-in-out infinite;
}

.status-dot.halted { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.status-dot.closed { background: var(--yellow); box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.clock {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

/* ── Navigation Tab Bar ──────────────────────────────────── */
.nav-bar-wrap {
  background: rgba(14, 17, 23, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 0 32px;
  position: sticky;
  top: 77px;
  z-index: 150;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.02); }

.nav-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: rgba(124, 58, 237, 0.06);
}

.tab-badge {
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
}

/* ── Live Performance / Win-Rate Strip ──────────────────── */
.perf-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: linear-gradient(90deg, rgba(16,185,129,0.08) 0%, rgba(124,58,237,0.12) 50%, rgba(59,130,246,0.08) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
}
.perf-item {
  text-align: center;
  flex: 1;
  padding: 4px 24px;
}
.perf-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.perf-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-shadow: 0 0 18px currentColor;
  transition: color 0.3s ease;
}
.perf-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
}
.perf-divider {
  width: 1px;
  height: 44px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Action Toolbar ──────────────────────────────────────── */
.toolbar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-title { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  background: var(--surface-2);
  color: var(--text);
}

.btn:hover { background: var(--surface-hover); border-color: rgba(255, 255, 255, 0.15); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent-light); box-shadow: 0 0 16px var(--accent-glow); }

/* ── KPI Grid ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px 32px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  opacity: 0.8;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.kpi-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  margin: 6px 0 4px;
  letter-spacing: -0.5px;
}

.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.pos { color: var(--green); }
.kpi-delta.neg { color: var(--red); }
.kpi-delta.neutral { color: var(--text-dim); }

.regime-badge {
  color: var(--accent-light);
  display: inline-block;
}

/* ── Main Content Views ──────────────────────────────────── */
.tab-content { display: none; padding: 8px 32px 32px; }
.tab-content.active { display: block; }

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-sub { font-size: 12px; color: var(--text-dim); }

.two-col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Chart Styles ────────────────────────────────────────── */
.chart-wrap { height: 320px; position: relative; }
.chart-legend { font-size: 12px; color: var(--text-muted); display: flex; gap: 14px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-equity { background: var(--accent); }
.dot-benchmark { background: var(--blue); }

.donut-wrap { height: 220px; position: relative; }
.donut-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
  font-size: 12px;
}
.dl-item { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.dl-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Tables ──────────────────────────────────────────────── */
.table-responsive { width: 100%; overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--mono);
  font-size: 12px;
}

.data-table tr:hover td { background: var(--surface-hover); }

.tag-csp {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.tag-cc {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.tag-ic {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.tag-crypto {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-win {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.badge-loss {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Filter Pills ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-pill:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.filter-pill.active { background: var(--accent); color: #fff; border-color: transparent; }

/* ── Risk Meters ─────────────────────────────────────────── */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.risk-meter {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
}

.risk-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.progress-fill.normal  { background: var(--green); }
.progress-fill.warning { background: var(--yellow); }
.progress-fill.danger  { background: var(--red); }

.risk-val { font-family: var(--mono); font-size: 12px; color: var(--text); }

.circuit-breaker {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.circuit-breaker.active {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ── Interactive Pipeline / Flowchart ────────────────────── */
.pipeline-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.pipeline-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  position: relative;
  transition: all 0.25s ease;
}

.pipeline-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
}

.pipeline-card.active-step {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.pipe-step-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipe-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipe-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.pipe-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}

/* ── Zero-Bridge Memory Banner ───────────────────────────── */
.memory-banner {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--r);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.banner-icon { font-size: 28px; }
.banner-title { font-size: 15px; font-weight: 700; color: #e2e8f0; margin-bottom: 4px; }
.banner-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.banner-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  display: inline-block;
}

/* ── AI Brain Status Grid ────────────────────────────────── */
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.ai-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 16px;
  transition: border-color 0.2s;
}

.ai-card:hover { border-color: rgba(255, 255, 255, 0.15); }
.ai-icon { font-size: 24px; margin-bottom: 8px; }
.ai-label { font-size: 13px; font-weight: 700; }
.ai-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.ai-status {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}

.ai-status.ready   { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.ai-status.loading { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
.ai-status.offline { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* ── Crypto Order Book Component ─────────────────────────── */
.orderbook-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}

.ob-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
}

.ob-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.ob-bids .ob-title { color: var(--green); }
.ob-asks .ob-title { color: var(--red); }

.ob-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

/* ── Terminal Trade Log ──────────────────────────────────── */
.trade-log {
  background: #050608;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
  height: 240px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
}

.log-entry { padding: 3px 0; line-height: 1.5; }
.log-info  { color: #94a3b8; }
.log-trade { color: var(--green); }
.log-warn  { color: var(--yellow); }
.log-error { color: var(--red); }
.log-ai    { color: #c084fc; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 32px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
