/* ═══════════════════════════════════════════════════════════
   AXION TERMINAL — Smart Money Grid Stylesheet
   Institutional-grade Market Maker Analysis Grid
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  --sg-bg: #0D0D0D;
  --sg-surface: #111111;
  --sg-surface-2: #161616;
  --sg-surface-3: #1C1C1C;
  --sg-border: #1A1A1A;
  --sg-border-2: #252525;
  --sg-text-1: #E8E8E8;
  --sg-text-2: #999999;
  --sg-text-3: #555555;
  --sg-lime: #C6E310;
  --sg-red: #FF004D;
  --sg-amber: #FFAA00;
  --sg-cyan: #00D4FF;
  --sg-green-dim: rgba(198, 227, 16, 0.08);
  --sg-red-dim: rgba(255, 0, 77, 0.08);
  --sg-row-h: 28px;
  --sg-header-h: 34px;
  --sg-filter-h: 52px;
  --sg-font-data: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --sg-font-ui: 'Inter', -apple-system, sans-serif;
}

/* ── Main Container ─────────────────────────────────────── */
.sg-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  width: 100%;
  background: var(--sg-bg);
  overflow: hidden;
  position: relative;
  font-family: var(--sg-font-data);
}

/* ── Status Bar (Top) ───────────────────────────────────── */
.sg-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 0 12px;
  background: var(--sg-surface);
  border-bottom: 1px solid var(--sg-border);
  flex-shrink: 0;
}

.sg-status-left,
.sg-status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sg-status-label {
  font-family: var(--sg-font-data);
  font-size: 9px;
  color: var(--sg-text-3);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sg-status-value {
  font-family: var(--sg-font-data);
  font-size: 10px;
  color: var(--sg-lime);
  font-weight: 600;
}

.sg-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sg-lime);
  animation: sg-pulse 2s infinite;
}

