/* ============================================================
   Macro Fix — Keep Indicator Search Dropdown Visible
============================================================ */

.public-dashboard-page.macro-dashboard-page .filter-bar-card,
.public-dashboard-page.macro-dashboard-page .filter-bar-card.dashboard-card,
.public-dashboard-page.macro-dashboard-page .filter-bar-card .filters-grid,
.public-dashboard-page.macro-dashboard-page .filter-bar-card .filter-box {
    overflow: visible !important;
}

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-bar-card {
    overflow: visible !important;
}

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-bar-card::after {
    content: none !important;
    display: none !important;
}

.macro-indicator-chart-card--wide {
    grid-column: 1 / -1;
}
/* ============================================================
   MACRO — FILTER TO KPI SPACING FIX
   Prevent shared dashboard-card margins from creating
   excessive empty space below the filter bar.
============================================================ */

.public-dashboard-page.macro-dashboard-page
.filter-bar-card,
.public-dashboard-page.macro-dashboard-page
.filter-bar-card.dashboard-card {
    margin-bottom: 12px !important;
}

.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid > .kpi-card,
.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid > .dashboard-card {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}


/* ============================================================
   MACRO — FILTER BAR POSITION FIX
   Keep filter fully below tabs and prevent KPI overlap
============================================================ */

.public-dashboard-page.macro-dashboard-page
.filter-bar-card,
.public-dashboard-page.macro-dashboard-page
.filter-bar-card.dashboard-card {

    /* Do not visually lift the filter out of normal flow */
    transform: none !important;

    /* Keep a clean gap below the top navigation */
    margin-top: 8px !important;

    /* Compact but safe spacing before KPI cards */
    margin-bottom: 14px !important;

    /* Sticky position must sit below dashboard tabs */
    top: calc(var(--public-tabs-height) + 8px) !important;

    overflow: visible !important;
}


/* Keep filter labels fully visible */
.public-dashboard-page.macro-dashboard-page
.filter-bar-card .filter-box label {
    position: relative !important;
    z-index: 2 !important;
    margin-top: 0 !important;
}


/* KPI cards must stay below the filter */
.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid {
    position: relative !important;
    z-index: 1 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}


/* ============================================================
   MACRO LIGHT MODE — FILTER / KPI OVERLAP FIX
   Dark mode intentionally unchanged
============================================================ */

[data-theme="light"]
.public-dashboard-page.macro-dashboard-page
.filter-bar-card,

[data-theme="light"]
.public-dashboard-page.macro-dashboard-page
.filter-bar-card.dashboard-card {

    /* Keep the filter in normal document flow in light mode */
    position: relative !important;
    top: auto !important;
    transform: none !important;

    margin-top: 8px !important;
    margin-bottom: 16px !important;

    z-index: 20 !important;
}


/* Do not allow the filter background layer to extend over KPIs */
[data-theme="light"]
.public-dashboard-page.macro-dashboard-page
.filter-bar-card::before {
    top: 0 !important;
    bottom: 0 !important;
}


/* KPI section must begin cleanly after the filter */
[data-theme="light"]
.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid {
    position: relative !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    clear: both !important;
    z-index: 1 !important;
}


[data-theme="light"]
.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid > .kpi-card {
    margin-top: 0 !important;
}



/* ============================================================
   MACRO LIGHT MODE — MATCH DEBT LIGHT MODE
   Make Macro light mode behave like Debt light mode
   Dark mode remains unchanged
============================================================ */

[data-theme="light"] .public-dashboard-page.macro-dashboard-page,
[data-theme="light"] .macro-dashboard-page {
    background:
        linear-gradient(135deg, #f5f7fb 0%, #edf2f7 48%, #f8fafc 100%) !important;
    color: #0f2747 !important;
}

/* Light cards */
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .dashboard-card,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .kpi-card,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-indicator-chart-card,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .sidebar-card,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .collapsible-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96)) !important;
    border: 1px solid rgba(15, 39, 71, 0.10) !important;
    color: #0f2747 !important;
    box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.05),
        0 18px 42px rgba(15, 23, 42, 0.07) !important;
}

/* ============================================================
   FILTER BAR — behave like Debt light mode
============================================================ */

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-bar-card,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-bar-card.dashboard-card {
    position: relative !important;
    top: auto !important;
    transform: none !important;

    margin-top: 0 !important;
    margin-bottom: 22px !important;

    padding-top: 12px !important;
    padding-bottom: 12px !important;

    z-index: 1 !important;
    overflow: visible !important;
}

/* Remove extra pseudo-layer that can visually interfere */
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-bar-card::before,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-bar-card::after {
    content: none !important;
    display: none !important;
}

/* ============================================================
   KPI GRID — same clean start as Debt
============================================================ */

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-kpi-grid,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .kpi-grid.macro-kpi-grid {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 22px !important;
    position: relative !important;
    z-index: 1 !important;
}

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-kpi-grid > .kpi-card,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-kpi-grid > .dashboard-card {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    min-height: 132px !important;
}

