/**
 * CMC Currency Rates Widget [cmc_currencies]
 * Mirrors the erm-premium-* table style from the ERM Custom Widgets plugin.
 * These rules act as a fallback so the widget renders correctly even on pages
 * where no ERM shortcode (and therefore no erm_cw_table_styles() output) exists.
 */

/* ── ERM base (fallback) ─────────────────────────────────────── */
.erm-premium-table { width: 100%; border-collapse: separate; border-spacing: 0; font-family: inherit; font-size: 14px; background: #fff; overflow: hidden; border: 0.6px solid #C6C6CD; }
.erm-premium-table tr:nth-child(even) { background-color: #F8F8F8; }
.erm-premium-table thead th { background: #F0F3FF; color: #45464C; font-weight: 700; padding: 14px 18px; text-align: center; border-bottom: 1px solid #e2e8f0; border-left: none; border-right: none; border-top: none; }
.erm-premium-table th.col-right { text-align: right; }
.erm-premium-table td { padding: 14px 18px; text-align: center; border-bottom: 1px solid #e2e8f0; border-left: none; border-right: none; border-top: none; color: #334155; vertical-align: middle; }
.erm-premium-table tr:last-child td { border-bottom: none; }
.erm-premium-table td.col-right { text-align: right; font-weight: 600; color: #2563eb; font-size: 15px; }

.erm-premium-card { width: 100%; max-width: 100%; padding: 15px; border: 1px solid #cbd5e1; overflow: hidden; background: #fff; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.erm-premium-header { display: flex; justify-content: space-between; align-items: flex-start; flex-flow: column; margin-bottom: 16px; flex-wrap: wrap; gap: 5.6px; }
.erm-premium-title { margin: 0; font-size: 12px; font-weight: 800; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.erm-premium-updated { font-size: 10px; color: #64748b; display: flex; align-items: center; gap: 6px; font-weight: 500; }

.erm-premium-badge { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 4px; font-weight: 500; font-size: 13px; direction: ltr; line-height: 18px; }
.erm-premium-flag { width: 28px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); border: 1px solid rgba(0,0,0,0.05); }
.erm-premium-market-cell { display: flex; align-items: center; gap: 10px; }

.erm-text-red   { color: #93000A !important; }
.erm-text-green { color: #047857 !important; }
.erm-bg-red     { background-color: #FFDAD6; }
.erm-bg-green   { background-color: #ECFDF5; }
.erm-bg-transparent { background-color: transparent; }

/* ── Sidebar-compact modifier ────────────────────────────────── */
.erm-premium-card.erm-sidebar-table--compact { padding: 10px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-header { gap: 4px; margin-bottom: 10px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-title { font-size: 11px; gap: 5px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-title svg { width: 13px; height: 13px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-updated { font-size: 8px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-updated svg { width: 11px; height: 11px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-table,
.erm-premium-card.erm-sidebar-table--compact .erm-premium-table th,
.erm-premium-card.erm-sidebar-table--compact .erm-premium-table td,
.erm-premium-card.erm-sidebar-table--compact .erm-premium-table td.col-right,
.erm-premium-card.erm-sidebar-table--compact .erm-premium-badge { font-size: 10px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-table th,
.erm-premium-card.erm-sidebar-table--compact .erm-premium-table td { padding: 5px 7px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-market-cell { gap: 4px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-flag { width: 16px; border-radius: 2px; }
.erm-premium-card.erm-sidebar-table--compact .erm-premium-market-cell span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    display: inline-block;
}

/* ── Change value cell ───────────────────────────────────────── */
.cmc-curr-chg-val { font-weight: 600; direction: ltr; }

/* ── Error state ─────────────────────────────────────────────── */
.cmc-error {
    background: #FFDAD6;
    color: #93000A;
    border-radius: 2px;
    padding: 14px 18px;
    font-size: 13px;
    text-align: center;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 500px) {
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-table th,
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-table td,
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-table td.col-right,
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-badge { font-size: 9px; }
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-table th,
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-table td { padding: 4px 5px; }
    .erm-premium-card.erm-sidebar-table--compact .erm-premium-market-cell span { max-width: 65px; }
}
