/* ============================================================
   Nexgence Terminal — modern dark trading-deck theme
   ============================================================ */

:root {
  --term-bg:        #0a0e14;
  --term-bg-alt:    #0d1117;
  --term-panel:     #11161d;
  --term-panel-2:   #161c25;
  --term-border:    #1e242d;
  --term-border-2:  #262d38;
  --term-accent:    #22d3ee;   /* cyan */
  --term-accent-2:  #818cf8;   /* indigo */
  --term-accent-3:  #f472b6;   /* pink */
  --term-accent-dim:#0e7490;
  --term-text:      #e2e8f0;
  --term-text-dim:  #94a3b8;
  --term-muted:     #64748b;
  --term-up:        #10b981;
  --term-down:      #f43f5e;
  --term-warn:      #f59e0b;
  --term-flash-up:  rgba(16, 185, 129, 0.28);
  --term-flash-dn:  rgba(244, 63, 94, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--term-bg);
  color: var(--term-text);
  font-family: 'JetBrains Mono', 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(34,211,238,0.06), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(129,140,248,0.05), transparent 60%),
    var(--term-bg);
}

/* very subtle scanlines */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.008) 0px,
    rgba(255, 255, 255, 0.008) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 9999;
}

/* ===== Loading overlay ===== */
.term-loader {
  position: fixed;
  inset: 0;
  background: var(--term-bg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--term-accent);
  font-size: 14px;
  letter-spacing: 0.18em;
  transition: opacity 380ms ease;
}
.term-loader.hidden {
  opacity: 0;
  pointer-events: none;
}
.term-loader .blip {
  width: 8px; height: 8px; background: var(--term-accent);
  border-radius: 50%;
  margin-top: 1rem;
  animation: blink 0.8s steps(2, start) infinite;
  box-shadow: 0 0 14px var(--term-accent);
}
.term-loader .lo-bar {
  width: 240px;
  height: 2px;
  background: #0f1620;
  margin-top: 1.5rem;
  overflow: hidden;
  position: relative;
  border-radius: 2px;
}
.term-loader .lo-bar::after {
  content: '';
  position: absolute;
  top: 0; left: -40%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--term-accent), transparent);
  animation: slide 1.2s linear infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }
@keyframes slide { to { left: 100%; } }

/* ===== Top bar ===== */
.term-top {
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, #131a23 0%, #0c1118 100%);
  border-bottom: 1px solid var(--term-border-2);
  padding: 0 14px;
  gap: 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
}
.term-top::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.45), rgba(129,140,248,0.35), transparent);
}
.term-top .brand {
  color: var(--term-accent);
  font-weight: 700;
  letter-spacing: 0.22em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.term-top .brand::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--term-accent);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--term-accent);
  transform: rotate(45deg);
}
.term-top .brand span { color: var(--term-text); margin-left: 6px; font-weight: 500; letter-spacing: 0.18em; }
.term-top .top-meta { color: var(--term-muted); display: flex; gap: 14px; }
.term-top .top-meta b { color: var(--term-text); font-weight: 500; }
.term-top .top-spacer { flex: 1; }
.term-top .status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--term-up); display: inline-block;
  margin-right: 6px; box-shadow: 0 0 8px var(--term-up);
  animation: blink 1.4s ease-in-out infinite;
}

.disclaimer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--term-warn);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  border-radius: 999px;
}
.disclaimer-pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--term-warn);
  box-shadow: 0 0 8px var(--term-warn);
  animation: blink 2s ease-in-out infinite;
}

.term-top .login-btn {
  background: linear-gradient(180deg, var(--term-accent) 0%, #0891b2 100%);
  color: #03171c;
  border: none;
  padding: 6px 16px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.20em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  transition: filter 120ms ease, transform 120ms ease, box-shadow 160ms ease;
  box-shadow: 0 0 0 1px rgba(34,211,238,0.5), 0 4px 14px rgba(34,211,238,0.18);
}
.term-top .login-btn:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.7), 0 6px 22px rgba(34,211,238,0.32);
}
.term-top .login-btn:active { transform: translateY(1px); }

/* ===== Main grid ===== */
.term-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.05fr 1.4fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: var(--term-border);
  width: 100%;
}

