/* ===================================================================
   Market Movers — supplemental styles
   Inherits all core tokens from app-shell.css
   =================================================================== */

/* Heat-map color tokens (fallback to named colors) */
:root {
  --heat-neg: #e05b5b;
  --heat-mid: #3a3f4b;
  --heat-pos: #1fa971;
}

/* ── Page container ─────────────────────────────────────────────── */
.mm-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  color: var(--text, inherit);
}

/* ── Sticky header ──────────────────────────────────────────────── */
.mm-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-elev, inherit);
  border-bottom: 1px solid var(--border, transparent);
  padding: 12px 20px 0;
  flex-shrink: 0;
}

.mm-header-row-a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}

/* ── Dashboard bar inside header ──────────────────────────────── */
#mm-universe-bar {
  padding-bottom: 8px;
}
#mm-universe-bar .rc-top-bar {
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border, transparent);
  padding-top: 8px;
}

.mm-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mm-title-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius, 8px);
  background: var(--accent, currentColor);
  opacity: 0.8;
  flex-shrink: 0;
}

.mm-title-block h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text, inherit);
  line-height: 1.2;
}

.mm-title-block .mm-subtitle {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, inherit);
  margin: 0;
}

/* ── Button groups (pill toggles) ───────────────────────────────── */
.mm-btn-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border, transparent);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.mm-btn-group .mm-btn {
  border: none;
  border-radius: 0;
  border-right: 1px solid var(--border, transparent);
}
.mm-btn-group .mm-btn:last-child { border-right: none; }

.mm-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--muted, inherit);
  border: 1px solid var(--border, transparent);
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.mm-btn:hover {
  background: var(--bg-elev, rgba(255,255,255,0.04));
  color: var(--text, inherit);
}
.mm-btn.active {
  background: var(--accent, currentColor);
  color: #fff;
  font-weight: 600;
}

/* ── Segment + sub-filter rows ──────────────────────────────────── */
.mm-header-row-b,
.mm-header-row-c {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px 0;
  scrollbar-width: thin;
}
.mm-header-row-b::-webkit-scrollbar,
.mm-header-row-c::-webkit-scrollbar { height: 3px; }
.mm-header-row-b::-webkit-scrollbar-thumb,
.mm-header-row-c::-webkit-scrollbar-thumb { background: var(--border, transparent); border-radius: 2px; }

.mm-header-row-c .mm-btn {
  font-size: 10px;
  padding: 3px 8px;
}

/* ── Main content area ──────────────────────────────────────────── */
.mm-content {
  flex: 1;
  padding: 16px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.mm-card {
  background: var(--card-bg, var(--bg-elev, inherit));
  border: 1px solid var(--card-border, var(--border, transparent));
  border-radius: var(--radius, 12px);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.mm-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}
.mm-card-header h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--text, inherit);
}
.mm-card-header .mm-card-ctx {
  font-size: 10px;
  color: var(--muted, inherit);
}

/* ── Grid layouts ───────────────────────────────────────────────── */
.mm-section-internals {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}
.mm-section-leaderboards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ── Breadth bar ────────────────────────────────────────────────── */
.mm-breadth-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}
.mm-breadth-bar {
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  background: var(--border, rgba(255,255,255,0.06));
}
.mm-breadth-adv {
  background: var(--success, green);
  transition: width 0.5s ease;
  min-width: 2px;
}
.mm-breadth-dec {
  background: var(--danger, red);
  transition: width 0.5s ease;
  min-width: 2px;
}

/* ── KPI row ────────────────────────────────────────────────────── */
.mm-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.mm-kpi {
  text-align: center;
}
.mm-kpi-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, inherit);
  margin-bottom: 2px;
}
.mm-kpi-value {
  font-size: 16px;
  font-weight: 700;
}

/* ── Volume card ────────────────────────────────────────────────── */
.mm-vol-primary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.mm-vol-big {
  font-size: 26px;
  font-weight: 700;
  color: var(--text, inherit);
}
.mm-vol-pct {
  font-size: 13px;
  font-weight: 600;
}
.mm-vol-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 11px;
  color: var(--muted, inherit);
}
.mm-vol-footer strong {
  color: var(--text, inherit);
}

/* ── Semantic text colors ───────────────────────────────────────── */
.text-positive { color: var(--success, green); }
.text-negative { color: var(--danger, red); }
.text-muted    { color: var(--muted, inherit); }

/* ── Leaderboard grid cards ─────────────────────────────────────── */
.mm-grid-wrap {
  height: 500px;
}
.mm-grid-wrap .ag-root-wrapper {
  border: none !important;
}
.mm-grid-wrap .ag-header-cell,
.mm-grid-wrap .ag-cell {
  padding-left: 6px;
  padding-right: 6px;
}
.mm-grid-wrap .ag-header-cell-text {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Stats Summary card ─────────────────────────────────────────── */
.mm-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 0;
}
.mm-stats-row + .mm-stats-row {
  border-top: 1px solid var(--border, transparent);
}
.mm-stat {
  text-align: center;
}
.mm-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, inherit);
  margin-bottom: 2px;
}
.mm-stat-value {
  font-size: 13px;
  font-weight: 700;
}

/* ── AG Grid cell color overrides (match ETF Internals style) ──── */
.mm-grid-wrap .ag-cell.mm-cell-pos,
.mm-grid-wrap .ag-cell.mm-cell-neg {
  text-align: right !important;
  font-weight: 600 !important;
}
.mm-grid-wrap .ag-cell.mm-cell-pos { color: var(--success, #16a34a) !important; }
.mm-grid-wrap .ag-cell.mm-cell-neg { color: var(--danger, #dc2626) !important; }
.dark-theme .mm-grid-wrap .ag-cell.mm-cell-pos { color: var(--success, #22c55e) !important; }
.dark-theme .mm-grid-wrap .ag-cell.mm-cell-neg { color: var(--danger, #ef4444) !important; }

/* ── Heatmap card ───────────────────────────────────────────────── */
.mm-heatmap-container {
  width: 100%;
  min-height: 600px;
}
.mm-heatmap-footer {
  text-align: center;
  margin-top: 10px;
}
.mm-load-more {
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--accent, currentColor);
  border: 1px solid var(--accent, currentColor);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.mm-load-more:hover {
  background: var(--accent, currentColor);
  color: #fff;
}
.mm-load-more:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Loading overlay ────────────────────────────────────────────── */
.mm-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.mm-loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.mm-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border, rgba(255,255,255,0.1));
  border-top-color: var(--accent, currentColor);
  border-radius: 50%;
  animation: mm-spin 0.7s linear infinite;
}
@keyframes mm-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .mm-section-leaderboards { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .mm-section-internals { grid-template-columns: 1fr; }
  .mm-header { padding: 10px 12px 0; }
  .mm-content { padding: 12px 12px 24px; }
}
