/* ==========================================================================
   THE AI TRADE - Visual Capitalist Inspired Infographic Interface
   Optimized for MacBook Pro Display (100vh fitted dashboard)
   ========================================================================== */

:root {
  --bg-primary: #141413;
  --bg-secondary: #1c1b1a;
  --bg-card: rgba(28, 27, 26, 0.92);
  --bg-card-hover: rgba(35, 34, 32, 0.96);
  --border-subtle: rgba(44, 43, 40, 0.8);
  --border-highlight: rgba(217, 119, 87, 0.4);
  
  --text-main: #faf9f5;
  --text-muted: #b0aea5;
  --text-dim: #87867f;
  --accent-terracotta: #d97757;

  --accent-cyan: #34d399;
  --accent-blue: #10b981;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-mint: #34d399;
  --accent-jade: #059669;
  --accent-teal: #14b8a6;
  --accent-amber: #f59e0b;
  --accent-gold: #eab308;
  --accent-rose: #f43f5e;
  
  --gain-green: #10b981;
  --gain-bg: rgba(16, 185, 129, 0.12);
  --loss-red: #f43f5e;
  --loss-bg: rgba(244, 63, 94, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: #141413;
  color: #faf9f5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* Subtle Blueprint Grid */
.blueprint-grid {
  background-color: #141413;
}

.font-display {
  font-family: 'Cabinet Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

.vc-panel {
  background: rgba(28, 27, 26, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(44, 43, 40, 0.85);
  border-radius: 16px;
}

/* Background Atmospheric Gradients */
.bg-glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}
.bg-glow-1 {
  top: -150px;
  right: 10%;
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, #059669, #022c22);
}
.bg-glow-2 {
  top: 35%;
  left: -200px;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, #10b981, #064e3b);
}
.bg-glow-3 {
  bottom: 5%;
  right: -150px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #047857, #062b1b);
}

/* Glass Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-panel:hover {
  border-color: var(--border-highlight);
}

/* Ticker Bar */
.ticker-bar {
  background: rgba(8, 15, 11, 0.96);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  z-index: 40;
}
.ticker-track {
  display: inline-flex;
  gap: 2rem;
  padding: 0.5rem 0;
  animation: marquee 45s linear infinite;
}
.ticker-track:hover {
  animation-play-state: paused;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Hero Section */
.hero-gradient-text {
  background: linear-gradient(135deg, #ffffff 20%, #a7f3d0 70%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

/* ==========================================================================
   PYRAMID VALUE CHAIN TIERS (STEPPED TRAPEZOIDAL INFOGRAPHIC)
   ========================================================================== */
.pyramid-tier-slab {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 18, 14, 0.94);
  margin: 0 auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pyramid-tier-slab:hover {
  transform: translateY(-2px) scale(1.008);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.pyramid-tier-slab.active-slab {
  border-width: 1.5px;
  transform: translateY(-2px) scale(1.012);
  z-index: 25;
}

/* Stepped Widths for Visual Pyramid */
.tier-width-6 { width: 52%; }
.tier-width-5 { width: 62%; }
.tier-width-4 { width: 72%; }
.tier-width-3 { width: 82%; }
.tier-width-2 { width: 92%; }
.tier-width-1 { width: 100%; }

/* Company Chips / Tokens */
.vc-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: #cbd5e1;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.vc-token:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.vc-token.titan-token {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.vc-token.selected-token {
  background: #ffffff !important;
  color: #060a08 !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
}

/* Treemap View */
.treemap-canvas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  height: 100%;
}

.treemap-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.treemap-tile:hover {
  transform: scale(1.02);
  z-index: 10;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6), inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
}

/* Table View */
.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}
.custom-table th {
  padding: 14px 18px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 18, 14, 0.96);
  position: sticky;
  top: 0;
  z-index: 20;
}
.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.06);
  transition: background 0.15s ease;
}
.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* 52-Week Mini Bar */
.range-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  position: relative;
}
.range-bar-thumb {
  position: absolute;
  top: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  transform: translateX(-50%);
  box-shadow: 0 0 8px #10b981;
}

