/* ─────────────────────────────────────────────────────────────────────────────
   CMC Calendar Shortcodes — calendars.css
   Base table styles mirror erm-custom-widgets helpers.php (erm_cw_table_styles)
   so calendars render correctly even if the ERM plugin is not on the same page.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── ERM table base (fallback — ERM plugin outputs same styles via inline <style>) ── */
.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; }
.erm-premium-table th.col-right { text-align: right; }
.erm-premium-table td { padding: 14px 18px; text-align: center; border-bottom: 1px solid #e2e8f0; 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-text-red   { color: #93000A !important; }
.erm-text-green { color: #047857 !important; }
.erm-bg-red     { background-color: #FFDAD6; }
.erm-bg-green   { background-color: #ECFDF5; }
.erm-crypto-symbol { font-size: 12px; color: #94a3b8; font-weight: normal; margin-right: 6px; }

/* ── Calendar widget wrapper ── */
.cmc-cal-widget { width: 100%; }

.cmc-cal-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Title subtitle tag ── */
.cmc-cal-subtitle {
    font-size: 10px;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 2px;
}

/* ── Empty / error states ── */
.cmc-cal-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    padding: 30px 16px;
    margin: 0;
}

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

/* ── FMP setup notice (shown when no API key configured) ── */
.cmc-cal-setup-notice {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 2px;
    padding: 16px 20px;
    font-size: 13px;
    color: #78350f;
    line-height: 1.6;
}
.cmc-cal-setup-notice p { margin: 0 0 6px; }
.cmc-cal-setup-notice p:last-child { margin-bottom: 0; }
.cmc-cal-setup-notice a { color: #b45309; font-weight: 600; }

/* ── Futures type badges ── */
.cmc-cal-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.cmc-cal-badge--quarterly {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.cmc-cal-badge--monthly {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.cmc-cal-badge--bimonthly {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fde68a;
}

/* ── Past futures rows ── */
.cmc-cal-row-past td {
    opacity: 0.45;
}

/* ── Date filter bar ── */
.cmc-cal-filter-bar {
    padding: 12px 0 14px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
}

.cmc-cal-filter-buttons {
    display: flex !important;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* Force-reset theme button overrides */
.cmc-cal-filter-bar .cmc-cal-filter-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    padding: 5px 15px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    cursor: pointer !important;
    transition: border-color 0.15s, color 0.15s, background 0.15s !important;
    font-family: inherit !important;
    white-space: nowrap !important;
    line-height: 1.5 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    outline: none !important;
    margin: 0 !important;
}

.cmc-cal-filter-bar .cmc-cal-filter-btn:hover {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    background: #eff6ff !important;
}

.cmc-cal-filter-bar .cmc-cal-filter-btn.active {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
    font-weight: 600 !important;
}

.cmc-cal-custom-picker {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cmc-cal-custom-picker.is-open {
    display: flex !important;
    flex-direction: row !important;
}

.cmc-cal-custom-picker input[type="date"] {
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 5px 10px !important;
    font-size: 13px !important;
    color: #334155 !important;
    font-family: inherit !important;
    direction: ltr;
    box-shadow: none !important;
    outline: none !important;
    min-width: 130px;
}

.cmc-cal-custom-picker span {
    color: #94a3b8;
    font-size: 13px;
}

.cmc-cal-custom-picker .cmc-cal-custom-apply {
    background: #2563eb !important;
    color: #fff !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 5px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-family: inherit !important;
    box-shadow: none !important;
    white-space: nowrap !important;
}

.cmc-cal-filter-loading {
    min-height: 80px;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .erm-premium-table th,
    .erm-premium-table td { padding: 10px 10px; font-size: 12px; }
    .erm-premium-table td.col-right { font-size: 13px; }
    .cmc-cal-subtitle { display: none; }
}