@keyframes sg-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Filter Bar ─────────────────────────────────────────── */
.sg-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--sg-surface);
  border-bottom: 1px solid var(--sg-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.sg-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sg-filter-label {
  font-family: var(--sg-font-ui);
  font-size: 9px;
  color: var(--sg-text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-right: 4px;
  white-space: nowrap;
}

.sg-filter-select {
  background: var(--sg-surface-2);
  border: 1px solid var(--sg-border-2);
  color: var(--sg-text-2);
  font-family: var(--sg-font-data);
  font-size: 10px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  min-width: 100px;
}

.sg-filter-select:focus {
  border-color: var(--sg-lime);
  color: var(--sg-text-1);
}

.sg-filter-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--sg-surface-2);
  border: 1px solid var(--sg-border-2);
  color: var(--sg-text-3);
  font-family: var(--sg-font-data);
  font-size: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.sg-filter-toggle:hover {
  border-color: var(--sg-text-3);
  color: var(--sg-text-2);
}

.sg-filter-toggle.active {
  background: rgba(198, 227, 16, 0.12);
  border-color: var(--sg-lime);
  color: var(--sg-lime);
}

.sg-filter-toggle .sg-check {
  width: 10px;
  height: 10px;
  border: 1px solid var(--sg-text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
}

.sg-filter-toggle.active .sg-check {
  background: var(--sg-lime);
  border-color: var(--sg-lime);
  color: #000;
}

.sg-filter-search {
  background: var(--sg-surface-2);
  border: 1px solid var(--sg-border-2);
  color: var(--sg-text-1);
  font-family: var(--sg-font-data);
  font-size: 10px;
  padding: 4px 8px;
  outline: none;
  width: 120px;
  margin-left: auto;
}

.sg-filter-search:focus {
  border-color: var(--sg-lime);
}

.sg-filter-search::placeholder {
  color: var(--sg-text-3);
}

.sg-filter-divider {
  width: 1px;
  height: 20px;
  background: var(--sg-border-2);
  margin: 0 4px;
}

/* ── Grid Viewport ──────────────────────────────────────── */
.sg-grid-viewport {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── Pinned (Frozen) Columns ────────────────────────────── */
.sg-pinned {
  flex-shrink: 0;
  width: 340px;
  overflow: hidden;
  border-right: 2px solid var(--sg-border-2);
  position: relative;
  z-index: 10;
  background: var(--sg-bg);
}

.sg-pinned-header {
  display: flex;
  height: var(--sg-header-h);
  border-bottom: 1px solid var(--sg-border-2);
  background: var(--sg-surface);
}

.sg-pinned-body {
  overflow: hidden;
  position: relative;
}

/* ── Scrollable Columns ─────────────────────────────────── */
.sg-scrollable {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sg-scrollable-header-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  height: var(--sg-header-h);
  border-bottom: 1px solid var(--sg-border-2);
  background: var(--sg-surface);
}

.sg-scrollable-header-wrap::-webkit-scrollbar {
  display: none;
}

.sg-scrollable-header {
  display: flex;
  height: 100%;
  min-width: max-content;
}

.sg-scrollable-body-wrap {
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
  height: calc(100% - var(--sg-header-h));
}

.sg-scrollable-body {
  position: relative;
  min-width: max-content;
}

/* ── Column Headers ─────────────────────────────────────── */
.sg-col-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-family: var(--sg-font-data);
  font-size: 9px;
  font-weight: 600;
  color: var(--sg-text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  border-right: 1px solid var(--sg-border);
  transition: background 0.1s;
}

.sg-col-header:hover {
  background: var(--sg-surface-2);
  color: var(--sg-text-1);
}

.sg-col-header.sorted-asc::after {
  content: ' ▲';
  font-size: 7px;
  color: var(--sg-lime);
}

.sg-col-header.sorted-desc::after {
  content: ' ▼';
  font-size: 7px;
  color: var(--sg-red);
}

/* Header sub-row for "filter" label */
.sg-col-subheader {
  font-size: 8px;
  color: var(--sg-text-3);
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Pinned column widths ───────────────────────────────── */
.sg-col-star    { width: 24px; min-width: 24px; }
.sg-col-symbol  { width: 70px; min-width: 70px; }
.sg-col-pinky   { width: 56px; min-width: 56px; }
.sg-col-crossing { width: 66px; min-width: 66px; }
.sg-col-unusual  { width: 62px; min-width: 62px; }
.sg-col-likuid   { width: 56px; min-width: 56px; }

/* ── Scrollable column widths ───────────────────────────── */
.sg-col-wn      { width: 72px; min-width: 72px; }
.sg-col-dn      { width: 72px; min-width: 72px; }
.sg-col-pct     { width: 64px; min-width: 64px; }
.sg-col-poc     { width: 80px; min-width: 80px; }
.sg-col-darkpool { width: 90px; min-width: 90px; }
.sg-col-smi     { width: 72px; min-width: 72px; }

/* ── Row Styling ────────────────────────────────────────── */
.sg-row {
  display: flex;
  height: var(--sg-row-h);
  align-items: center;
  border-bottom: 1px solid var(--sg-border);
  position: absolute;
  left: 0;
  right: 0;
  will-change: transform;
}

.sg-row:hover {
  background: var(--sg-surface-2) !important;
}

.sg-row-even {
  background: transparent;
}

.sg-row-odd {
  background: rgba(255, 255, 255, 0.01);
}

/* ── Cell Styling ───────────────────────────────────────── */
.sg-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: var(--sg-font-data);
  font-size: 10px;
  color: var(--sg-text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 100%;
  border-right: 1px solid var(--sg-border);
  position: relative;
}

.sg-cell-symbol {
  justify-content: flex-start;
  font-weight: 600;
  color: var(--sg-text-1);
  padding-left: 8px;
}

.sg-cell-star {
  font-size: 12px;
  color: var(--sg-amber);
  cursor: pointer;
}

/* State cells: v = green, x = neutral */
.sg-cell-state-v {
  color: var(--sg-lime);
  font-weight: 600;
}

.sg-cell-state-x {
  color: var(--sg-text-3);
}

.sg-cell-state-alert {
  background: rgba(255, 0, 77, 0.2);
  color: var(--sg-red);
  font-weight: 700;
}

/* Numeric cells */
.sg-cell-positive {
  color: var(--sg-lime);
}

.sg-cell-negative {
  color: var(--sg-red);
}

.sg-cell-neutral {
  color: var(--sg-text-3);
}

/* Heatmap intensity backgrounds */
.sg-heat-1 { background: rgba(198, 227, 16, 0.05); }
.sg-heat-2 { background: rgba(198, 227, 16, 0.10); }
.sg-heat-3 { background: rgba(198, 227, 16, 0.18); }
.sg-heat-4 { background: rgba(198, 227, 16, 0.28); }
.sg-heat-5 { background: rgba(198, 227, 16, 0.40); }

.sg-heat-n1 { background: rgba(255, 0, 77, 0.05); }
.sg-heat-n2 { background: rgba(255, 0, 77, 0.10); }
.sg-heat-n3 { background: rgba(255, 0, 77, 0.18); }
.sg-heat-n4 { background: rgba(255, 0, 77, 0.28); }
.sg-heat-n5 { background: rgba(255, 0, 77, 0.40); }

/* Dark Pool alert badge */
.sg-darkpool-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(255, 0, 77, 0.2);
  color: var(--sg-red);
  border: 1px solid rgba(255, 0, 77, 0.4);
}

.sg-darkpool-clear {
  color: var(--sg-text-3);
  font-size: 9px;
}

/* SMI bar */
.sg-smi-bar {
  width: 100%;
  height: 4px;
  background: var(--sg-surface-3);
  position: absolute;
  bottom: 2px;
  left: 0;
}

.sg-smi-fill {
  height: 100%;
  transition: width 0.3s ease;
}

/* ── Flash Animations ───────────────────────────────────── */
@keyframes sg-flash-buy {
  0%   { background: rgba(198, 227, 16, 0.5); }
  100% { background: transparent; }
}

@keyframes sg-flash-sell {
  0%   { background: rgba(255, 0, 77, 0.5); }
  100% { background: transparent; }
}

.sg-flash-buy {
  animation: sg-flash-buy 200ms ease-out;
}

.sg-flash-sell {
  animation: sg-flash-sell 200ms ease-out;
}

/* ── Canvas Sparkline ───────────────────────────────────── */
.sg-sparkline-cell {
  position: relative;
}

.sg-sparkline-cell canvas {
  position: absolute;
  top: 2px;
  left: 2px;
  pointer-events: none;
}

.sg-sparkline-val {
  position: relative;
  z-index: 1;
}

/* ── Custom Scrollbars ──────────────────────────────────── */
.sg-scrollable-body-wrap::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.sg-scrollable-body-wrap::-webkit-scrollbar-track {
  background: var(--sg-bg);
}

.sg-scrollable-body-wrap::-webkit-scrollbar-thumb {
  background: var(--sg-border-2);
  border-radius: 0;
}

.sg-scrollable-body-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--sg-text-3);
}

.sg-scrollable-body-wrap::-webkit-scrollbar-corner {
  background: var(--sg-bg);
}

/* ── Footer Stats Bar ───────────────────────────────────── */
.sg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  padding: 0 12px;
  background: var(--sg-surface);
  border-top: 1px solid var(--sg-border);
  flex-shrink: 0;
}

.sg-footer-stat {
  font-family: var(--sg-font-data);
  font-size: 9px;
  color: var(--sg-text-3);
}

.sg-footer-stat span {
  color: var(--sg-text-2);
  margin-left: 4px;
}

.sg-footer-stat .sg-val-lime {
  color: var(--sg-lime);
}

.sg-footer-stat .sg-val-red {
  color: var(--sg-red);
}

/* ── Responsive Density ─────────────────────────────────── */
@media (max-width: 1200px) {
  .sg-pinned {
    width: 280px;
  }
  .sg-col-symbol  { width: 60px; min-width: 60px; }
  .sg-col-pinky   { width: 48px; min-width: 48px; }
  .sg-col-crossing { width: 56px; min-width: 56px; }
  .sg-col-unusual  { width: 52px; min-width: 52px; }
  .sg-col-likuid   { width: 48px; min-width: 48px; }
}
