/* ==========================================================================
   GHGIA Data Dashboard Styles
   Scoped strictly under .dashboard-section / #dashboard-container
   ========================================================================== */

.dashboard-section {
    background-color: #F8FAFC;
    padding: 0 0 80px;
    min-height: 800px;
}

/* Aligned strictly from logo start to search bar end in header */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

@media (max-width: 1448px) {
    .dashboard-container {
        padding: 0 48px; /* Exactly matches 24px margin + 24px padding of .site-header */
    }
}

@media (max-width: 900px) {
    .dashboard-container {
        padding: 0 24px;
    }
}

/* Top Centered Title */
.dashboard-title-wrapper {
    text-align: center;
    padding: 32px 0 24px;
}

.dashboard-main-title {
    font-size: 52px;
    font-weight: 800;
    color: #1A365D;
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.6px;
}

@media (max-width: 992px) {
    .dashboard-main-title {
        font-size: 38px;
    }
}

@media (max-width: 768px) {
    .dashboard-main-title {
        font-size: 28px;
    }
    .dashboard-title-wrapper {
        padding: 24px 0 18px;
    }
}

/* 1. TOP MAP SECTION - No background card, no shadow, increased height */
.dashboard-map-section {
    margin-bottom: 32px;
    width: 100%;
}

/* Dynamic Map Subtitle */
.map-subtitle-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 16px 0;
    width: 100%;
}

.map-dynamic-subtitle {
    font-size: 18px;
    font-weight: 700;
    color: #0F172A;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    letter-spacing: -0.2px;
    text-align: center;
    margin: 0;
    font-family: var(--font-main, 'Open Sans', sans-serif);
}

@media (max-width: 768px) {
    .map-dynamic-subtitle {
        font-size: 15px;
        padding: 0 !important;
    }
}

.dashboard-map-section .map-wrapper {
    position: relative;
    width: 100%;
    height: 760px;
    background-color: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

/* Card Container System (for Filters and Table below) */
.dashboard-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    margin-bottom: 28px;
    overflow: hidden;
}

.dashboard-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: #FFFFFF;
}

.dashboard-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1A365D;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card-title i {
    color: var(--primary-blue, #3185C6);
    font-size: 18px;
}

.dashboard-card-subtitle {
    font-size: 13px;
    color: #64748B;
    margin-top: 3px;
}

#mapViewDiv {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    background-color: #F8FAFC;
}

/* Floating Hover Information Card */
#map-hover-card {
    position: absolute;
    z-index: 40;
    pointer-events: none;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    padding: 10px 14px;
    font-family: var(--font-main, 'Open Sans', sans-serif);
    transition: opacity 0.15s ease-out;
    opacity: 0;
    visibility: hidden;
    white-space: nowrap;
    min-width: 140px;
}

#map-hover-card.visible {
    opacity: 1;
    visibility: visible;
}

#map-hover-card .hover-card-state-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #E2E8F0;
    line-height: 1.2;
}

#map-hover-card .hover-card-state-full {
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
}

#map-hover-card .hover-card-state-abbr {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #0284C7;
    background: #E0F2FE;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

#map-hover-card .hover-card-metric-label,
#map-hover-card .hover-card-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748B;
    margin-bottom: 2px;
}

#map-hover-card .hover-card-value {
    font-size: 15px;
    color: #0F172A;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

#map-hover-card .hover-card-value strong {
    font-size: 16px;
    font-weight: 700;
    color: #1A365D;
}

#map-hover-card .hover-card-unit {
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
}

/* =========================================================================
   HORIZONTAL GRADIENT LEGEND (BELOW MAP)
   ========================================================================= */
.map-horizontal-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin: 14px auto 0;
    padding: 4px 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: fit-content;
    max-width: 95%;
    box-sizing: border-box;
}

.legend-bar-container {
    display: flex;
    flex-direction: column;
    width: 380px;
}

