/* Asset detail page — CoinGecko-inspired layout */

.asset-wrap.asset-theme-light {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --text: rgba(15, 23, 42, 0.92);
  --muted: rgba(15, 23, 42, 0.62);
  --grid: rgba(15, 23, 42, 0.08);
  --accent: #2563eb;
  --accent2: #7c3aed;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
  --r: 14px;
  --pad: 16px;
  --up: #16a34a;
  --down: #dc2626;
  --chart: #ea3943;
  --chart-fill: rgba(234, 57, 67, 0.12);
}

.asset-wrap {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  color: var(--text);
}

/* Page grid integration */
.asset-page-grid { margin-top: 0; }

.page-side-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  align-self: stretch;
  border-left: 1px solid var(--color-border, #e7eaee);
  padding-left: 16px;
}

.page-side-col .page-side.highlights-panel {
  border-left: none;
  padding-left: 0;
  flex: 0 0 auto;
}

html.dark-mode .page-side-col {
  border-left-color: #2a2d35;
}

.asset-inner-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .asset-inner-layout { grid-template-columns: 1fr; }
}

.asset-cg-left {
  position: sticky;
  top: 12px;
}

@media (max-width: 900px) {
  .asset-cg-left { position: static; }
}

.asset-wrap * { box-sizing: border-box; }
.asset-wrap a { color: var(--accent); text-decoration: none; }

/* ── Top toolbar (compare / buy) ───────────────────────────────── */
.asset-cg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.asset-cg-toolbar .asset-buy-btc-btn {
  margin-right: auto;
}

.asset-wrap .asset-buy-btc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #f7931a, #ffb547);
  color: #fff;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(247, 147, 26, 0.28);
  transition: transform 0.12s, box-shadow 0.12s;
}

.asset-wrap .asset-buy-btc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(247, 147, 26, 0.35);
}

.asset-wrap .asset-compare-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.asset-wrap .asset-compare-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.asset-wrap .asset-compare-search { position: relative; }

.asset-wrap .asset-compare-input {
  width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

.asset-wrap .asset-compare-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.asset-wrap .asset-compare-dropdown.open { display: block; }

.asset-wrap .acmp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
}

.asset-wrap .acmp-item:hover,
.asset-wrap .acmp-item.active { background: rgba(37, 99, 235, 0.08); }

.asset-wrap .acmp-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 50%;
}

.asset-wrap .acmp-name { flex: 1; font-weight: 600; }
.asset-wrap .acmp-ticker { color: var(--muted); font-size: 11px; font-weight: 600; }
.asset-wrap .acmp-empty { padding: 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* ── Left sidebar: identity + price ────────────────────────────── */
.cg-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.cg-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.asset-wrap .asset-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 48px;
}

.asset-wrap .asset-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.cg-identity-text { min-width: 0; }

.asset-wrap .asset-h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
}

.asset-wrap .asset-ticker {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  margin-top: 2px;
}

.cg-rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  flex-shrink: 0;
}

.cg-price-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.cg-price-hero {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cg-change-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.cg-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.cg-change-badge.up {
  color: var(--up);
  background: rgba(22, 163, 74, 0.1);
}

.cg-change-badge.down {
  color: var(--down);
  background: rgba(220, 38, 38, 0.1);
}

.cg-asof {
  font-size: 12px;
  color: var(--muted);
}

/* 24h range bar */
.cg-range {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.cg-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.cg-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  position: relative;
  overflow: hidden;
}

.cg-range-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--down), var(--up));
  width: 50%;
}

.cg-range-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--up);
  border: 2px solid var(--card);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.cg-range-caption {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* Stats list */
.cg-stats {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.cg-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 13px;
}

.cg-stat:last-child { border-bottom: none; }

.cg-stat-k {
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cg-stat-v {
  font-weight: 700;
  text-align: right;
}

.cg-stat-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Info pills */
.cg-info-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.cg-info-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.cg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cg-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.cg-pill a { color: inherit; }

/* ── Center column ─────────────────────────────────────────────── */
.cg-chart-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cg-chart-mode {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card, #fff);
}

.cg-mode-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cg-mode-btn:hover:not(:disabled) { color: var(--text); }

.cg-mode-btn.active {
  background: rgba(22, 163, 74, 0.12);
  color: var(--up);
}

.cg-mode-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Sub-tabs below chart */
.cg-subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 24px 0 16px;
}

.cg-subtab {
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.cg-subtab:hover { color: var(--text); }

.cg-subtab.active {
  color: var(--up);
  border-bottom-color: var(--up);
}

.cg-subtab-panel { display: none; }
.cg-subtab-panel.active { display: block; }

/* Chart card — no outer box */
.asset-wrap .asset-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.asset-wrap .asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.asset-wrap .asset-meta {
  font-size: 12px;
  color: var(--muted);
}

.cg-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cg-timeframes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cg-tf-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cg-tf-btn:hover { color: var(--text); }

.cg-tf-btn.active {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.35);
  color: var(--up);
}

.asset-wrap .asset-canvas {
  height: 340px;
  position: relative;
}

.asset-wrap .asset-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Performance row */
.cg-perf-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .cg-perf-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .cg-perf-grid { grid-template-columns: repeat(2, 1fr); }
}