/* Custom Scrollbar */
.custom-scroll::-webkit-scrollbar {
  width: 5px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Badge styling */
.badge-gain {
  color: var(--gain-green);
  background: var(--gain-bg);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.badge-loss {
  color: var(--loss-red);
  background: var(--loss-bg);
  border: 1px solid rgba(244, 63, 94, 0.25);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

/* Modal Drawer */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  background: #0a140f;
  border: 1px solid var(--border-highlight);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open .modal-card {
  transform: scale(1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   CONCENTRIC ORBITS & BUBBLE POSITIONING ENGINE
   ========================================================================== */

.orbit-track-path {
  fill: none;
  stroke-dasharray: 4, 8;
  transition: all 0.4s ease;
}

.orbit-track-glow {
  fill: none;
  opacity: 0.15;
  transition: opacity 0.3s ease;
}

.orbit-track-path.active-track {
  stroke-dasharray: none;
  stroke-width: 2.2px;
  opacity: 0.95;
  filter: drop-shadow(0 0 8px currentColor);
}

/* Company Bubbles */
.bubble-group {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  transform-origin: center;
}

.bubble-group:hover, .bubble-group.active-bubble {
  filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.85));
  z-index: 50;
}

.bubble-group.dimmed-bubble {
  opacity: 0.22;
}

.bubble-circle {
  transition: stroke-width 0.2s ease, filter 0.2s ease;
}

.bubble-group:hover .bubble-circle {
  stroke-width: 2.5px;
}

.bubble-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  fill: #ffffff;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

.bubble-cap {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  fill: #94a3b8;
  pointer-events: none;
  text-anchor: middle;
}

/* Central Singularity Gravity Well Core */
.singularity-core {
  filter: drop-shadow(0 0 25px rgba(56, 189, 248, 0.45));
}

.singularity-pulse {
  animation: singularity-pulse 4s ease-in-out infinite;
}

@keyframes singularity-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

/* Top 50 Ledger Table Rows (Zero-Jitter Hardware Accelerated) */
.top50-row {
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background-color 0.12s ease, border-left-color 0.12s ease;
  will-change: background-color, border-left-color;
}

.top50-row:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.top50-row.active-row {
  background-color: rgba(217, 119, 87, 0.12);
  border-left-color: #d97757;
}

/* Rank Medals */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.rank-1 {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #000;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

.rank-2 {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #000;
  box-shadow: 0 0 6px rgba(226, 232, 240, 0.6);
}

.rank-3 {
  background: linear-gradient(135deg, #f97316, #c2410c);
  color: #fff;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
}

.rank-other {
  color: #64748b;
}

/* Tooltip Styling */
#bubble-tooltip {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 15px rgba(6, 182, 212, 0.25);
}

/* Ring Hover Hit Area & Explanation Card */
.ring-hit-track {
  pointer-events: stroke;
}

.orbit-track-path.active-hover-ring {
  stroke-width: 3.5px !important;
  stroke-dasharray: none !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 12px currentColor) !important;
}

.bubble-group.ring-highlighted-bubble {
  transform-origin: center;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.8));
  opacity: 1 !important;
}

#ring-explanation-card {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.ring-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 5.5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  transition: all 0.15s ease;
  cursor: pointer;
}

.ring-chip-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

/* ==========================================================================
   TIMELINE SCRUBBER & STREAMGRAPH ENGINES
   ========================================================================== */

#timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  cursor: pointer;
  box-shadow: 0 0 10px #10b981;
  border: 2px solid #ffffff;
  transition: transform 0.1s ease;
}

#timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Streamgraph Styles */
.stream-layer {
  transition: opacity 0.25s ease, filter 0.25s ease;
  cursor: crosshair;
}

.stream-layer:hover {
  filter: brightness(1.2) drop-shadow(0 0 8px currentColor);
}

.stream-crosshair-line {
  stroke: rgba(255, 255, 255, 0.6);
  stroke-dasharray: 2, 4;
  pointer-events: none;
}

/* Streamgraph Stock Growth Overlay */
.stock-stream-line {
  filter: drop-shadow(0 0 10px #34d399);
}

.stock-stream-area {
  opacity: 0.22;
}

.stream-stock-pill.active-pill {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #ffffff !important;
  border: 1px solid #10b981 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.stock-glow-point {
  filter: drop-shadow(0 0 8px #34d399);
}



/* Full-Page Scrollable Layout Override (e.g. Basic Mode) */
body.scrollable-page,
.scrollable-page {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
  min-height: 100vh !important;
}
