/* Report Charts: TRAK's own charts in place of a Power BI report, for any
   page with a manifest under config/reports/ (today the Operational Plan goal
   pages, operational_plan_goal.html). */

.report-charts {
    background: #fff;
    border: 1px solid #d3dde9;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(8, 44, 77, 0.08);
    padding: 12px 16px 16px;
}

/* One row of equal tabs; the template sets --tab-count. */
.report-charts__tabs {
    display: grid;
    grid-template-columns: repeat(var(--tab-count, 3), minmax(0, 1fr));
    gap: 12px;
    max-width: calc(var(--tab-count, 3) * 213px);
    margin-bottom: 12px;
}

.report-charts__tabs [role="tab"] {
    font: inherit;
    font-size: 0.875rem;
    color: #0b3b66;
    background: #fff;
    border: 1px solid #0b3b66;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

.report-charts__tabs [role="tab"]:hover {
    background: #eef3f9;
}

.report-charts__tabs [role="tab"][aria-selected="true"] {
    color: #fff;
    background: #0b3b66;
    font-weight: 600;
}

.report-charts__tabs [role="tab"]:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 2px;
}

.report-charts__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.report-charts__filters[hidden] {
    display: none;
}

.report-charts__filter {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8125rem;
    color: #0b3b66;
    min-width: 160px;
}

.report-charts__filter select {
    font: inherit;
    color: #1c2735;
    background: #fff;
    border: 1px solid #b9c6d6;
    border-radius: 4px;
    padding: 4px 6px;
}

.report-charts__filter select:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 1px;
}

.report-charts__panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 24px;
}

.report-charts__panel[hidden] {
    display: none;
}

/* A text tab (FAQ) is at least as tall as a row of charts, so switching to
   it doesn't move what is below the report. */
.report-charts__panel--text {
    display: block;
    min-height: var(--report-chart-height);
}

/* Every chart and table is the same height (--report-chart-height: canvas
   plus its footer), so tabs with one row of charts or a table are all as
   tall as each other: switching tabs or filters doesn't move what is below
   the report. A table scrolls inside that height. */
.report-charts {
    --report-chart-height: 400px;
}

.report-chart {
    position: relative;
    margin: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: var(--report-chart-height);
}

/* Camera: top-right of each chart; saves it as a PNG. */
.report-chart__camera {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #b9c6d6;
    border-radius: 4px;
    background: #fff;
    color: #0b3b66;
    font-size: 0.875rem;
    cursor: pointer;
    opacity: 0.75;
}

.report-chart__camera:hover,
.report-chart__camera:focus-visible {
    opacity: 1;
    background: #eef3f8;
}

.report-chart__camera:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 1px;
}

.report-chart__camera:disabled {
    cursor: progress;
}

.report-chart__canvas {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.report-chart--hbar {
    height: calc(var(--report-chart-height) + 40px);
}

.report-chart--table,
.report-chart:only-of-type {
    grid-column: 1 / -1;
}

/* Table pop-out button: top-right of each table, like a chart's camera. */
.report-chart__expand {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #b9c6d6;
    border-radius: 4px;
    background: #fff;
    color: #0b3b66;
    font-size: 0.875rem;
    cursor: pointer;
    opacity: 0.75;
}

.report-chart__expand:hover,
.report-chart__expand:focus-visible {
    opacity: 1;
    background: #eef3f8;
}

.report-chart__expand:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 1px;
}

/* The pop-out: a modal dialog almost the size of the window. */
.report-table-popout {
    width: 96vw;
    max-width: 96vw;
    height: 92vh;
    max-height: 92vh;
    padding: 12px 20px 8px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    flex-direction: column;
}

.report-table-popout[open] {
    display: flex;
}

.report-table-popout::backdrop {
    background: rgba(11, 26, 43, 0.55);
}

.report-table-popout__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.report-table-popout__filters {
    margin: 0;
    font-size: 0.875rem;
    color: #5b6878;
}

.report-table-popout__close {
    border: 1px solid #0b3b66;
    border-radius: 4px;
    background: #0b3b66;
    color: #fff;
    font-weight: 600;
    padding: 5px 16px;
    cursor: pointer;
}

.report-table-popout__close:hover {
    background: #0e4d85;
}

.report-table-popout__close:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 2px;
}

