/* Analisis Token — tema gelap, grid layout B */
:root {
  --bg: #0f1520;
  --card: #1b2636;
  --text: #e6edf7;
  --muted: #8fa1bd;
  --accent: #2b5cff;
  --up: #22c55e;
  --down: #ef4444;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid rgba(143, 161, 189, 0.2);
}

.topbar label { font-size: 14px; }

#pair-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid rgba(143, 161, 189, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  min-width: 160px;
}

#analyze-btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
}

#analyze-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#ticker-strip {
  flex-basis: 100%;
  font-size: 12px;
  min-height: 1em;
}

/* ---------- Grid layout B ---------- */
.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-areas:
    "verdict verdict"
    "charts  hud"
    "market  fed";
  gap: 12px;
  padding: 12px 14px;
  max-width: 1200px;
  margin: 0 auto;
}

#card-verdict { grid-area: verdict; }
#card-charts  { grid-area: charts; }
#card-hud     { grid-area: hud; }
#card-market  { grid-area: market; }
#card-fed     { grid-area: fed; }

@media (max-width: 719px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "verdict"
      "charts"
      "hud"
      "market"
      "fed";
  }
}

/* ---------- Kartu ---------- */
.card {
  background: var(--card);
  border: 1px solid rgba(143, 161, 189, 0.2);
  border-radius: 9px;
  padding: 12px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Grafik */
/* Grafik: satu kolom — tiap kanal (1D/4H/1W) satu baris penuh agar EMA terbaca. */
#card-charts .card-body {
  display: grid;
  grid-template-columns: 1fr;
}

#card-charts figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
}

#card-charts figcaption { font-size: 11px; }

/* Stat dasar */
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label { font-size: 11px; }

.stat-value { font-size: 15px; font-weight: 600; }

/* Placeholder saat memuat */
.placeholder { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .card.loading .placeholder {
    animation: pulse 1.4s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }
}

/* Error */
.card.error {
  border-color: var(--down);
}

/* Baris "Data gagal + coba ulang" per key (render Task 9). */
.err-row {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--down);
  font-size: 12px;
}

button.retry {
  background: transparent;
  color: var(--down);
  border: 1px solid var(--down);
  border-radius: 6px;
  padding: 3px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

button.retry:hover { background: rgba(239, 68, 68, 0.15); }

.card.error .placeholder { color: var(--down); }

/* ---------- Kelas warna ---------- */
.up   { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(143, 161, 189, 0.35);
}

.badge.up   { border-color: var(--up); }
.badge.down { border-color: var(--down); }

/* ---------- HUD tabel ---------- */
.hud-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.hud-table th,
.hud-table td {
  padding: 4px 0;
  border-bottom: 1px solid rgba(143, 161, 189, 0.12);
  text-align: right;
}

.hud-table th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Verdict ---------- */
.verdict-layout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.verdict-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
  flex: 1;
}

.verdict-ring {
  width: 140px;
  height: 140px;
  flex: none;
  font-family: inherit;
}

.verdict-ring .ring-track {
  stroke: rgba(143, 161, 189, 0.25);
  stroke-width: 8;
}

.ring-score {
  fill: var(--text);
  font-size: 34px;
  font-weight: 700;
}

.ring-score .ring-of {
  font-size: 13px;
  font-weight: 400;
  fill: var(--muted);
}

.ring-label {
  fill: var(--muted);
  font-size: 12px;
}

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

.vb {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid rgba(143, 161, 189, 0.3);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
}

.vb b { font-weight: 600; }
.vb i { font-style: normal; font-weight: 600; }

.verdict-summary {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.verdict-note {
  margin: 0;
  font-size: 12px;
}

/* ---------- Grafik SVG ---------- */
.chart {
  display: block;
  width: 100%;
  height: auto;
}

.axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-family: inherit;
}

figcaption .lg {
  margin-left: 8px;
  font-size: 10px;
}

figcaption .lg i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: -1px;
}

/* ---------- F&G mini bar ---------- */
.fng-bar {
  display: block;
  width: 100%;
  height: auto;
  max-width: 300px;
}

.fed-badge {
  border-color: rgba(143, 161, 189, 0.4);
  color: var(--text);
}

.fed-note {
  margin: 0;
  font-size: 12px;
}

/* ---------- Footer ---------- */
#report-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 14px;
  font-size: 12px;
}

#report-footer p { margin: 0; }

#report-footer .stamps {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Menu (satu kartu per tampilan) ---------- */
nav.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
  max-width: 1200px;
  margin: 0 auto;
}

nav.menu a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(143, 161, 189, 0.25);
}

nav.menu a.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(43, 92, 255, 0.2);
}

/* Hanya kartu tampilan aktif yang tampil; tanpa JS (tanpa data-view) semua kartu tampil. */
body[data-view] .grid { display: block; }
body[data-view] .card { display: none; }
body[data-view="verdict"] #card-verdict,
body[data-view="grafik"] #card-charts,
body[data-view="hud"] #card-hud,
body[data-view="pasar"] #card-market,
body[data-view="fed"] #card-fed { display: block; }