.cg-perf-cell {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}

.cg-perf-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.cg-perf-val {
  font-size: 14px;
  font-weight: 800;
}

.cg-perf-val.up { color: var(--up); }
.cg-perf-val.down { color: var(--down); }

/* Sections (about, fundamentals, mcap narrative) */
.asset-wrap .asset-section {
  margin-top: 20px;
}

.asset-wrap .asset-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.asset-wrap .asset-section-title {
  font-size: 16px;
  font-weight: 800;
}

.asset-wrap .asset-section-sub {
  font-size: 12px;
  color: var(--muted);
}

.asset-wrap .asset-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.asset-wrap .asset-desc p { margin: 0 0 16px; }

.asset-wrap .asset-desc p.asset-desc-methodology {
  font-style: italic;
  opacity: 0.9;
}

.asset-wrap .asset-narr-body {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 0;
}

.asset-wrap .asset-narr-kpi {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.asset-wrap .asset-narr-kpi-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.asset-wrap .asset-narr-kpi-value {
  font-size: 22px;
  font-weight: 800;
}

.asset-wrap .asset-narr-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
}

/* Fundamentals card grid — expand panel spans full width on its own row */
.asset-wrap .asset-fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.asset-wrap .asset-fpair {
  display: contents;
}

.asset-wrap .asset-fitem {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.asset-wrap .asset-fitem .k {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.asset-wrap .asset-fitem .v {
  font-size: 16px;
  font-weight: 800;
  margin-top: 4px;
}

.asset-wrap .asset-fitem .v a,
.asset-wrap .asset-fitem .v a.asset-flink {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.asset-wrap .asset-fitem .v a:hover {
  color: var(--accent);
}

.asset-wrap .asset-fitem .s {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.asset-wrap .asset-fitem-clickable { cursor: pointer; }
.asset-wrap .fitem-chevron { float: right; font-size: 10px; opacity: 0.5; }

.asset-wrap .asset-fitem-expand {
  grid-column: 1 / -1;
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: -4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.asset-wrap .asset-fpair.expanded .asset-fitem-expand {
  display: block;
}

.asset-wrap .asset-fitem-expand .fexp-def,
.asset-wrap .asset-fitem-expand .fexp-interp {
  margin: 0 0 10px;
}

.asset-wrap .asset-fitem-expand .fexp-src {
  margin: 0;
  font-size: 11px;
  opacity: 0.85;
}

/* Dominance tab placeholder */
.asset-dominance-note {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.asset-dominance-chart .asset-dominance-canvas {
  height: 280px;
}

/* Two-chart grid on markets tab */
.asset-wrap .asset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .asset-wrap .asset-grid { grid-template-columns: 1fr; }
}

/* ── Right sidebar: news timeline ──────────────────────────────── */
.cg-news-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.cg-news-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.cg-news-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.cg-timeline {
  position: relative;
  padding-left: 18px;
}

.cg-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.cg-timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.cg-timeline-item::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
}

.cg-timeline-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.cg-timeline-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.cg-timeline-title a {
  color: var(--text);
}

.cg-timeline-title a:hover { color: var(--accent); }

.cg-news-more {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
}

.cg-news-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
}

/* Status + spark (hidden in new layout but kept for JS) */
.asset-wrap .spark-img { display: none !important; }

.asset-wrap .asset-related-news {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.asset-wrap .asset-related-news .home-news__empty {
  margin: 0 0 12px;
}

.asset-wrap .asset-status {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .asset-cg-toolbar { justify-content: stretch; }
  .asset-wrap .asset-compare-wrap { width: 100%; flex-wrap: wrap; }
  .asset-wrap .asset-compare-input { width: 100%; }
  .asset-wrap .asset-compare-dropdown { width: 100%; right: auto; left: 0; }
}