/* Macro chart block starts cleanly after KPIs */
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-multi-chart-card {
    margin-top: 0 !important;
}

/* ============================================================
   LIGHT MODE TEXT
============================================================ */

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-box label,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .kpi-label,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .kpi-meta,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .chart-card-header p,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .download-meta,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .collapsible-subtitle,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-indicator-group-header span {
    color: #4f6690 !important;
}

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .kpi-value,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-indicator-chart-header h5,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .macro-indicator-group-header h4,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page h1,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page h2,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page h3,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page h4,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page h5,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page h6 {
    color: #0f2747 !important;
}

/* Inputs like Debt light mode */
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-box select,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-box input {
    background: #ffffff !important;
    color: #0f2747 !important;
    border: 1px solid rgba(15, 39, 71, 0.14) !important;
}

[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-box select:focus,
[data-theme="light"] .public-dashboard-page.macro-dashboard-page .filter-box input:focus {
    border-color: rgba(0, 199, 199, 0.42) !important;
    box-shadow: 0 0 0 3px rgba(0, 199, 199, 0.10) !important;
}


/* ============================================================
   CPI KPI Unit
============================================================ */

.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid
.kpi-unit--index {
    font-size: 0.42em;
    font-weight: 600;
    margin-left: 0.35rem;
    vertical-align: baseline;
    opacity: 0.75;
}


/* ============================================================
   CPI Percentage Change — Filter Alignment
============================================================ */

@media (min-width: 1100px) {
    .public-dashboard-page.macro-dashboard-page
    .macro-filter-form--cpi-change {
        display: grid !important;

        grid-template-columns:
            1.30fr   /* Dataset / Sheet */
            1.45fr   /* Indicator */
            0.80fr   /* View Frequency */
            0.62fr   /* Start Year */
            0.62fr   /* End Year */
            0.35fr   /* Apply / Reset */
            !important;

        width: 100% !important;
        column-gap: 12px !important;
        align-items: end !important;
    }

    .public-dashboard-page.macro-dashboard-page
    .macro-filter-form--cpi-change
    .filter-actions-box {
        grid-column: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        justify-self: stretch !important;
    }
}

/* ============================================================
   Trade Exports and Imports — Filter Alignment
============================================================ */

@media (min-width: 1100px) {
    .public-dashboard-page.macro-dashboard-page
    .macro-filter-form--trade {
        display: grid !important;

        grid-template-columns:
            1.30fr
            1.45fr
            0.80fr
            0.62fr
            0.62fr
            0.35fr
            !important;

        width: 100% !important;
        column-gap: 12px !important;
        align-items: end !important;
    }

    .public-dashboard-page.macro-dashboard-page
    .macro-filter-form--trade
    .filter-actions-box {
        grid-column: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        justify-self: stretch !important;
    }
}

/* ============================================================
   Monetary Sector — Filter Alignment
============================================================ */

@media (min-width: 1100px) {
    .public-dashboard-page.macro-dashboard-page
    .macro-filter-form--monetary {
        display: grid !important;

        grid-template-columns:
            1.30fr
            1.45fr
            0.80fr
            0.62fr
            0.62fr
            0.35fr
            !important;

        width: 100% !important;
        column-gap: 12px !important;
        align-items: end !important;
    }

    .public-dashboard-page.macro-dashboard-page
    .macro-filter-form--monetary
    .filter-actions-box {
        grid-column: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        justify-self: stretch !important;
    }
}


/* ============================================================
   MACRO DARK MODE — FILTER BAR ALIGNMENT
   Match the vertical position used in light mode.
============================================================ */

:root:not([data-theme="light"])
.public-dashboard-page.macro-dashboard-page
.filter-bar-card,

:root:not([data-theme="light"])
.public-dashboard-page.macro-dashboard-page
.filter-bar-card.dashboard-card {
    position: relative !important;
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
}


/* ============================================================
   MACRO — FULL-WIDTH CHART ZOOM SAFETY
   Full-width cards must not scale outside the dashboard grid.
============================================================ */

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide:hover,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide:focus-within,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide.is-chart-zoomed {
    transform: translateZ(0) scale(1) !important;
}


/* ============================================================
   MACRO — TABLE PREVIEW STICKY HEADER FIX
   Keep scrolling table values underneath the header.
============================================================ */

.public-dashboard-page.macro-dashboard-page
.macro-indicator-mini-table table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.public-dashboard-page.macro-dashboard-page
.macro-indicator-mini-table th {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
}

.public-dashboard-page.macro-dashboard-page
.macro-indicator-mini-table td {
    position: relative;
    z-index: 0;
}

:root:not([data-theme="light"])
.public-dashboard-page.macro-dashboard-page
.macro-indicator-mini-table th {
    background: #061a36 !important;
}


/* ============================================================
   MACRO — TABLE PREVIEW SCROLL GAP FIX
   Keep sticky header flush with the top of the scroll viewport.
============================================================ */

.public-dashboard-page.macro-dashboard-page
.macro-indicator-mini-table {
    padding-top: 0 !important;
}

/* ============================================================
   MACRO CARD ZOOM — MATCH FINAL DEBT BEHAVIOUR

   Small/two-column cards:
   - subtle 1.035 scale
   - modest +30px vertical chart expansion

   Wide/full-width cards:
   - no sideways scaling
   - retain Macro 320px -> 390px vertical expansion
============================================================ */


/* ------------------------------------------------------------
   SMALL / TWO-COLUMN CARDS
------------------------------------------------------------ */

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card:not(.macro-indicator-chart-card--wide):hover,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card:not(.macro-indicator-chart-card--wide):focus-within,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card:not(.macro-indicator-chart-card--wide).is-chart-zoomed {
    z-index: 8;

    transform:
        translateZ(0)
        scale(1.035) !important;
}


.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card:not(.macro-indicator-chart-card--wide):hover
.macro-indicator-chart-wrap,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card:not(.macro-indicator-chart-card--wide):focus-within
.macro-indicator-chart-wrap,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card:not(.macro-indicator-chart-card--wide).is-chart-zoomed
.macro-indicator-chart-wrap {
    height: 350px !important;
    min-height: 350px !important;
}


/* ------------------------------------------------------------
   WIDE / FULL-WIDTH CARDS
------------------------------------------------------------ */

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide:hover,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide:focus-within,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide.is-chart-zoomed {
    z-index: 80;

    transform:
        translateZ(0)
        scale(1) !important;
}


.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide:hover
.macro-indicator-chart-wrap,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide:focus-within
.macro-indicator-chart-wrap,

.public-dashboard-page.macro-dashboard-page
.macro-indicator-chart-card--wide.is-chart-zoomed
.macro-indicator-chart-wrap {
    height: 390px !important;
    min-height: 390px !important;
}


/* ------------------------------------------------------------
   RESPONSIVE
------------------------------------------------------------ */

@media (max-width: 900px) {

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:hover,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:focus-within,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card.is-chart-zoomed {
        transform: none !important;
    }


    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:not(.macro-indicator-chart-card--wide):hover
    .macro-indicator-chart-wrap,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:not(.macro-indicator-chart-card--wide):focus-within
    .macro-indicator-chart-wrap,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:not(.macro-indicator-chart-card--wide).is-chart-zoomed
    .macro-indicator-chart-wrap {
        height: 350px !important;
        min-height: 350px !important;
    }


    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card--wide:hover
    .macro-indicator-chart-wrap,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card--wide:focus-within
    .macro-indicator-chart-wrap,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card--wide.is-chart-zoomed
    .macro-indicator-chart-wrap {
        height: 340px !important;
        min-height: 340px !important;
    }
}


@media (max-width: 720px) {

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:hover
    .macro-indicator-chart-wrap,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card:focus-within
    .macro-indicator-chart-wrap,

    .public-dashboard-page.macro-dashboard-page
    .macro-indicator-chart-card.is-chart-zoomed
    .macro-indicator-chart-wrap {
        height: 300px !important;
        min-height: 300px !important;
    }
}


/* ============================================================
   MACRO TABS — ALIGN WITH DEBT
   Do not allow Macro filter overrides to move tabs
============================================================ */

.public-dashboard-page.macro-dashboard-page
.dashboard-sticky-controls {

    top: var(--public-header-height) !important;

}


.public-dashboard-page.macro-dashboard-page
.top-dashboard-tabs {

    position: relative !important;

    top: 0 !important;

    margin-top: 0 !important;

    transform: none !important;

}


/* ============================================================
   MACRO — MAJOR SECTION SPACING
============================================================ */


.public-dashboard-page.macro-dashboard-page
#indicator-guide-section,
.public-dashboard-page.macro-dashboard-page
#faq-section,
.public-dashboard-page.macro-dashboard-page
#downloads-section {
    margin-top: 20px !important;
}

/* ============================================================
   MACRO — SPACE AFTER FAQ
============================================================ */

.public-dashboard-page.macro-dashboard-page
#faq-section {
    margin-bottom: 20px !important;
}


/* ============================================================
   MACRO — LIGHT / DARK LAYOUT PARITY
   Keep structural spacing identical in both themes
============================================================ */

.public-dashboard-page.macro-dashboard-page
.macro-kpi-grid,

.public-dashboard-page.macro-dashboard-page
.kpi-grid.macro-kpi-grid {
    margin-top: 22px !important;
    padding-top: 0 !important;

    /* Same KPI -> chart gap as current light mode */
    margin-bottom: 22px !important;
}


/* Chart container starts normally after KPI spacing */
.public-dashboard-page.macro-dashboard-page
.macro-multi-chart-card {
    margin-top: 0 !important;
}
