/* ═══════════════════════════════════════════
   Obsila Crypto Analytics — styles.css
   Extended from original design system
═══════════════════════════════════════════ */
:root {
  --bg: #0a0a0a;
  --bg-soft: #111111;
  --panel: rgba(23,23,23,.78);
  --panel-hover: rgba(31,31,31,.9);
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.14);
  --text: #f5f5f5;
  --muted: #aaaaaa;
  --green: #50d06f;
  --green-soft: #7adf6b;
  --red: #f05a48;
  --amber: #c4b85f;
  --cyan: #25d8ee;
  --violet: #7a80ff;
  --shadow: 0 22px 40px rgba(0,0,0,.35);
  --radius: 22px;
  --font: "Google Sans","Google Sans Text","Product Sans","Segoe UI",Arial,sans-serif;
}

/* ─── RESET ──────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { max-width: 100%; display: block; }

/* ─── LAYOUT ─────────────────────────────── */
.shell {
  width: min(1400px, calc(100% - 28px));
  margin: 24px auto 64px;
}

/* ─── TOPBAR ─────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: min(1400px, calc(100% - 28px));
  margin: 16px auto 0;
  padding: 14px 16px;
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 20px;
}
.brand { display: flex; align-items: center; min-width: 0; text-decoration: none; }
.brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand-accent {
  color: var(--amber);
  font-weight: 400;
}
.topnav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: .95rem;
  letter-spacing: .01em;
  background: rgba(255,255,255,.02);
  transition: transform .24s ease, background .24s ease, border-color .24s ease;
}
.topnav a:hover { transform: translateY(-1px); background: rgba(255,255,255,.06); border-color: var(--line-strong); }

/* ─── SECTIONS ───────────────────────────── */
.section { padding: 20px 0 8px; }

/* ─── PANEL ──────────────────────────────── */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ─── CHART ROWS ─────────────────────────── */
.chart-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.row-1 { grid-template-columns: 1fr; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-fg { grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── CARD ───────────────────────────────── */
.card {
  padding: 18px 18px 14px;
  transition: transform .28s ease, background .28s ease, border-color .28s ease, box-shadow .28s ease;
}
.card:hover { transform: translateY(-3px); background: var(--panel-hover); border-color: var(--line-strong); }

.card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 6px;
  flex-wrap: wrap;
}
.card-header h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-weight: 600;
}
.card-badge {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  text-transform: uppercase;
}
.card-desc {
  font-size: .82rem;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.55;
}

/* ─── CANVAS ─────────────────────────────── */
.canvas-wrap { height: 300px; position: relative; }
.canvas-wrap-tall { height: 400px; position: relative; }
.canvas-wrap canvas,
.canvas-wrap-tall canvas { width: 100% !important; height: 100% !important; }

/* ─── CHART LEGEND BELOW ─────────────────── */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 4px 4px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
}
.legend-swatch {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-swatch.dashed {
  background: repeating-linear-gradient(
    to right,
    var(--sw-color, #888) 0, var(--sw-color, #888) 5px,
    transparent 5px, transparent 9px
  );
}

/* ─── TABLE ──────────────────────────────── */
.table-panel { padding: 8px 0 4px; overflow: hidden; }
.table-wrap { overflow: auto; }
.table-wrap::-webkit-scrollbar { height: 10px; width: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
thead th {
  text-align: left;
  color: #d9d9d9;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  vertical-align: middle;
  font-size: .95rem;
}
tbody tr { transition: background .22s ease; }
tbody tr:hover { background: rgba(255,255,255,.03); }
.col-rank { width: 40px; color: var(--muted) !important; font-size: .8rem !important; }
.col-num { text-align: right; }
.col-chart { width: 160px; text-align: center; }
.rank-num { color: var(--muted); font-size: .8rem; }
.asset-cell { display: flex; flex-direction: column; gap: 3px; }
.asset-name { font-weight: 600; letter-spacing: -.01em; }
.asset-symbol { color: var(--muted); font-size: .82rem; text-transform: uppercase; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.spark-wrap { height: 48px; width: 140px; margin: 0 auto; }
.pos { color: var(--green-soft); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.loading-cell { text-align: center; color: var(--muted); padding: 32px !important; font-size: .9rem; }

/* ─── HEATMAP ────────────────────────────── */
.heatmap-card { padding: 18px; }
.heatmap {
  display: grid;
  gap: 1px;
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 1px;
  overflow: auto;
  margin-top: 12px;
}
.heatmap.landscape { grid-template-columns: 90px repeat(12, minmax(68px, 1fr)); }
.hm-cell {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  padding: 6px 8px;
  font-size: .8rem;
  text-align: center;
}
.hm-head { background: #141414; color: #d8d8d8; font-weight: 600; }
.hm-year { justify-content: flex-start; padding-left: 12px; }

/* ─── FEAR & GREED ───────────────────────── */
.sentiment-panel { overflow: hidden; }
.sentiment-right-col { display: flex; flex-direction: column; gap: 14px; }
.sentiment-right-col .card { flex: 1; }
.gauge-wrap { padding: 16px 12px 4px; }
#fearGauge { width: 100%; height: auto; display: block; }
.gauge-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 18px 20px;
}
.gauge-reading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.reading-val {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1;
}
.reading-label {
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.gauge-history {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.hist-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 90px;
}
.hist-pill-label { font-size: .65rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.hist-pill-val { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.hist-pill-class { font-size: .65rem; color: var(--muted); }

/* ─── TOAST ──────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 20px;
  transform: translateX(-50%) translateY(18px);
  background: #151515; border: 1px solid var(--line);
  border-radius: 999px; padding: 11px 16px;
  color: #fafafa; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 30; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── REVEAL ─────────────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .65s ease, transform .65s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ─── RESPONSIVE ─────────────────────────── */
@media (max-width: 1100px) {
  .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-fg { grid-template-columns: 1fr; }
  .sentiment-right-col { flex-direction: row; }
}
@media (max-width: 820px) {
  .shell, .topbar { width: min(100% - 20px, 1400px); }
  .topbar { padding: 12px; }
  .topnav { gap: 8px; }
  .topnav a { padding: 9px 13px; font-size: .9rem; }
  .row-2, .row-3, .row-fg { grid-template-columns: 1fr; }
  .sentiment-right-col { flex-direction: column; }
  .canvas-wrap { height: 240px; }
  .canvas-wrap-tall { height: 300px; }
}
@media (max-width: 560px) {
  .section { padding: 14px 0 6px; }
  thead th, tbody td { padding: 12px 10px; }
  .spark-wrap { width: 110px; height: 42px; }
  .hm-cell { font-size: .72rem; min-height: 36px; }
  .heatmap.landscape { grid-template-columns: 68px repeat(12, minmax(58px, 1fr)); }
  .gauge-wrap { padding: 10px 6px 0; }
  .canvas-wrap { height: 200px; }
}
