/* ── CMC Market Heatmap  [cmc_market_heatmap] ───────────────────────────── */

.cmc-mh-wrap {
    width: 100%;
    font-family: inherit;
    direction: ltr; /* chart labels are LTR */
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 1 — HEATMAP
   ═══════════════════════════════════════════════════════════════════════════ */

.cmc-mh-heatmap {
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    padding: 0 0 2px;
}

/* ── Top bar: title + legend ── */

.cmc-mh-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
    gap: 8px;
}

.cmc-mh-main-title {
    font-size: 14px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.3px;
}

.cmc-mh-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cmc-mh-leg-item {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
}

.cmc-mh-leg--vsp { color: #4ade80; }
.cmc-mh-leg--sp  { color: #86efac; }
.cmc-mh-leg--wp  { color: #a3e6b5; }
.cmc-mh-leg--wn  { color: #fca5a5; }
.cmc-mh-leg--sn  { color: #f87171; }
.cmc-mh-leg--vsn { color: #ef4444; }

/* ── Row: category label + 8 cells ── */

.cmc-mh-row {
    display: flex;
    gap: 2px;
    padding: 2px 2px 0;
}

/* Category label column */
.cmc-mh-cat-col {
    width: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
}

.cmc-mh-cat-label {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.45);
    user-select: none;
}

/* 8-cell grid for instruments */
.cmc-mh-cells {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    min-width: 0;
}

/* ── Individual tile ── */

.cmc-mh-tile {
    padding: 7px 8px 6px;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: default;
    min-height: 74px;
    overflow: hidden;
    transition: filter 0.12s;
}

.cmc-mh-tile:hover { filter: brightness(1.12); }

/* Color tiers */
.cmc-mh-tile--vsp { background: #16a34a; }
.cmc-mh-tile--sp  { background: #15803d; }
.cmc-mh-tile--wp  { background: #14532d; }
.cmc-mh-tile--wn  { background: #450a0a; }
.cmc-mh-tile--sn  { background: #991b1b; }
.cmc-mh-tile--vsn { background: #dc2626; }

.cmc-mh-tname {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.cmc-mh-tprice {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

.cmc-mh-thl {
    display: flex;
    gap: 5px;
    font-size: 8.5px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmc-mh-tchg {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 2 — PERFORMANCE CHART
   ═══════════════════════════════════════════════════════════════════════════ */

.cmc-mh-chart-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    padding: 16px 20px 12px;
}

.cmc-mh-chart-header {
    margin-bottom: 14px;
}

.cmc-mh-chart-title {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-left: 4px solid #0f172a;
    padding-left: 10px;
    line-height: 1;
}

.cmc-mh-chart-box {
    position: relative;
    /* height set dynamically by JS based on item count */
    min-height: 400px;
}

.cmc-mh-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .cmc-mh-cells {
        grid-template-columns: repeat(4, 1fr);
    }
    .cmc-mh-tile { min-height: 68px; }
    .cmc-mh-tprice { font-size: 13px; }
}

@media (max-width: 560px) {
    .cmc-mh-cells {
        grid-template-columns: repeat(2, 1fr);
    }
    .cmc-mh-cat-col { width: 36px; }
    .cmc-mh-cat-label { font-size: 7px; }
    .cmc-mh-tprice { font-size: 12px; }
    .cmc-mh-thl { display: none; }
}