.legend-bar-track {
    display: flex;
    width: 100%;
    height: 18px;
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid #475569;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.legend-bar-segment {
    flex: 1;
    height: 100%;
    position: relative;
}

.legend-bar-segment:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: #FFFFFF;
    z-index: 2;
}

.legend-bar-segment.seg-0 {
    background: linear-gradient(to right, #D7E8F8, #A8D0F0);
}

.legend-bar-segment.seg-1 {
    background: linear-gradient(to right, #A8D0F0, #64A8E1);
}

.legend-bar-segment.seg-2 {
    background: linear-gradient(to right, #64A8E1, #3080CD);
}

.legend-bar-segment.seg-3 {
    background: linear-gradient(to right, #3080CD, #145AAF);
}

.legend-bar-ticks {
    display: flex;
    width: 100%;
    margin-top: 6px;
    position: relative;
    height: 16px;
}

.legend-bar-ticks .tick-label {
    font-size: 12px;
    font-weight: 700;
    color: #1E293B;
    font-family: var(--font-main, 'Open Sans', sans-serif);
    line-height: 1;
}

.legend-bar-ticks .tick-0 {
    position: absolute;
    left: 0;
    text-align: left;
}

.legend-bar-ticks .tick-1 {
    position: absolute;
    left: 25%;
    transform: translateX(-50%);
    text-align: center;
}

.legend-bar-ticks .tick-2 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.legend-bar-ticks .tick-3 {
    position: absolute;
    left: 75%;
    transform: translateX(-50%);
    text-align: center;
}

.legend-bar-ticks .tick-4 {
    position: absolute;
    right: 0;
    text-align: right;
}

.legend-unit-text {
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    font-family: var(--font-main, 'Open Sans', sans-serif);
    white-space: nowrap;
}

.legend-nodata-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    font-family: var(--font-main, 'Open Sans', sans-serif);
    white-space: nowrap;
}

.nodata-swatch {
    width: 18px;
    height: 18px;
    background: #FFFFFF;
    border: 1.5px solid #475569;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .map-horizontal-legend {
        flex-direction: column;
        border-radius: 16px;
        gap: 12px;
        padding: 12px 16px;
        width: 100%;
    }
    .legend-bar-container {
        width: 100%;
        max-width: 320px;
    }
    .legend-nodata-box {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #E2E8F0;
        padding-top: 8px;
    }
}

/* Hide top-left expand button on map in favor of horizontal legend below map */
.esri-ui-top-left .esri-expand {
    display: none !important;
}

/* Official ArcGIS Legend Widget (Styled without title, compact snug fit) */
.esri-ui-top-left .esri-expand__panel,
.esri-expand__panel {
    width: auto !important;
    min-width: 0 !important;
    max-width: fit-content !important;
}

.esri-legend,
.esri-ui-top-left .esri-legend {
    width: auto !important;
    min-width: 0 !important;
    max-width: fit-content !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(6px);
    border: 1px solid #CBD5E1 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    padding: 10px 14px 10px 10px !important;
    font-family: var(--font-main, 'Open Sans', sans-serif) !important;
    overflow: hidden;
}

/* Hide legend title completely as requested */
.esri-legend .esri-legend__layer-caption,
.esri-legend .esri-legend__title,
.esri-legend .esri-legend__layer-cell--heading,
.esri-legend .esri-widget__heading {
    display: none !important;
}

.esri-legend__service,
.esri-legend__service-label,
.esri-legend__layer,
.esri-legend__layer-table,
.esri-legend__layer-body,
.esri-legend__layer-row {
    width: auto !important;
    min-width: 0 !important;
    max-width: fit-content !important;
}

.esri-legend .esri-legend__layer-cell--info {
    display: inline-block !important;
    width: auto !important;
    min-width: 0 !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    padding-left: 6px !important;
    padding-right: 2px !important;
    white-space: nowrap !important;
}

.esri-legend .esri-legend__layer-cell--symbol {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
}

.esri-legend .esri-legend__layer-row {
    margin-bottom: 3px !important;
}

.esri-legend .esri-legend__ramp-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #475569 !important;
}

.esri-legend__service {
    padding: 0 !important;
}

.esri-legend__layer-table {
    margin-bottom: 0 !important;
}

/* =========================================================================
   LEGEND EXPAND BUTTON (Top-Left) - Modern Minimalist Design
   ========================================================================= */
.esri-ui-top-left .esri-expand,
.esri-expand {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    --calcite-color-brand: transparent !important;
    --calcite-color-brand-hover: transparent !important;
    --calcite-color-brand-press: transparent !important;
    --calcite-ui-brand: transparent !important;
    --calcite-color-focus: transparent !important;
}

.esri-ui-top-left .esri-expand *,
.esri-expand * {
    outline: none !important;
}

/* Container */
.esri-ui-top-left .esri-expand .esri-expand__container,
.esri-expand .esri-expand__container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 8px !important;
}

