/* START OF FILE chart-search.css */

/* ==========================================================================
   Base & Layout
   ========================================================================== */

body {
    background-color: var(--color-background, #F7F8FA);
}

/* Note: Do NOT put overflow-x: hidden on html or body —
   it breaks position: sticky on the category filter bar.
   Instead, overflow is clipped on .explore-controls directly. */

/* Content spacing: global nav (60px) + controls bar (66px) + category bar (44px) = 170px */
.site-content {
    margin-top: 170px;
    position: relative;
    z-index: 0;
}

.search-content {
    padding-left: var(--side-padding);
    padding-right: var(--side-padding);
    max-width: 2000px;
    margin-left: auto;
    margin-right: auto;
}

/* Rule for screens > 1200px to override Astra's likely desktop margin */
@media (min-width: 1201px) {
    body.page-template-page-chart-search #primary.content-area {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

body.page-template-page-chart-search #primary.content-area {
    padding-top: 0 !important;
}


/* ==========================================================================
   Controls Bar (replaces old header)
   ========================================================================== */

.explore-controls {
    position: fixed;
    top: 60px; /* Below global nav (60px from briefing.css) */
    left: 0;
    right: 0;
    height: 66px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    z-index: 1002; /* Above global nav (1001) so radius slider isn't clipped */
}

/* Muted Leaflet map background */
.controls-map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    opacity: 0.75;
    filter: grayscale(20%) saturate(80%);
    pointer-events: none; /* Don't block clicks to controls */
}

/* Hide Leaflet attribution and marker inside controls map */
.controls-map .leaflet-control-attribution,
.controls-map .leaflet-marker-icon,
.controls-map .leaflet-marker-shadow {
    display: none !important;
}

/* Soft edge fade so map blends into controls bar edges */
.controls-map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0) 8%,
        rgba(255, 255, 255, 0) 92%,
        rgba(255, 255, 255, 0.3) 100%
    );
    pointer-events: none;
}

.explore-controls-inner {
    position: relative;
    z-index: 2; /* Above map and overlay */
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 3px 24px;
    height: 66px;
    box-sizing: border-box;
}


/* ==========================================================================
   Scope Tabs
   ========================================================================== */

.scope-tabs {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.scope-tab {
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid var(--color-border, #ddd);
    background: rgba(255, 255, 255, 0.85);
    color: var(--color-text-secondary, #4A4A68);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
    backdrop-filter: blur(4px);
}

.scope-tab:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--color-border-hover, #CBD5E1);
}

.scope-tab.active {
    color: #fff;
    border-color: transparent;
}

/* Scope-specific active colors */
.scope-tab.active[data-scope="local"] {
    background-color: #9ad2ef;
}
.scope-tab.active[data-scope="regional"] {
    background-color: #f5b8b1;
}
.scope-tab.active[data-scope="national"] {
    background-color: #cad4d5;
}
.scope-tab.active[data-scope="global"] {
    background-color: #93d7b0;
}


/* ==========================================================================
   Search Form (inside controls bar)
   ========================================================================== */

.explore-search-form {
    display: flex;
    flex: 1;
    max-width: 600px;
    height: 36px;
}

.explore-search-form .location-input-container,
.explore-search-form .search-input-container {
    display: flex;
    align-items: center;
    position: relative;
    height: 36px;
    box-sizing: border-box;
    flex: 1;
    background-color: #fff;
}

.explore-search-form .location-input-container {
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 18px 0 0 18px;
}

.explore-search-form .search-input-container {
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 18px 18px 0;
}

#location-input {
    padding-left: 32px;
    padding-right: 10px;
    border-radius: 18px 0 0 18px;
    width: 100%;
    height: 34px;
    border: none;
    font-size: 14px;
    color: #2c3e50;
    box-sizing: border-box;
    background-color: transparent;
}

#search-query {
    padding-left: 10px;
    padding-right: 32px;
    border-radius: 0 18px 18px 0;
    width: 100%;
    height: 34px;
    border: none;
    font-size: 14px;
    color: #2c3e50;
    box-sizing: border-box;
    background-color: transparent;
}

