/* ===================================================
   CRYPTOVERSE DASHBOARD — styles.css
   Dark, sleek, terminal-inspired with neon accents
   =================================================== */

:root {
  --bg-base: #050810;
  --bg-surface: #0b0f1a;
  --bg-card: #0d1221;
  --bg-card-hover: #111829;
  --bg-table-row: #0f1524;
  --bg-table-alt: #0c1220;

  --border: #1a2340;
  --border-bright: #243060;

  --text-primary: #e8eaf6;
  --text-secondary: #7b8bbf;
  --text-muted: #3d4f7a;

  --accent: #4db8ff;
  --accent-dim: rgba(77, 184, 255, 0.12);
  --accent-glow: rgba(77, 184, 255, 0.4);

  --green: #00ff88;
  --green-dim: rgba(0, 255, 136, 0.1);
  --red: #ff4466;
  --red-dim: rgba(255, 68, 102, 0.1);
  --orange: #ff8c00;
  --yellow: #ffcc00;

  --btc: #f7931a;

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

  --radius: 12px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

/* === Reset & Base === */
*, *::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-display);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Background Effects === */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(77, 184, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 184, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(ellipse at center,
    rgba(77, 184, 255, 0.06) 0%,
    rgba(77, 184, 255, 0.02) 40%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* === Layout === */
main { position: relative; z-index: 1; }

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 8, 16, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.2em;
  color: var(--text-primary);
}

.logo-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(77,184,255,0.2);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.15em;
}

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.update-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(0,255,136,0.2);
  padding: 4px 10px;
  border-radius: 20px;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.timestamp {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* === Market Strip === */
.market-strip {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.strip-stats {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.strip-stat {
  display: flex;
  flex-direction: column;
  padding: 0 28px 0 0;
  border-right: 1px solid var(--border);
  margin-right: 28px;
}

.strip-stat:last-child { border-right: none; }

.strip-stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.strip-stat-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* === Section Headers === */
.section-header {
  margin: 48px 0 24px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.section-title .accent {
  color: var(--accent);
}

.section-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.1em;
}

/* === Coins Table === */
.table-section { padding-bottom: 32px; }

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.coins-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.coins-table thead tr {
  border-bottom: 1px solid var(--border-bright);
}

.coins-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 14px 16px;
  text-align: right;
  font-weight: 400;
}

.coins-table th:first-child,
.coins-table th:nth-child(2) { text-align: left; }

.coins-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: default;
}

.coins-table tbody tr:last-child { border-bottom: none; }
.coins-table tbody tr:hover { background: var(--bg-card-hover); }
.coins-table tbody tr:nth-child(even) { background: rgba(10,14,30,0.4); }
.coins-table tbody tr:nth-child(even):hover { background: var(--bg-card-hover); }

.coins-table td {
  padding: 13px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
  color: var(--text-primary);
}

.coins-table td:first-child { text-align: left; color: var(--text-muted); font-size: 11px; }
.coins-table td:nth-child(2) { text-align: left; }

.coin-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coin-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--bg-surface);
}

.coin-name { font-weight: 700; font-size: 13px; }
.coin-symbol { font-size: 10px; color: var(--text-muted); letter-spacing: 0.1em; }

.positive { color: var(--green); }
.negative { color: var(--red); }

.loading-row {
  text-align: center !important;
  color: var(--text-muted);
  padding: 48px 16px !important;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Sparkline cell */
.spark-cell canvas { display: block; }

/* === Charts Grid === */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding-bottom: 48px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.chart-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.chart-card:hover { border-color: var(--border-bright); }
.chart-card:hover::before { opacity: 1; }

.chart-card.full-width { grid-column: 1 / -1; }
.chart-card.half-width { grid-column: span 1; }

.chart-card-header { margin-bottom: 16px; }

.chart-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.chart-card-desc {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 900px;
}

.chart-container {
  position: relative;
  height: 340px;
  width: 100%;
}

.chart-card.half-width .chart-container { height: 280px; }

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

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

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

.data-source {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 12px;
  letter-spacing: 0.08em;
}

/* === Monthly Returns Table === */
.monthly-table-wrapper {
  overflow-x: auto;
  margin-top: 8px;
}

.monthly-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.monthly-table th {
  padding: 8px 6px;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-align: center;
  font-weight: 400;
  border-bottom: 1px solid var(--border);
}

.monthly-table td {
  padding: 7px 4px;
  text-align: center;
  border: 1px solid rgba(26, 35, 64, 0.4);
  min-width: 52px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  transition: opacity var(--transition);
}

.monthly-table tr:last-child td {
  border-top: 2px solid var(--border-bright);
  font-size: 9px;
}

.monthly-table .year-label {
  color: var(--text-muted);
  font-size: 10px;
  text-align: left;
  padding-left: 8px;
  font-weight: 400;
  min-width: 40px;
}

/* === Fear & Greed === */
.fng-section { padding-bottom: 64px; }

.fng-wrapper {
  display: grid;
  grid-template-columns: 360px 1fr 300px;
  gap: 20px;
  align-items: start;
}

.fng-gauge-card,
.fng-history-card,
.fng-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.fng-gauge-card::before,
.fng-history-card::before,
.fng-info-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.fng-gauge-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fng-center-value {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

#fng-value {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 52px;
  line-height: 1;
  color: var(--text-primary);
}

#fng-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
}

.fng-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.fng-history-title,
.fng-info-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.fng-timestamp-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
}

.fng-zones {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fng-zone {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  gap: 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--clr);
  background: rgba(255,255,255,0.02);
}

.fng-zone-range {
  grid-row: 1 / 3;
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--clr);
  align-self: center;
}

.fng-zone-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: var(--text-primary);
}

.fng-zone-desc {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Footer === */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 20px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--accent);
  flex-shrink: 0;
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  flex: 1;
}

.footer-right {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* === Responsive === */
@media (max-width: 1100px) {
  .fng-wrapper {
    grid-template-columns: 1fr 1fr;
  }
  .fng-info-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.half-width { grid-column: 1; }
  .fng-wrapper { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}

@media (max-width: 600px) {
  .strip-stats { gap: 16px; }
  .strip-stat { border-right: none; margin-right: 0; }
  .section-title { font-size: 20px; }
}

/* === Chart.js overrides === */
.chartjs-tooltip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  color: var(--text-primary) !important;
}