/* The Button itself */
.esri-ui-top-left .esri-expand .esri-widget--button,
.esri-ui-top-left .esri-expand .esri-expand__button,
.esri-expand .esri-widget--button,
.esri-expand .esri-expand__button {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
    color: #475569 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    overflow: hidden !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Hover State */
.esri-ui-top-left .esri-expand .esri-widget--button:hover,
.esri-ui-top-left .esri-expand .esri-expand__button:hover,
.esri-expand .esri-widget--button:hover,
.esri-expand .esri-expand__button:hover {
    background: #F8FAFC !important;
    background-color: #F8FAFC !important;
    color: #0F172A !important;
    border-color: #94A3B8 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12) !important;
    transform: translateY(-1px);
}

/* Focus & Focus-Visible States (Kill browser and calcite blue rings completely) */
.esri-ui-top-left .esri-expand .esri-widget--button:focus,
.esri-ui-top-left .esri-expand .esri-widget--button:focus-visible,
.esri-ui-top-left .esri-expand .esri-widget--button:focus-within,
.esri-ui-top-left .esri-expand .esri-expand__button:focus,
.esri-ui-top-left .esri-expand .esri-expand__button:focus-visible,
.esri-expand .esri-widget--button:focus,
.esri-expand .esri-widget--button:focus-visible {
    outline: none !important;
    border-color: #94A3B8 !important;
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.25), 0 2px 8px rgba(15, 23, 42, 0.08) !important;
}

/* Active & Expanded States (Remove the default active blue) */
.esri-ui-top-left .esri-expand .esri-widget--button:active,
.esri-ui-top-left .esri-expand .esri-expand__button:active,
.esri-expand .esri-widget--button:active,
.esri-expand .esri-expand__button:active,
.esri-expand--expanded .esri-expand__button,
.esri-widget--button--active {
    background: #F1F5F9 !important;
    background-color: #F1F5F9 !important;
    color: #0F172A !important;
    border-color: #64748B !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08) !important;
    outline: none !important;
    transform: translateY(0);
}