#location-input:focus,
#search-query:focus {
    outline: none;
    box-shadow: none;
    border: none;
    -webkit-appearance: none;
}

#location-input::placeholder {
    color: #809dba;
}

/* --- Input Icons --- */
.location-icon,
.search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #809dba;
    font-size: 14px;
    z-index: 5;
}

.location-icon {
    left: 10px;
}

.search-icon {
    right: 10px;
    cursor: pointer;
}

.search-icon:hover {
    color: #3a4f63;
}

/* --- Mapbox Autocomplete --- */
.mapbox-autocomplete-container {
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    display: none;
    margin-top: 1px;
    border-radius: 0 0 4px 4px;
}

.mapbox-suggestion {
    padding: 10px;
    cursor: pointer;
}

.mapbox-suggestion:hover {
    background-color: #f0f0f0;
}


/* ==========================================================================
   Category Filter Bar (text tabs)
   ========================================================================== */

.explore-filter-bar {
    position: fixed;
    top: 126px; /* 60px nav + 66px controls */
    left: 0;
    right: 0;
    height: 44px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    z-index: 999;
}

.explore-filter-bar .filter-bar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 8px;
}

.category-text-tabs {
    display: flex;
    overflow-x: auto;
    gap: 2px;
    flex: 1;
    align-items: center;
    height: 100%;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-right: 48px;
    /* Fade masks to indicate scrollable overflow */
    --fade-size: 48px;
    --mask-left: linear-gradient(to right, transparent, black var(--fade-size));
    --mask-right: linear-gradient(to left, transparent, black var(--fade-size));
    --mask-both: var(--mask-left), var(--mask-right);
    --mask-full: linear-gradient(black, black);
}

.category-text-tabs::-webkit-scrollbar {
    display: none;
}

/* Overflow fade indicators */
.category-text-tabs.fade-right {
    -webkit-mask-image: var(--mask-right);
    mask-image: var(--mask-right);
}

.category-text-tabs.fade-left {
    -webkit-mask-image: var(--mask-left);
    mask-image: var(--mask-left);
}

