/* markets.css ─ PGM Markets tab: scorecard, data table, stacked sub-charts, inline panels, news view, sector selector bar, animation control bar. */

/* ── PGM Markets tab ─────────────────────────────────────────────────── */

.mkt-chart-wrap {
  height: 220px;
}

.mkt-view-bar {
  margin-top: 8px;
}

.mkt-metal-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.mkt-metal-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 4px;
  background: #1e2130;
  border: 1px solid #2e3145;
  border-radius: 4px;
  color: #e8e8e8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.mkt-metal-btn:hover {
  color: #fff;
  border-color: #b8bdd0;
}

.mkt-metal-btn[data-mkt-metal="Pt"].active { background: #a0b8d022; border-color: #a0b8d0; color: #a0b8d0; }
.mkt-metal-btn[data-mkt-metal="Pd"].active { background: #e0a04022; border-color: #e0a040; color: #e0a040; }
.mkt-metal-btn[data-mkt-metal="Rh"].active { background: #e0606022; border-color: #e06060; color: #e06060; }
.mkt-metal-btn[data-mkt-metal="Ru"].active { background: #6090e022; border-color: #6090e0; color: #6090e0; }
.mkt-metal-btn[data-mkt-metal="Ir"].active { background: #70c87022; border-color: #70c870; color: #70c870; }

.mkt-view-btn {
  padding: 4px 14px;
  background: #1e2130;
  border: 1px solid #2e3145;
  border-radius: 4px;
  color: #e8e8e8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mkt-view-btn:hover  { color: #fff; border-color: #b8bdd0; }
.mkt-view-btn.active { background: #c9a84c22; border-color: #c9a84c; color: #c9a84c; }

.mkt-range-btn {
  flex: 1;
  padding: 4px 0;
  background: #1e2130;
  border: 1px solid #2e3145;
  border-radius: 4px;
  color: #e8e8e8;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mkt-range-btn:hover  { color: #fff; border-color: #b8bdd0; }
.mkt-range-btn.active { background: #c9a84c22; border-color: #c9a84c; color: #c9a84c; }

/* Scorecard */
.mkt-scorecard {
  display: flex;
  gap: 8px;
}

.mkt-score-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1a1d27;
  border: 1px solid #2e3145;
  border-radius: 5px;
  padding: 8px 6px;
}

.mkt-score-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b8bdd0;
  margin-bottom: 4px;
}

.mkt-score-value {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #c9a84c;
}

/* Data table */
#mkt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  white-space: nowrap;
}

#mkt-table th {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #c8c8c8;
  text-align: right;
  padding: 3px 5px;
  border-bottom: 1px solid #1e2130;
}

#mkt-table th:first-child { text-align: left; }

#mkt-table td {
  padding: 4px 5px;
  border-bottom: 1px solid #181b25;
  text-align: right;
  font-family: 'Consolas', monospace;
  color: #bbb;
}

#mkt-table tbody tr:hover { background: #1a1d27; }

.mkt-row-label {
  font-family: 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 600;
  color: #e0e0e0 !important;
  text-align: left !important;
}

.mkt-forecast-col {
  color: #c8cde0 !important;
  font-style: italic;
}

/* Stacked sub-charts (Supply & Demand view) */
.mkt-hidden { display: none !important; }

.mkt-charts-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.mkt-sub-chart {
  height: 170px;
  position: relative;
  background: #15171f;
  border-radius: 4px;
  padding: 10px 6px 4px 6px;
}

/* In animation mode, the Balance chart gets the freed-up space from Supply + Demand */
#mkt-balance-wrap.mkt-anim-focus .mkt-sub-chart { height: 360px; }

/* Inline panels (scorecard + data table) sitting between/around the Balance chart */
.mkt-inline-panel {
  margin: 10px 0;
  padding: 10px 0;
  border-top: 1px solid #1e2130;
  border-bottom: 1px solid #1e2130;
}

.mkt-inline-panel h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c8cde0;
  margin-bottom: 8px;
}

/* News view */
.mkt-news-wrap { margin-top: 12px; }

.mkt-news-status {
  text-align: center;
  color: #c8cde0;
  font-size: 11px;
  padding: 16px 0;
}

.mkt-news-card {
  background: #15171f;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid #3a3f55;
  transition: border-color 0.15s;
}
.mkt-news-card:hover { border-left-color: #c9a84c; }

.mkt-news-card-meta {
  font-size: 9.5px;
  color: #c8cde0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.mkt-news-card-source { color: #c9a84c; font-weight: 600; }
.mkt-news-card-time   { color: #c0c5d8; }

.mkt-news-card-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #e8e8e8;
  text-decoration: none;
  line-height: 1.35;
  margin-bottom: 4px;
}
.mkt-news-card-title:hover { color: #c9a84c; }

.mkt-news-card-snippet {
  font-size: 11px;
  color: #aaa;
  line-height: 1.45;
}

/* Sector selector bar (hidden until Regional view is active) */
.mkt-sector-bar-hidden {
  display: none;
}

.mkt-sector-btn,
.mkt-subsector-btn,
.mkt-mines-btn,
.mkt-recycling-btn,
.mkt-recycling-type-btn,
.mkt-demand-btn {
  padding: 4px 10px;
  background: #1e2130;
  border: 1px solid #444;
  border-radius: 4px;
  color: #aaa;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mkt-sector-btn:hover,
.mkt-subsector-btn:hover,
.mkt-mines-btn:hover,
.mkt-recycling-btn:hover,
.mkt-recycling-type-btn:hover,
.mkt-demand-btn:hover { color: #fff; border-color: #b8bdd0; }

.mkt-demand-btn.active           { background: #c9a84c22; border-color: #c9a84c; color: #c9a84c; }
.mkt-sector-btn.active           { background: #c9a84c22; border-color: #c9a84c; color: #c9a84c; }
.mkt-subsector-btn.active        { background: #b08aff22; border-color: #b08aff; color: #b08aff; }
.mkt-mines-btn.active            { background: #50c87822; border-color: #50c878; color: #50c878; }
.mkt-recycling-btn.active        { background: #3ec8a022; border-color: #3ec8a0; color: #3ec8a0; }
.mkt-recycling-type-btn.active   { background: #ff9f4022; border-color: #ff9f40; color: #ff9f40; }

#mkt-recycling-type-bar {
  flex-wrap: wrap;
  gap: 4px;
}

/* Make the small sub-toggle bars flow inline so they share a row with the year-range bar.
   The top-level view bar (.mkt-view-bar) keeps its own full-width row. */
#mkt-demand-bar,
#mkt-sector-bar,
#mkt-subsector-bar,
#mkt-mines-bar,
#mkt-recycling-bar,
#mkt-recycling-type-bar,
#mkt-range-bar {
  display: inline-flex;
  flex-wrap: wrap;
  vertical-align: middle;
  gap: 8px;
  margin: 4px 8px 4px 0;
}
#mkt-range-bar .mkt-range-btn {
  padding: 4px 12px;   /* a bit wider so adjacent buttons don't feel cramped */
}

/* Keep the hidden override winning */
.mkt-sector-bar-hidden,
.mkt-hidden { display: none !important; }

.mkt-price-toggle-btn {
  margin-left: auto;
  padding: 4px 10px;
  background: #1e2130;
  border: 1px solid #444;
  border-radius: 4px;
  color: #aaa;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mkt-price-toggle-btn:hover  { color: #fff; border-color: #b8bdd0; }
.mkt-price-toggle-btn.active { background: #ff5e5e22; border-color: #ff5e5e; color: #ff5e5e; }

/* Animation control bar */
.mkt-anim-bar {
  display: flex !important;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mkt-anim-bar.mkt-sector-bar-hidden { display: none !important; }
.mkt-anim-play-btn,
.mkt-anim-step-btn {
  width: 28px;
  height: 24px;
  background: #1e2130;
  border: 1px solid #444;
  border-radius: 4px;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mkt-anim-play-btn:hover,
.mkt-anim-step-btn:hover { color: #fff; border-color: #c9a84c; }
.mkt-anim-play-btn.playing { background: #c9a84c22; border-color: #c9a84c; color: #c9a84c; }
.mkt-anim-scrubber {
  flex: 1;
  min-width: 80px;
  accent-color: #c9a84c;
  height: 4px;
}
.mkt-anim-year {
  display: inline-block;
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  color: #c9a84c;
}
.mkt-anim-select {
  background: #1e2130;
  border: 1px solid #444;
  border-radius: 4px;
  color: #c8cde0;
  font-size: 11px;
  padding: 3px 6px;
}