.panel {
  background: var(--term-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: linear-gradient(180deg, #161c25 0%, #11161d 100%);
  border-bottom: 1px solid var(--term-border-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
}
.panel-head .title { color: var(--term-accent); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.panel-head .title::before {
  content: '';
  width: 3px; height: 12px;
  background: var(--term-accent);
  border-radius: 1px;
  box-shadow: 0 0 8px var(--term-accent);
}
.panel-head .meta { color: var(--term-muted); font-size: 10px; letter-spacing: 0.14em; }
.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 4px 0;
}

/* Watchlist */
.watchlist {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}
.watchlist thead th {
  position: sticky; top: 0;
  background: var(--term-panel);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--term-muted);
  text-align: right;
  padding: 5px 10px;
  border-bottom: 1px solid var(--term-border-2);
  text-transform: uppercase;
}
.watchlist thead th:first-child { text-align: left; }
.watchlist tbody td {
  padding: 4px 10px;
  font-size: 11.5px;
  text-align: right;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.watchlist tbody td:first-child { text-align: left; color: var(--term-text); font-weight: 500; }
.watchlist tbody tr.section td {
  color: var(--term-accent-2);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 8px 10px 4px 10px;
  border-bottom: 1px solid var(--term-border-2);
  background: rgba(129,140,248,0.05);
  text-align: left;
}
.watchlist tbody tr:hover:not(.section) td {
  background: rgba(34,211,238,0.04);
}
.up    { color: var(--term-up); }
.down  { color: var(--term-down); }
.flat  { color: var(--term-muted); }
.cell-flash-up { animation: flashUp 0.65s ease-out; }
.cell-flash-dn { animation: flashDn 0.65s ease-out; }
@keyframes flashUp {
  0%   { background: var(--term-flash-up); }
  100% { background: transparent; }
}
@keyframes flashDn {
  0%   { background: var(--term-flash-dn); }
  100% { background: transparent; }
}
.arrow-up::before   { content: '▲'; margin-right: 3px; font-size: 9px; }
.arrow-down::before { content: '▼'; margin-right: 3px; font-size: 9px; }

/* Charts panel */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: var(--term-border);
  height: 100%;
}
.chart-tile {
  background: var(--term-panel);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 6px 12px;
  min-height: 0;
}
.chart-tile .ct-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--term-muted);
}
.chart-tile .ct-head .ct-sym { color: var(--term-accent); font-weight: 700; font-size: 11px; letter-spacing: 0.22em; }
.chart-tile .ct-price {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  display: flex; align-items: baseline; gap: 10px;
}
.chart-tile .ct-chg {
  font-size: 11px;
  letter-spacing: 0.04em;
}
.chart-tile canvas {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: block;
  margin-top: 6px;
}

/* Right column splits into news + heatmap */
.right-col {
  display: grid;
  grid-template-rows: 1.05fr 1fr;
  gap: 1px;
  background: var(--term-border);
  min-height: 0;
  height: 100%;
}

/* News */
.news {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news li {
  display: grid;
  grid-template-columns: 60px 42px 1fr;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
  align-items: baseline;
  animation: newsIn 0.35s ease-out;
}
.news .n-time { color: var(--term-muted); font-size: 10.5px; }
.news .n-tag {
  color: #03171c;
  background: var(--term-accent);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-align: center;
  padding: 2px 4px;
  font-weight: 700;
  border-radius: 3px;
}
.news .n-tag.tag-mkt { background: var(--term-accent); }
.news .n-tag.tag-eco { background: var(--term-warn); }
.news .n-tag.tag-cpy { background: var(--term-accent-3); }
.news .n-tag.tag-cmd { background: #fbbf24; }
.news .n-tag.tag-fx  { background: var(--term-accent-2); color: #0b0f1a; }
.news .n-headline { color: var(--term-text); font-size: 11.5px; line-height: 1.4; }
.news .n-headline b { color: var(--term-accent); font-weight: 600; }
@keyframes newsIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(48px, 1fr);
  gap: 3px;
  padding: 8px;
  height: 100%;
  overflow: auto;
}
.hm-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 4px;
  transition: background 600ms ease, border-color 600ms ease;
}
.hm-cell .hm-sym { font-weight: 700; letter-spacing: 0.10em; color: #fff; }
.hm-cell .hm-pct { font-size: 11px; color: rgba(255,255,255,0.92); }

/* Bottom ticker tape */
.term-tape {
  flex: 0 0 26px;
  background: linear-gradient(180deg, #0c1118 0%, #0a0e14 100%);
  border-top: 1px solid var(--term-border-2);
  overflow: hidden;
  position: relative;
  font-size: 11px;
}
.term-tape::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.45), rgba(129,140,248,0.35), transparent);
}
.term-tape .tape-track {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: tape-scroll 90s linear infinite;
  line-height: 26px;
}
.term-tape .t-item {
  display: inline-block;
  margin-right: 30px;
  letter-spacing: 0.04em;
}
.term-tape .t-sym { color: var(--term-accent); font-weight: 700; margin-right: 6px; letter-spacing: 0.10em; }
@keyframes tape-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0e14; }
::-webkit-scrollbar-thumb { background: #232b36; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--term-accent-dim); }

/* Responsive */
@media (max-width: 1100px) {
  .term-grid { grid-template-columns: 1fr 1fr; }
  .right-col { grid-row: span 2; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .term-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .panel-body { max-height: 320px; }
  .term-top { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .disclaimer-pill { font-size: 9px; }
}