/* The table fills the dialog and scrolls inside it. */
.report-table-popout .report-table-popout__figure {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    margin: 0;
}

/* Map (Google Maps): taller than a chart, so all of Kentucky is readable;
   the map fills the figure above its legend. */
.report-chart--map {
    height: calc(var(--report-chart-height) + 220px);
}

.report-chart--map .report-map {
    border: 1px solid #d4dce6;
    border-radius: 4px;
}

.report-map--failed {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5b6878;
    background: #f5f7fa;
    font-size: 0.875rem;
}

.report-map__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.45);
    opacity: 0.9;
    cursor: pointer;
}

.report-map__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    font-size: 0.8125rem;
    color: #1c2735;
}

.report-map__legend li {
    display: flex;
    align-items: center;
    gap: 5px;
}

.report-map__swatch {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.report-map__info dl {
    display: grid;
    grid-template-columns: auto auto;
    gap: 2px 10px;
    margin: 0;
    font-size: 0.8125rem;
}

.report-map__info dt {
    font-weight: 600;
    color: #0b3b66;
}

.report-map__info dd {
    margin: 0;
}

/* Under each chart and table: its note, or a table's row count. */
.report-chart__footer {
    min-height: 28px;
    padding-top: 4px;
}

.report-chart__footer .report-chart__note {
    margin: 0;
}

/* Under the report: CSV and Excel links, one pair per data set. */
.report-charts__downloads {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 20px;
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid #e3e9f0;
    font-size: 0.8125rem;
    color: #5b6878;
}

.report-charts__downloads[hidden] {
    display: none;
}

.report-charts__download-title {
    font-weight: 600;
    color: #0b3b66;
    margin-right: auto;
}

.report-charts__downloads a {
    color: #0b3b66;
    font-weight: 600;
    margin-left: 8px;
}

.report-charts__downloads a:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 2px;
}

.report-table__title {
    margin: 4px 0 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #0b3b66;
}

.report-table__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid #d3dde9;
    border-radius: 6px;
}

.report-table__scroll:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: 2px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: #1c2735;
}

.report-table th,
.report-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #e6ecf2;
    text-align: left;
    white-space: nowrap;
}

.report-table tbody th {
    font-weight: 400;
}

.report-table tbody tr:nth-child(even) {
    background: #f6f9fc;
}

.report-table .is-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.report-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0;
    background: #0b3b66;
}

.report-table__sort {
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    font-weight: 600;
    text-align: inherit;
    color: #fff;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.report-table__sort:hover {
    background: #082c4d;
}

.report-table__sort:focus-visible {
    outline: 3px solid #f5b800;
    outline-offset: -3px;
}

.report-table th[aria-sort="ascending"] .report-table__sort::after {
    content: " \25B2";
}

.report-table th[aria-sort="descending"] .report-table__sort::after {
    content: " \25BC";
}

.report-chart__note,
.report-charts__as-of {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    font-style: italic;
    color: #5b6878;
}

.report-charts__as-of {
    grid-column: 1 / -1;
}

.report-charts__status {
    margin: 0 0 12px;
    color: #5b6878;
}

.report-charts__status[hidden] {
    display: none;
}

.report-charts__status--error {
    color: #8a1c1c;
}

.report-faq dt {
    margin-top: 12px;
    font-weight: 700;
    color: #0b3b66;
}

.report-faq dd {
    margin: 4px 0 0;
}

@media (max-width: 767.98px) {
    .report-charts__panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-charts__tabs {
        gap: 6px;
    }
}

/* Printing shows every view, one after another (reportCharts.js adds
   report-charts--printing before the print dialog opens). */
/* !important because Bootstrap's [hidden] rule is display: none !important. */
.report-charts--printing .report-charts__panel[hidden] {
    display: grid !important;
}

.report-charts--printing .report-charts__panel--text[hidden] {
    display: block !important;
}

.report-charts--printing .report-chart--table {
    height: auto;
}

@media print {
    .report-charts {
        box-shadow: none;
        border: 0;
        padding: 0;
    }

    .report-charts__tabs {
        display: none;
    }

    .report-charts__panel {
        break-inside: avoid;
        margin-bottom: 16px;
    }

    .report-table__scroll {
        overflow: visible;
    }

    .report-charts__downloads,
    .report-chart__camera,
    .report-chart__expand {
        display: none;
    }

    .report-table thead th {
        position: static;
    }
}