.category-text-tabs.fade-both {
    -webkit-mask-image: var(--mask-both);
    mask-image: var(--mask-both);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

.category-text-tab {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #5a6a7a;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}

/* Hover only on devices that actually hover (mouse), so a tapped tab on
   touch doesn't get stuck looking shaded. Also: a tab the user just
   DESELECTED keeps the pointer resting on it, so :hover would linger and
   read as "still selected" until you move the mouse / leave the window and
   come back. Exclude .selected from the hover rule and keep hover visually
   lighter than selected so a hovered, un-selected tab never looks active. */
@media (hover: hover) {
    .category-text-tab:not(.selected):hover {
        background-color: #f0f2f5;
        color: #2c3e50;
    }
}

.category-text-tab.selected {
    background-color: var(--color-primary, #2c3e50);
    color: #fff;
}

/* Keep the selected look on a selected tab even while hovered/focused. */
.category-text-tab.selected:hover,
.category-text-tab.selected:focus {
    background-color: var(--color-primary, #2c3e50);
    color: #fff;
}

/* Don't let keyboard/click focus leave a tab looking shaded after deselect. */
.category-text-tab:not(.selected):focus {
    background-color: transparent;
    color: #5a6a7a;
}

/* --- Subcategory Dropdown (kept for text tabs) --- */
.subcategory-dropdown {
    background-color: #34495e;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: white;
    max-height: 200px;
    min-width: 120px;
    overflow-y: auto;
    padding: 10px;
    position: absolute;
    top: 100%;
    z-index: 1000;
}

.subcategory-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: stretch;
    width: 100%;
}

.subcategory-btn {
    background-color: transparent;
    border: 2px solid transparent;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    width: 100%;
    display: block;
    outline: none !important;
    box-shadow: none !important;
}

.subcategory-btn:not(.selected) {
    border-color: transparent !important;
}

.subcategory-btn.selected,
.subcategory-btn.selected:hover,
.subcategory-btn.selected:focus,
.subcategory-btn.selected:active {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid white !important;
}

.subcategory-btn:not(.selected):hover,
.subcategory-btn:not(.selected):focus:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: transparent;
}

.subcategory-btn:not(.selected):focus:not(:hover) {
    background-color: transparent;
}

/* Scrollbar styles */
.subcategory-dropdown::-webkit-scrollbar { width: 8px; }
.subcategory-dropdown::-webkit-scrollbar-track { background: #2c3e50; }
.subcategory-dropdown::-webkit-scrollbar-thumb { background-color: #95a5a6; border-radius: 4px; }


/* --- More Filters Button --- */
.more-filters-btn {
    flex-shrink: 0;
    background-color: transparent;
    border: 1px solid #ddd;
    color: #5a6a7a;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    outline: none;
    height: 32px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-family: inherit;
}

.more-filters-btn i {
    font-size: 13px;
}

.more-filters-btn .more-filters-text {
    display: inline;
    line-height: 1;
}

.more-filters-btn:hover,
.more-filters-btn:focus {
    background-color: #f0f2f5;
    border-color: #ccc;
}

.more-filters-btn.active,
.more-filters-btn.has-selection {
    background-color: var(--color-primary, #2c3e50);
    color: #fff;
    border-color: var(--color-primary, #2c3e50);
}

/* --- Reset All Button --- */
#reset-all-container {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#reset-all-btn {
    background-color: transparent;
    color: #5a6a7a;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

#reset-all-btn i {
    font-size: 14px;
}

#reset-all-btn:hover {
    background-color: #f0f2f5;
}


/* ==========================================================================
   Modal (More Filters)
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #2c3e50;
    width: 90%;
    max-width: 800px;
    color: #2c3e50;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 5px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

.modal h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.modal-filters {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.filter-section {
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 20px;
    margin-bottom: 15px;
}
.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #34495e;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    background-color: white;
    border: 1px solid #bdc3c7;
    color: #34495e;
    padding: 5px 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    font-size: 14px;
}

.filter-btn:hover {
    background-color: #ecf0f1;
    border-color: #95a5a6;
}

.filter-btn:focus {
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.2);
}

.filter-btn.selected {
    background-color: #2c3e50;
    border-color: #2c3e50;
    color: white;
}

.no-tags-message {
    color: #95a5a6;
    font-style: italic;
    font-size: 14px;
    margin: 0;
}

.custom-tags-section button {
    padding: 8px 15px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}
.custom-tags-section button:hover {
    background-color: #34495e;
}


/* ==========================================================================
   Radius Slider (compact inline in controls bar)
   ========================================================================== */

.explore-radius {
    flex-shrink: 0;
}

#radius-slider-container {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#radius-slider-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

#radius-slider {
    width: 100%;
    height: 100%;
}

#radius-value {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: bold;
    color: #2c3e50;
    white-space: nowrap;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    z-index: 2;
    pointer-events: none;
}

#radius-value .radius-number {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 1px;
    position: relative;
    top: 3px;
}

/* --- Unit Toggle/Dropdown --- */
.radius-unit-container {
    position: relative;
    margin-top: 2px;
    cursor: pointer;
    text-align: center;
    display: flex;
    justify-content: center;
    width: 100%;
    pointer-events: auto;
}

.radius-unit-display {
    position: relative;
    width: 100%;
    height: 12px;
    font-size: 10px;
    line-height: 1;
    padding-right: 10px;
    cursor: pointer;
    z-index: 3;
}

.unit-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #2c3e50;
}

.unit-arrow {
    border: none !important;
    border-left: 3px solid transparent !important;
    border-right: 3px solid transparent !important;
    border-top: 4px solid #2c3e50 !important;
    position: absolute !important;
    left: auto !important;
    right: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: inline-block !important;
    transition: transform 0.2s ease;
}

.radius-unit-container:hover .unit-arrow {
     transform: translateY(-50%) scale(1.1);
}

