/* ============================================================
   GRAPHICS PANEL (orchestrator) + sub-zones
   ============================================================ */

.graphics-panel {
    flex: 1 1 40%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--color-surface);
    overflow-y: auto;
}

.graphics-panel > * {
    flex-shrink: 0;
}

@media (max-width: 991.98px) {
    .graphics-panel {
        flex: 1 1 auto;
        min-height: 40vh;
    }
}

/* ----- Region header ----- */

.region-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.region-header__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.action-btn {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid #1D584B;   /* feedback #4: default stroke #1D584B */
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.action-btn:hover,
.action-btn:focus-visible {
    border-color: var(--color-primary);
    outline: none;
}

.region-header__info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.region-header__location {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.region-header__season {
    font-size: 1.75rem;
}

.region-header__subtitle {
    font-size: 0.8125rem;
    color: black;
}

.region-header__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.region-header__stats {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.stat-card {
    min-width: 96px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid #FAB45B;   /* feedback #3: default stroke #FAB45B */
    border-radius: 8px;
    background: var(--color-surface);
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

/* feedback #3: the card whose variable is currently selected -> yellow fill */
.stat-card.is-active {
    background: var(--color-primary);   /* feedback #3: season-aware (orange summer / blue winter) */
    border-color: var(--color-primary);
}

.stat-card__label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.2;
}

.stat-card__value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    margin-top: var(--space-xs);
}

/* ----- Chart toggle (age groups) ----- */

.chart-toggle {
    display: flex;
    margin: 0 auto;
    border-radius: 6px;
    gap: var(--space-xs);
    padding: var(--space-xs);
    overflow-x: auto;
    justify-content: center;   /* feedback #5: centred, aligned with the title */
    border: 1px solid var(--color-modal-stroke);   /* feedback #5: subtle border like the prototype */
    width: fit-content;
}

.chart-toggle__item {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    border: 1px solid #dddddd;
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}   

.chart-toggle__item:hover,
.chart-toggle__item:focus-visible {
    border-color: var(--color-primary);
    outline: none;
}

.chart-toggle__item--active {
    background: var(--color-primary);
    /*border-color: var(--color-primary);*/
    color: #000000;   /* feedback #5: black font when selected */
}

/* ----- Chart area (container for chart blocks) ----- */

.chart-area {
    /* Container only — chart-blocks handle their own padding */
}

/* ----- Chart blocks (main chart + compound risk chart) ----- */

.chart-block {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.chart-block[hidden] {
    display: none;
}

.chart-block__title {
    margin: 0 0 var(--space-sm) 0;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

.chart-block__canvas-wrap {
    position: relative;
    height: 240px;
}

.chart-block__canvas-wrap > canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-block__legend {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.chart-block__legend:empty {
    display: none;
}

/* ----- Legend items (shared by chart-block__legend) ----- */

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.legend-item__swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

/* ----- Recommendations ----- */

.recommendations {
    padding: var(--space-md);
}

.recommendations[hidden] {
    display: none;
}

.recommendations__header {
    text-align: center;
    margin-bottom: var(--space-md);
}

.recommendations__title {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.recommendations__subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm) 0;
}

.recommendations__lead {
    font-size: 0.875rem;
    margin: 0;
}

@media (max-width: 991.98px) {

    .region-header__season {
        display: none !important;
    }

    .region-header-wrapper {
        background: var(--color-primary);   /* stripe color */
        padding-left: 20px;                  /* only left shows */
        border-radius: 8px;
    }

    .region-header.mobile-only .region-header__inner {
        background: #fff;
        border-radius: 0 8px 8px 0;
        padding: var(--space-sm) var(--space-md);
    }

    .region-header__info{
        background-color: #fff;
        padding-left: 5px;
    }

    .map-panel__time-controls {
        background-color: #fff !important;
    }

}
/* ===== Next 7 days table (feedback #6) ===== */
.next7 {
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
    min-width: 0;      /* flex child: allow shrinking so inner scroll works */
    max-width: 100%;
    overflow: hidden;  /* clip the section; the inner .next7__scroll scrolls */
}

.next7__title {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 var(--space-md);
}

/* Horizontal scroll for the wide table (feedback: table overflows on phones).
   The accordion-body doesn't scroll on its own, so this wrapper does. */
.next7__scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;   /* momentum scroll on iOS */
}

.next7__table {
    width: 100%;
    min-width: 640px;   /* forces horizontal scroll when narrower than this */
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-top: var(--space-sm);
}

.next7__table th,
.next7__table td {
    padding: 4px 6px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.next7__table thead th {
    font-weight: 700;
    border-bottom: 2px solid var(--color-text);
    vertical-align: bottom;
}

.next7__table tbody td:first-child,
.next7__table thead th:first-child { text-align: left; font-weight: 600; }

.next7__unit { font-weight: 400; font-size: 0.72rem; color: var(--color-text-muted, #666); }

.next7__empty { text-align: center; color: #888; padding: var(--space-md); }

/* ===== Back to top (feedback #7) ===== */
.back-to-top {
    position: sticky;
    bottom: var(--space-md);
    margin-left: auto;
    margin-right: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-primary);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}
.back-to-top[hidden] { display: none; }

/* feedback: force a chevron icon on the Next 7 days accordion (up/down) */
#next7Accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23212529' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    transform: rotate(0deg);
}
#next7Accordion .accordion-button:not(.collapsed)::after {
    transform: rotate(180deg);
}