/* Icon inside Button */
.esri-ui-top-left .esri-expand .esri-expand__icon,
.esri-ui-top-left .esri-expand .esri-icon,
.esri-expand .esri-expand__icon,
.esri-expand .esri-icon {
    font-size: 15px !important;
    color: inherit !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* Tooltip Styling (Clean dark pill matching modern design) */
.esri-tooltip,
.esri-ui .esri-tooltip {
    background: #1E293B !important;
    color: #F8FAFC !important;
    font-family: var(--font-main, 'Open Sans', sans-serif) !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    padding: 5px 9px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    border: none !important;
}

/* Map Controls Group in Bottom-Right (Zoom In, Zoom Out, Home, Screenshot) */
.map-ctrl-group {
    display: flex;
    flex-direction: column;
    background: #FFFFFF !important;
    border-radius: 8px !important;
    border: 1px solid #CBD5E1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    overflow: hidden;
}

.map-ctrl-btn {
    width: 36px;
    height: 36px;
    border: none !important;
    background: #FFFFFF !important;
    cursor: pointer;
    color: #475569;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
    padding: 0;
}

.map-ctrl-btn:not(:last-child) {
    border-bottom: 1px solid #E2E8F0 !important;
}

.map-ctrl-btn:hover {
    background: #F8FAFC !important;
    color: #0F172A !important;
}

.map-ctrl-btn:active {
    background: #E2E8F0 !important;
}

.map-ctrl-btn.disabled,
.map-ctrl-btn:disabled {
    opacity: 0.38 !important;
    cursor: not-allowed !important;
    background: #FAFAFA !important;
    color: #94A3B8 !important;
}

.map-ctrl-btn.disabled:hover,
.map-ctrl-btn:disabled:hover {
    background: #FAFAFA !important;
    color: #94A3B8 !important;
}

.esri-ui-bottom-right .esri-component {
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
}

/* Remove Esri attribution widget */
.esri-attribution,
.esri-component.esri-attribution {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.esri-expand__panel {
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #CBD5E1 !important;
    background: #FFFFFF !important;
}

/* ==========================================================================
   2. FILTER CONTROLS SECTION (No background card, no shadow effect)
   ========================================================================== */

#card-filters {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-bottom: 32px;
}

#card-filters .dashboard-card-header {
    background: transparent !important;
    border-bottom: none !important;
    padding: 0 0 16px 0 !important;
}

