/* ============================================
   TCS STOCK DASHBOARD — VOLCANIC GLASS THEME
   ============================================ */

:root {
  --bg-base:       #0D0D0D;
  --bg-surface:    #141414;
  --bg-card:       #1A1A1A;
  --bg-card-hover: #202020;
  --border:        #2A2A2A;
  --border-bright: #3A3A3A;

  --accent:        #FF6B2B;
  --accent-soft:   #FF8C55;
  --accent-glow:   rgba(255, 107, 43, 0.15);
  --accent-dim:    rgba(255, 107, 43, 0.08);

  --blue:          #4A9EFF;
  --purple:        #A78BFA;
  --green:         #34D399;
  --red:           #F87171;
  --yellow:        #FBBF24;

  --text-primary:  #F0EDE8;
  --text-secondary:#9A9590;
  --text-muted:    #5A5550;

  --font-display:  'Syne', sans-serif;
  --font-mono:     'Space Mono', monospace;

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     18px;

  --shadow-card:   0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-glow:   0 0 40px rgba(255, 107, 43, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background Grid ── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,107,43,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,43,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

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

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

.logo-mark {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), #FF3D00);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  letter-spacing: 1px;
  box-shadow: 0 0 20px rgba(255,107,43,0.4);
  flex-shrink: 0;
}

.header-title h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.exchange-badge {
  display: inline-block;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  margin-right: 6px;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

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

.live-price-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(52,211,153,0); }
}

.live-label {
  font-size: 10px;
  color: var(--green);
  letter-spacing: 1.5px;
  font-weight: 700;
}

.current-price {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.price-change {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.price-change.positive {
  color: var(--green);
  background: rgba(52,211,153,0.1);
}

.price-change.negative {
  color: var(--red);
  background: rgba(248,113,113,0.1);
}

/* ── Time Range Selector ── */
.time-range-selector {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.range-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.range-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.range-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── KPI Grid ── */
.kpi-grid {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--bg-surface);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: background 0.2s;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.5s forwards;
}

.kpi-card:hover {
  background: var(--bg-card-hover);
}

.kpi-card[data-delay="0"] { animation-delay: 0.05s; }
.kpi-card[data-delay="1"] { animation-delay: 0.10s; }
.kpi-card[data-delay="2"] { animation-delay: 0.15s; }
.kpi-card[data-delay="3"] { animation-delay: 0.20s; }
.kpi-card[data-delay="4"] { animation-delay: 0.25s; }
.kpi-card[data-delay="5"] { animation-delay: 0.30s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.kpi-icon {
  font-size: 18px;
  color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}

.kpi-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.kpi-sub {
  font-size: 10px;
  letter-spacing: 0.3px;
}

.kpi-sub.positive { color: var(--green); }
.kpi-sub.negative { color: var(--red); }
.kpi-sub.neutral  { color: var(--text-muted); }

/* ── Charts Grid ── */
.charts-grid {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  padding: 24px 32px;
}

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

.chart-main  { grid-column: 1 / -1; }
.chart-volume { grid-column: 1; }
.chart-returns { grid-column: 2; }
.chart-range  { grid-column: 1 / -1; }

@media (max-width: 1024px) {
  .chart-main,
  .chart-volume,
  .chart-returns,
  .chart-range { grid-column: 1; }
}

/* ── Chart Card ── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.chart-card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.chart-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  width: 100%;
}

.chart-main .chart-wrap  { height: 320px; }
.chart-volume .chart-wrap { height: 220px; }
.chart-returns .chart-wrap { height: 220px; }
.chart-range .chart-wrap  { height: 240px; }

/* ── Stats Section ── */
.stats-section {
  position: relative;
  z-index: 5;
  margin: 0 32px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.stats-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.stats-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.stats-badge {
  font-size: 10px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  letter-spacing: 0.5px;
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.stats-table thead th {
  padding: 12px 20px;
  text-align: left;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.stats-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.stats-table tbody tr:last-child {
  border-bottom: none;
}

.stats-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.stats-table tbody td {
  padding: 13px 20px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.stats-table tbody td:first-child {
  color: var(--text-primary);
  font-weight: 700;
}

.stats-table .td-positive {
  color: var(--green);
  font-weight: 700;
}

.stats-table .td-negative {
  color: var(--red);
  font-weight: 700;
}

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .header { padding: 16px 20px; }
  .charts-grid { padding: 16px 20px; gap: 16px; }
  .stats-section { margin: 0 20px 24px; }
  .footer { padding: 14px 20px; }
  .current-price { font-size: 20px; }
  .kpi-value { font-size: 16px; }
}