.unit-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    margin-top: 5px;
    width: 64px;
    display: none;
    z-index: 4;
    overflow: hidden;
    text-align: center;
}

.unit-dropdown:before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #2c3e50;
}

.unit-option {
    padding: 8px;
    white-space: nowrap;
    font-size: 10px;
    color: white;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.unit-option:hover {
    background-color: #34495e;
}

.unit-option.selected {
    background-color: #34495e;
    font-weight: bold;
}

/* --- roundSlider Overrides --- */
.rs-tooltip {
    display: none !important;
}

.rs-handle.custom-handle {
    background-color: #2c3e50;
    border: 2px solid #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    z-index: 1 !important;
}

.rs-border {
    border: none;
}

#radius-slider .rs-range-color { background-color: #3498db !important; }


/* ==========================================================================
   Search Results & Pagination
   ========================================================================== */

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* --- Pagination --- */
.pagination {
    text-align: center;
    margin: 30px 0;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    border: 1px solid #ddd;
    color: #34495e;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 14px;
}

.pagination .page-numbers.current {
    background-color: #34495e;
    color: white;
    border-color: #34495e;
    font-weight: bold;
}

.pagination .page-numbers:hover:not(.current):not(.dots) {
    background-color: #ecf0f1;
    border-color: #bdc3c7;
}

.pagination .dots {
    border: none;
    padding: 8px 5px;
    color: #95a5a6;
}

.pagination .prev,
.pagination .next {
    padding: 8px 12px;
    font-weight: bold;
}


/* ==========================================================================
   Media Queries (Responsive Design)
   ========================================================================== */

@media (max-width: 900px) {
    .explore-controls-inner {
        padding: 8px 12px;
        gap: 8px;
    }

    .scope-tab {
        padding: 4px 10px;
        font-size: 12px;
    }

    .explore-search-form {
        max-width: 400px;
    }
}

@media (max-width: 700px) {
    /* On narrow screens: everything scrolls away naturally except the
       category bar, which sticks at the top of the viewport. This gives
       maximum space for browsing charts. */

    /* Header: override inline fixed positioning — let it scroll away */
    #global-nav.briefing-header,
    .briefing-header {
        position: relative !important;
        top: auto !important;
        z-index: 100 !important;
    }

    .explore-controls {
        position: relative;
        top: auto;
        height: auto;
        overflow: hidden; /* clip map background from causing horizontal scroll */
    }

    .explore-controls-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 6px 12px;
        gap: 6px;
    }

    .scope-tabs {
        order: 1;
    }

    .explore-radius {
        order: 2;
        margin-left: auto;
    }

    .explore-search-form {
        order: 3;
        max-width: 100%;
        flex-basis: 100%;
    }

    /* Category bar: only sticky element — sticks at viewport top */
    .explore-filter-bar {
        position: sticky;
        top: 0;
        z-index: 1001;
    }

    .site-content {
        margin-top: 0;
    }

    /* Filter bar adjustments */
    .explore-filter-bar .filter-bar-content {
        padding: 0 12px;
        gap: 6px;
    }

    .more-filters-btn {
        width: 32px;
        height: 32px;
        padding: 0;
        justify-content: center;
        min-width: 32px;
        border-radius: 50%;
    }

    .more-filters-btn .more-filters-text {
        display: none;
    }

    .more-filters-btn i {
        font-size: 14px;
        margin: 0;
    }

    #reset-all-btn {
        font-size: 12px;
    }
    #reset-all-btn span {
        display: none;
    }
}

@media (max-width: 550px) {
    .explore-search-form .search-input-container {
        display: none;
    }

    .explore-search-form .location-input-container {
        border-radius: 18px;
        border-right: 1px solid #ddd;
    }

    #location-input {
        border-radius: 18px;
    }

    .scope-tabs {
        gap: 2px;
    }

    .scope-tab {
        padding: 3px 8px;
        font-size: 11px;
    }
}

/* END OF FILE chart-search.css */
