/* IBKR Visualizer — Design tokens */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --font-sans: 'Geist', 'Manrope', -apple-system, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Manrope', 'Geist', system-ui, sans-serif;

  /* Numeric font feature for tabular alignment */
  --num: 'tnum' 1, 'lnum' 1;
}

/* ============================================================ */
/* DARK — "Quantum Terminal" : deep navy + cyan accent           */
/* ============================================================ */
.theme-dark {
  --bg:           #050811;
  --bg-2:         #080c1c;
  --surface:      #0d1226;
  --surface-2:    #131932;
  --surface-3:    #1a2247;
  --line:         rgba(120,150,210,0.08);
  --line-strong:  rgba(120,150,210,0.16);
  --text:         #eaf0ff;
  --text-2:       #b0bbd9;
  --muted:        #6e7ba0;
  --dim:          #455077;

  --accent:       #22d3ee;     /* cyan signature */
  --accent-2:     #5b8cff;     /* royal blue */
  --accent-3:     #a78bfa;     /* violet */
  --pos:          #22e0a1;     /* mint green for gains */
  --pos-bright:   #00ffae;
  --pos-dim:      rgba(34,224,161,0.16);
  --neg:          #ff5b6e;
  --neg-bright:   #ff3855;
  --neg-dim:      rgba(255,91,110,0.16);
  --warn:         #fbbf24;
  --info:         #60a5fa;

  --grid:         rgba(255,255,255,0.04);
  --grid-strong:  rgba(255,255,255,0.08);

  --shadow-sm:    0 1px 0 rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:    0 4px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-glow:  0 0 0 1px rgba(34,211,238,.25), 0 0 32px rgba(34,211,238,.08);

  color-scheme: dark;
}

/* ============================================================ */
/* LIGHT — "Institutional Pro" : porcelain + deep blue           */
/* ============================================================ */
.theme-light {
  --bg:           #f5f6f9;
  --bg-2:         #ffffff;
  --surface:      #ffffff;
  --surface-2:    #f7f8fb;
  --surface-3:    #eef0f6;
  --line:         #e6e8ef;
  --line-strong:  #d3d7e2;
  --text:         #0a0e1f;
  --text-2:       #303955;
  --muted:        #6a7493;
  --dim:          #9aa2bb;

  --accent:       #1456d6;
  --accent-2:     #5b8cff;
  --accent-3:     #7c3aed;
  --pos:          #08a86a;
  --pos-dim:      rgba(8,168,106,0.10);
  --neg:          #e2354b;
  --neg-dim:      rgba(226,53,75,0.10);
  --warn:         #c97f00;
  --info:         #2563eb;

  --grid:         rgba(15,23,42,0.04);
  --grid-strong:  rgba(15,23,42,0.08);

  --shadow-sm:    0 1px 2px rgba(15,23,42,.06);
  --shadow-md:    0 4px 24px rgba(15,23,42,.06), 0 0 0 1px rgba(15,23,42,.04);
  --shadow-glow:  0 0 0 1px rgba(20,86,214,.25), 0 0 32px rgba(20,86,214,.08);

  color-scheme: light;
}

/* ============================================================ */
/* Base                                                          */
/* ============================================================ */
.ibv {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-feature-settings: var(--num);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
.ibv * { box-sizing: border-box; }
.ibv .mono { font-family: var(--font-mono); font-feature-settings: var(--num); }
.ibv .num  { font-variant-numeric: tabular-nums; font-feature-settings: var(--num); }
.ibv .pos { color: var(--pos); }
.ibv .neg { color: var(--neg); }
.ibv .muted { color: var(--muted); }
.ibv .dim { color: var(--dim); }

/* Hairline panel */
.ibv .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ibv .panel-2 { background: var(--surface-2); }
.ibv .panel-3 { background: var(--surface-3); }

/* Scrollbars hidden visually but scrollable */
.ibv ::-webkit-scrollbar { width: 6px; height: 6px; }
.ibv ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
.ibv ::-webkit-scrollbar-track { background: transparent; }

/* Tabular cell padding */
.ibv .row { display: flex; align-items: center; }
.ibv .gap-1 { gap: 4px; } .ibv .gap-2 { gap: 8px; } .ibv .gap-3 { gap: 12px; } .ibv .gap-4 { gap: 16px; } .ibv .gap-6 { gap: 24px; }

/* Tiny up/down chevrons */
.ibv .arr-up::before { content: '▲'; font-size: 0.7em; margin-right: 3px; }
.ibv .arr-dn::before { content: '▼'; font-size: 0.7em; margin-right: 3px; }

/* Pulse dot */
@keyframes ibv-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.85); } }
.ibv .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--pos); box-shadow: 0 0 0 0 currentColor;
  animation: ibv-pulse 1.8s ease-in-out infinite;
}
.ibv .dot.neg { background: var(--neg); }
.ibv .dot.warn { background: var(--warn); }

/* Sparkline strokes */
.ibv .spark-pos { stroke: var(--pos); fill: none; stroke-width: 1.5; }
.ibv .spark-neg { stroke: var(--neg); fill: none; stroke-width: 1.5; }

/* Section heading style */
.ibv .sec-head {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  font-family: var(--font-mono);
}

/* Buttons */
.ibv .btn {
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s;
}
.ibv .btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.ibv .btn.primary { background: var(--accent); color: #0a0e1f; border-color: transparent; }
.ibv .btn.ghost { background: transparent; }
.ibv button:focus-visible,
.ibv input:focus-visible,
.ibv select:focus-visible,
.ibv textarea:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
}

/* Tag/chip */
.ibv .tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono); text-transform: uppercase;
}
.ibv .tag.pos { background: var(--pos-dim); color: var(--pos); border-color: transparent; }
.ibv .tag.neg { background: var(--neg-dim); color: var(--neg); border-color: transparent; }

@keyframes ibv-skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.ibv .skeleton {
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--line) 42%, var(--surface-3) 78%);
  background-size: 220% 100%;
  animation: ibv-skeleton 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ibv .dot,
  .ibv .skeleton {
    animation: none;
  }
}

/* Heatmap cell */
.ibv .heat { border-radius: 3px; transition: transform .15s; }
.ibv .heat:hover { transform: scale(1.04); z-index: 2; position: relative; }
