/* ── CMC Metals Market Summary  [cmc_metals_market] ─────────────────────── */

.cmc-mkt-wrap {
    width: 100%;
    font-family: inherit;
    direction: rtl;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANEL SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.cmc-mkt-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

/* ── Panel header ── */

.cmc-mkt-panel-header {
    padding: 14px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
    direction: rtl;
}

.cmc-mkt-panel-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.cmc-mkt-panel-subtitle {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    line-height: 1.4;
}

/* ── 2-column RTL grid ── */

.cmc-mkt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

.cmc-mkt-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    direction: rtl;
    min-width: 0;
}

.cmc-mkt-cell:nth-child(odd)           { border-left: 1px solid #f1f5f9; }
.cmc-mkt-cell:nth-last-child(-n+2)     { border-bottom: none; }

/* ── Icon circle ── */

.cmc-mkt-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmc-mkt-icon--gold      { background: #d97706; }
.cmc-mkt-icon--platinum  { background: #64748b; }
.cmc-mkt-icon--palladium { background: #475569; }
.cmc-mkt-icon--silver    { background: #94a3b8; }
.cmc-mkt-icon--copper    { background: #c2410c; }
.cmc-mkt-icon--aluminium { background: #334155; }

.cmc-mkt-ico        { fill: rgba(255,255,255,0.92); }
.cmc-mkt-ico-inner  { fill: rgba(255,255,255,0.35); }
.cmc-mkt-ico--medal { width: 15px; height: 19px; }
.cmc-mkt-ico--std   { width: 17px; height: 17px; }

/* ── Label ── */

.cmc-mkt-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-align: right;
}

.cmc-mkt-nameline {
    display: flex;
    align-items: center;
    gap: 6px;
    direction: rtl;
}

.cmc-mkt-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #f97316;
}

.cmc-mkt-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cmc-mkt-code {
    font-size: 10px;
    color: #94a3b8;
    direction: ltr;
    font-family: 'Courier New', monospace;
    line-height: 1.3;
    padding-right: 13px;
}

/* ── Meta: price + changes ── */

.cmc-mkt-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
    min-width: 100px;
}

.cmc-mkt-priceline {
    display: flex;
    align-items: baseline;
    gap: 4px;
    direction: ltr;
    flex-wrap: nowrap;
}

.cmc-mkt-price {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    direction: ltr;
    white-space: nowrap;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.cmc-mkt-unit {
    font-size: 9px;
    color: #64748b;
    direction: ltr;
    white-space: nowrap;
}

.cmc-mkt-chgline {
    display: flex;
    align-items: center;
    gap: 5px;
    direction: ltr;
    margin-top: 2px;
}

.cmc-mkt-chg {
    font-size: 11.5px;
    font-weight: 700;
    direction: ltr;
    white-space: nowrap;
}

.cmc-mkt-chg--pos { color: #16a34a; }
.cmc-mkt-chg--neg { color: #dc2626; }

.cmc-mkt-abs {
    font-size: 10.5px;
    font-weight: 400;
    color: #64748b;
    direction: ltr;
    white-space: nowrap;
}

/* ── Panel footer ── */

.cmc-mkt-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    direction: rtl;
    flex-wrap: wrap;
    gap: 8px;
}

.cmc-mkt-panel-link {
    font-size: 11.5px;
    font-weight: 600;
    color: #4D5B72;
    text-decoration: none;
    white-space: nowrap;
}

.cmc-mkt-panel-link:hover { color: #1e293b; text-decoration: underline; }

.cmc-mkt-panel-disclaimer {
    font-size: 10px;
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHART SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.cmc-mkt-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 14px;
    direction: rtl;
}

/* ── Chart header: title (right) + period tabs (left) ── */

.cmc-mkt-chart-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    direction: rtl;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.cmc-mkt-chart-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cmc-mkt-chart-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.cmc-mkt-chart-sub {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.4;
}

/* ── Period tabs ── */

.cmc-mkt-periods {
    display: flex;
    align-items: center;
    gap: 4px;
    direction: ltr;
    flex-wrap: wrap;
}

.cmc-mkt-period {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}

.cmc-mkt-period:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.cmc-mkt-period--active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

/* ── Canvas wrapper ── */

.cmc-mkt-chart-box {
    position: relative;
    height: 220px;
    margin-bottom: 12px;
}

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

/* ── Legend ── */

.cmc-mkt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: center;
    padding: 4px 0 2px;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}

.cmc-mkt-leg-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    direction: rtl;
}

.cmc-mkt-leg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cmc-mkt-leg-dot--gold      { background: #d97706; }
.cmc-mkt-leg-dot--platinum  { background: #7c3aed; }
.cmc-mkt-leg-dot--palladium { background: #a855f7; }
.cmc-mkt-leg-dot--silver    { background: #64748b; }
.cmc-mkt-leg-dot--copper    { background: #ea580c; }
.cmc-mkt-leg-dot--aluminium { background: #0d9488; }

.cmc-mkt-leg-name {
    font-size: 11.5px;
    color: #475569;
}

.cmc-mkt-leg-pct {
    font-size: 11.5px;
    font-weight: 700;
}

.cmc-mkt-leg-pct--pos { color: #16a34a; }
.cmc-mkt-leg-pct--neg { color: #dc2626; }

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

@media (max-width: 600px) {
    .cmc-mkt-grid {
        grid-template-columns: 1fr;
    }

    .cmc-mkt-cell:nth-child(odd) {
        border-left: none;
    }

    .cmc-mkt-cell:nth-last-child(-n+2) {
        border-bottom: 1px solid #f1f5f9;
    }

    .cmc-mkt-cell:last-child {
        border-bottom: none;
    }

    .cmc-mkt-price    { font-size: 16px; }
    .cmc-mkt-meta     { min-width: 85px; }
    .cmc-mkt-chart-box { height: 180px; }

    .cmc-mkt-chart-top {
        flex-direction: column;
        gap: 8px;
    }

    .cmc-mkt-periods {
        gap: 3px;
    }

    .cmc-mkt-period {
        padding: 3px 8px;
        font-size: 11px;
    }
}