.filter-section {
    padding: 0 !important;
    background: transparent !important;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-sector-type {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.filter-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    color: #1E293B;
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2364748B%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%209l6%206%206-6%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.filter-select:focus {
    border-color: var(--primary-blue, #3185C6);
    box-shadow: 0 0 0 3px rgba(49, 133, 198, 0.15);
}

.filter-select optgroup {
    font-weight: 700;
    color: #1A365D;
    background-color: #F8FAFC;
}

.filter-select option {
    font-weight: normal;
    color: #1E293B;
    background-color: #FFFFFF;
    padding: 6px;
}

/* Year Filter & Square Reset Button Wrapper */
.year-control-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-stepper-box,
.filter-stepper-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.year-stepper-box:focus-within,
.filter-stepper-box:focus-within {
    border-color: var(--primary-blue, #3185C6);
    box-shadow: 0 0 0 3px rgba(49, 133, 198, 0.15);
}

.year-stepper-box .filter-select,
.filter-stepper-box .filter-select {
    border: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    padding-right: 48px;
    background-position: right 30px center;
    width: 100%;
}

.year-stepper-controls,
.filter-stepper-controls {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 26px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #E2E8F0;
    background: #FAFAFA;
    z-index: 2;
}

.btn-year-stepper,
.btn-filter-stepper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #475569;
    font-size: 9px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: background-color 0.15s, color 0.15s;
    line-height: 1;
}

.btn-year-stepper.btn-year-up,
.btn-filter-stepper.btn-stepper-up {
    border-bottom: 1px solid #E2E8F0;
}

.btn-year-stepper:hover:not(:disabled),
.btn-filter-stepper:hover:not(:disabled) {
    background: #E2E8F0;
    color: #0F172A;
}

.btn-year-stepper:active:not(:disabled),
.btn-filter-stepper:active:not(:disabled) {
    background: #CBD5E1;
}

.btn-year-stepper:disabled,
.btn-filter-stepper:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    color: #94A3B8;
    background: #FAFAFA;
}

.btn-reset-filters-square {
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    color: #475569;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-reset-filters-square:hover {
    background: #F1F5F9;
    color: #0F172A;
    border-color: #94A3B8;
}

.btn-reset-filters-square:active {
    background: #E2E8F0;
}

/* Subtitle & Selection Summary under State-Level Annual Emissions (Left Aligned) */
.table-subtitle-summary {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
    text-align: left;
    width: 100%;
}

.selection-summary-text {
    font-size: 13.5px;
    color: #475569;
    line-height: 1.5;
    text-align: left;
    margin: 0;
}

.selection-summary-text strong {
    color: #1E293B;
    font-weight: 600;
}

.selection-note {
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
    text-align: left;
    margin: 0;
}

.selection-footnote {
    font-size: 11px;
    color: #64748B;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    margin-top: 3px;
    max-width: 1050px;
}

.selection-footnote em {
    font-style: italic;
    font-weight: 600;
    color: #475569;
}

/* ==========================================================================
   3. DATA TABLE SECTION
   ========================================================================== */

#card-table .dashboard-card-header {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid #E2E8F0;
    background: #FFFFFF;
}

.table-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

.table-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.page-size-select {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    background-color: #FFFFFF;
    color: #1E293B;
    cursor: pointer;
    outline: none;
}

.table-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.table-search-box i {
    position: absolute;
    left: 12px;
    color: #94A3B8;
    font-size: 13px;
}

.table-search-input {
    padding: 7px 12px 7px 34px;
    font-size: 13px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    outline: none;
    width: 220px;
    transition: all 0.2s;
    font-family: inherit;
}

.table-search-input:focus {
    border-color: var(--primary-blue, #3185C6);
    box-shadow: 0 0 0 3px rgba(49, 133, 198, 0.15);
    width: 260px;
}

.btn-download-csv {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: var(--primary-blue, #3185C6);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 6px rgba(49, 133, 198, 0.25);
}

.btn-download-csv:hover {
    background-color: var(--primary-blue-hover, #24689E);
}

/* Scrollable Table System */
.data-table-container {
    width: 100%;
    overflow-x: auto;
    position: relative;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}

.dashboard-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #F8FAFC;
    color: #334155;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #CBD5E1;
    border-right: 1px solid #E2E8F0;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.dashboard-table thead th:hover {
    background-color: #EDF2F7;
    color: #0F172A;
}

.dashboard-table thead th.sort-active {
    color: var(--primary-blue, #3185C6);
    background-color: #EBF8FF;
}

.dashboard-table thead th .sort-icon {
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.5;
}

.dashboard-table thead th.sort-active .sort-icon {
    opacity: 1;
}

/* Sticky First Column: State/Territories */
.dashboard-table th.col-state,
.dashboard-table td.col-state {
    position: sticky;
    left: 0;
    text-align: left;
    background-color: #FFFFFF;
    z-index: 5;
    font-weight: 600;
    color: #1E293B;
    border-right: 2px solid #CBD5E1;
    padding: 10px 16px;
    min-width: 200px;
}

.dashboard-table thead th.col-state {
    z-index: 20;
    background-color: #F1F5F9;
}

.col-state-header-content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.territory-info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748B;
    font-size: 13px;
    cursor: help;
    transition: color 0.15s;
    vertical-align: middle;
}

.territory-info-tooltip:hover {
    color: var(--primary-blue, #3185C6);
}

.territory-info-tooltip .tooltip-bubble {
    visibility: hidden;
    opacity: 0;
    width: 330px;
    background-color: #0F172A;
    color: #F8FAFC;
    text-align: left;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    border-radius: 8px;
    padding: 11px 14px;
    position: absolute;
    z-index: 1000;
    top: calc(100% + 8px);
    left: -12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.territory-info-tooltip .tooltip-bubble::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 16px;
    width: 10px;
    height: 10px;
    background-color: #0F172A;
    border-left: 1px solid #334155;
    border-top: 1px solid #334155;
    transform: rotate(45deg);
}

.territory-info-tooltip:hover .tooltip-bubble,
.dashboard-table thead th.col-state:hover .tooltip-bubble {
    visibility: visible;
    opacity: 1;
}

.dashboard-table tbody tr {
    transition: background-color 0.15s;
}

.dashboard-table tbody tr:nth-child(even) td {
    background-color: #F8FAFC;
}

.dashboard-table tbody tr:nth-child(even) td.col-state {
    background-color: #F8FAFC;
}

.dashboard-table tbody tr:hover td {
    background-color: #F1F5F9;
}

.dashboard-table tbody tr:hover td.col-state {
    background-color: #EDF2F7;
}

.dashboard-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #E2E8F0;
    border-right: 1px solid #F1F5F9;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

/* Highlight Selected Year Column */
.dashboard-table th.col-selected-year {
    background-color: #E0F2FE !important;
    color: #0369A1 !important;
    border-left: 1px solid #7DD3FC;
    border-right: 1px solid #7DD3FC;
}

.dashboard-table td.col-selected-year {
    background-color: #F0F9FF !important;
    font-weight: 600;
    color: #0369A1 !important;
    border-left: 1px solid #BAE6FD;
    border-right: 1px solid #BAE6FD;
}

.dashboard-table tbody tr:hover td.col-selected-year {
    background-color: #E0F2FE !important;
}

.dashboard-table td.val-nodata {
    color: #94A3B8;
    font-style: italic;
}

.dashboard-table td.val-code {
    color: #475569;
    font-weight: 600;
}

/* Pagination Bar */
.table-pagination-bar {
    padding: 16px 24px;
    background-color: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.table-pagination-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: #64748B;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-page {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 34px;
    text-align: center;
}

.btn-page:hover:not(:disabled) {
    background-color: #F1F5F9;
    color: #0F172A;
}

.btn-page.active {
    background-color: var(--primary-blue, #3185C6);
    color: #FFFFFF;
    border-color: var(--primary-blue, #3185C6);
}

.btn-page:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.table-bottom-legend {
    padding: 14px 24px 18px 24px;
    background-color: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    font-size: 12px;
    line-height: 1.6;
    color: #64748B;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.table-bottom-credit {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #E2E8F0;
    font-size: 11.5px;
    color: #64748B;
    font-style: italic;
}

/* ==========================================================================
   4. LOADING, ERROR, & SPINNER OVERLAYS
   ========================================================================== */

.dashboard-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    transition: opacity 0.2s;
}

/* Map Loading Overlay - Seamlessly matches the page background */
#dashboard-main-loading {
    background: #F8FAFC !important;
    background-color: #F8FAFC !important;
    backdrop-filter: none !important;
}

.dashboard-spinner {
    width: 38px;
    height: 38px;
    border: 3.5px solid #E2E8F0;
    border-top-color: var(--primary-blue, #3185C6);
    border-radius: 50%;
    animation: dashSpin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes dashSpin {
    to { transform: rotate(360deg); }
}

.dashboard-loading-text {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

/* Error Alert Box */
.dashboard-error-box {
    margin: 16px 24px;
    padding: 16px 20px;
    background-color: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    color: #991B1B;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dashboard-error-box i {
    font-size: 18px;
    color: #DC2626;
}

.btn-retry {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    background-color: #DC2626;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-retry:hover {
    background-color: #B91C1C;
}

/* ==========================================================================
   5. RESPONSIVE BREAKPOINTS
   ========================================================================== */

@media (max-width: 1200px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-map-section .map-wrapper,
    .map-wrapper {
        height: 560px;
    }
    .map-legend-container {
        max-width: 200px;
        bottom: 15px;
        right: 15px;
        padding: 10px;
    }
}

@media (max-width: 640px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }
    .table-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .table-header-right {
        margin-left: 0;
        justify-content: space-between;
    }
    .table-search-box {
        flex: 1;
    }
    .table-search-input {
        width: 100%;
    }
    .dashboard-map-section .map-wrapper,
    .map-wrapper {
        height: 440px;
    }
    .map-legend-container {
        font-size: 10px;
        padding: 8px;
        bottom: 10px;
        right: 10px;
    }
}
