/* UX enhancement pass: clearer controls, synchronized list/map, tighter cards, mobile view switcher. */

.bsfct-finder .bsfct-search-panel__copy--program-heading {
    display: block;
    margin-bottom: 18px;
    text-align: left;
}

.bsfct-finder .bsfct-search-panel__copy--program-heading .bsfct-search-panel__title {
    margin: 0 0 6px;
    color: var(--bsfct-blue-dark);
    font-size: clamp(24px, 2.4vw, 34px);
    line-height: 1.12;
}

.bsfct-finder .bsfct-search-panel__copy--program-heading .bsfct-search-panel__description {
    margin: 0;
    max-width: 720px;
}

.bsfct-finder .bsfct-distance-options {
    display: inline-flex;
    align-items: stretch;
    width: 100%;
    min-height: 48px;
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--bsfct-border);
    border-radius: 12px;
    background: #fff;
    box-sizing: border-box;
}

.bsfct-finder .bsfct-distance-option {
    appearance: none;
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #334155;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.bsfct-finder .bsfct-distance-option:hover {
    background: var(--bsfct-blue-soft);
    color: var(--bsfct-blue-dark);
}

.bsfct-finder .bsfct-distance-option:focus-visible {
    outline: 2px solid rgba(33, 79, 151, .28);
    outline-offset: 1px;
}

.bsfct-finder .bsfct-distance-option.is-active {
    background: var(--bsfct-blue);
    color: #fff;
    box-shadow: 0 3px 8px rgba(33, 79, 151, .2);
}

/* Program-specific hero: ZIP first, then compact distance/results controls. */
.bsfct-finder .bsfct-search-form--hero.bsfct-search-form--locked-program .bsfct-search-form__hero-grid--single-program {
    display: grid !important;
    grid-template-columns: minmax(210px, 1.25fr) minmax(300px, 1.8fr) minmax(110px, .6fr) minmax(170px, .8fr) !important;
    gap: 12px !important;
    align-items: end !important;
}

.bsfct-finder .bsfct-search-form--locked-program .bsfct-field--program-hero {
    display: none !important;
}

.bsfct-finder .bsfct-field__label--hero {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--bsfct-text);
}

.bsfct-finder .bsfct-search-form--locked-program .bsfct-field--zip-hero .bsfct-field__control {
    min-height: 52px;
    font-size: 17px;
    font-weight: 600;
}

.bsfct-finder .bsfct-search-form--locked-program .bsfct-distance-options--hero,
.bsfct-finder .bsfct-search-form--locked-program .bsfct-field--results-hero .bsfct-field__control,
.bsfct-finder .bsfct-search-form--locked-program .bsfct-search-form__actions--hero .bsfct-button {
    min-height: 52px;
}

/* Results window topbar: make ZIP primary and the three distance choices immediately visible. */
.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__stack {
    grid-template-columns: minmax(155px, 190px) minmax(285px, 335px) minmax(90px, 110px) minmax(560px, 1fr) minmax(150px, 175px) !important;
    gap: 10px !important;
    align-items: end !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-form__stack {
    grid-template-columns: minmax(185px, 225px) minmax(305px, 360px) minmax(95px, 115px) minmax(160px, 185px) !important;
    justify-content: start;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form--no-per-page .bsfct-search-form__stack {
    grid-template-columns: minmax(155px, 190px) minmax(285px, 335px) minmax(560px, 1fr) minmax(150px, 175px) !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-form--no-per-page .bsfct-search-form__stack {
    grid-template-columns: minmax(185px, 225px) minmax(305px, 360px) minmax(160px, 185px) !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-panel__copy {
    display: block !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-panel__title {
    margin: 0 !important;
    color: var(--bsfct-blue-dark);
    font-size: 18px !important;
    line-height: 1.2 !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-panel__description {
    display: none !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-filter-group:first-child .bsfct-field__control {
    border-color: #9fb4d4;
    box-shadow: 0 0 0 2px rgba(33, 79, 151, .05);
    font-size: 14px;
    font-weight: 700;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-distance-options {
    min-height: 48px;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-distance-option {
    min-height: 40px;
    font-size: 12px;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__actions,
.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__actions .bsfct-button {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* Cleaner summary: the sentence carries the useful information; the count pill is redundant. */
.bsfct-finder.bsfct-finder--results-window .bsfct-results__count-pill {
    display: none !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__window-header {
    margin-bottom: 12px !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__summary {
    color: #526173;
    font-weight: 600;
}

/* Tighter result cards: more results visible without losing readability. */
.bsfct-finder .bsfct-card {
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background-color .15s ease;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-results__list--window {
    gap: 9px !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card {
    grid-template-columns: 34px minmax(0, 1fr) auto !important;
    gap: 7px 10px !important;
    padding: 11px 12px 11px 10px !important;
    border: 1px solid transparent;
    cursor: default;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card:focus-visible {
    outline: 2px solid rgba(33, 79, 151, .3);
    outline-offset: 2px;
}

.bsfct-finder .bsfct-card.is-bsfct-active {
    border-color: #2e5cb8 !important;
    background: #f8fbff !important;
    box-shadow: 0 8px 22px rgba(33, 79, 151, .16) !important;
    transform: translateY(-1px);
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__rank {
    width: 27px !important;
    height: 27px !important;
    font-size: 14px !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__body {
    gap: 4px !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__title {
    font-size: 14px !important;
    line-height: 1.18 !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__subtitle {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    font-weight: 700;
    color: var(--bsfct-blue);
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__council,
.bsfct-finder.bsfct-finder--results-window .bsfct-card__location {
    margin: 0 !important;
    font-size: 12.5px !important;
    line-height: 1.3 !important;
    color: #334155;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__council {
    font-weight: 600;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__distance-badge {
    min-width: 70px !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 14px !important;
    border-radius: 0 13px 0 13px !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__actions {
    margin-top: 3px !important;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__actions .bsfct-button {
    min-height: 36px !important;
    padding: 0 15px !important;
    font-size: 12.5px !important;
    font-weight: 700;
}

.bsfct-finder .bsfct-card__shop-button::after,
.bsfct-finder .bsfct-map-popup__button::after {
    content: "\2192";
    display: inline-block;
    margin-left: 6px;
    transition: transform .15s ease;
}

.bsfct-finder .bsfct-card__shop-button:hover::after,
.bsfct-finder .bsfct-map-popup__button:hover::after {
    transform: translateX(2px);
}

/* Stronger active map marker. */
.bsfct-finder .bsfct-map-pin-icon svg {
    transform-origin: 50% 100%;
    transition: transform .15s ease, filter .15s ease;
}

.bsfct-finder .bsfct-map-pin-icon.is-bsfct-active svg {
    transform: scale(1.28);
    filter: drop-shadow(0 5px 6px rgba(15, 23, 42, .28));
}

.bsfct-finder .bsfct-map-popup__council {
    margin: 0 0 5px;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.bsfct-finder .bsfct-results__map-meta {
    padding-bottom: 8px;
}

.bsfct-finder .bsfct-results__map-summary {
    margin: 0 0 3px;
    font-weight: 700;
}

.bsfct-finder .bsfct-results__map-note {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

/* Useful no-result state with nearest fallback. */
.bsfct-finder .bsfct-empty-state--nearest {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 9px;
    padding: 26px !important;
}

.bsfct-finder .bsfct-empty-state--nearest h4,
.bsfct-finder .bsfct-empty-state--nearest p {
    margin: 0;
}

.bsfct-finder .bsfct-empty-state--nearest h4 {
    color: var(--bsfct-blue-dark);
    font-size: 18px;
}

/* Mobile List / Map switch. Hidden on desktop. */
.bsfct-finder .bsfct-results__mobile-view-toggle {
    display: none;
}

@media (max-width: 1180px) {
    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__stack {
        grid-template-columns: minmax(145px, 180px) minmax(270px, 330px) minmax(90px, 105px) minmax(0, 1fr) !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-filter-group--programs,
    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__actions {
        grid-column: auto !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-filter-group--programs {
        grid-column: 1 / -2 !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__actions {
        grid-column: -2 / -1 !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-form__stack {
        grid-template-columns: minmax(165px, 210px) minmax(270px, 330px) minmax(90px, 105px) minmax(150px, 180px) !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-form__actions {
        grid-column: auto !important;
    }
}

@media (max-width: 900px) {
    .bsfct-finder .bsfct-search-form--hero.bsfct-search-form--locked-program .bsfct-search-form__hero-grid--single-program {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 1.4fr) !important;
    }

    .bsfct-finder .bsfct-search-form--locked-program .bsfct-field--results-hero,
    .bsfct-finder .bsfct-search-form--locked-program .bsfct-search-form__actions--hero {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .bsfct-finder .bsfct-results__mobile-view-toggle {
        display: inline-flex;
        align-items: center;
        justify-self: start;
        margin: 0 0 2px;
        padding: 3px;
        border: 1px solid var(--bsfct-border);
        border-radius: 11px;
        background: #fff;
        box-shadow: 0 4px 12px rgba(12, 33, 66, .06);
    }

    .bsfct-finder .bsfct-results__mobile-view-button {
        min-width: 86px;
        min-height: 38px;
        padding: 7px 16px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #475569;
        font: inherit;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
    }

    .bsfct-finder .bsfct-results__mobile-view-button.is-active {
        background: var(--bsfct-blue);
        color: #fff;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-content {
        display: block !important;
        min-height: 0 !important;
    }

    .bsfct-finder.bsfct-finder--results-window:not(.bsfct-mobile-view--map) .bsfct-results__window-map-column {
        display: none !important;
    }

    .bsfct-finder.bsfct-finder--results-window.bsfct-mobile-view--map .bsfct-results__window-list-column {
        display: none !important;
    }

    .bsfct-finder.bsfct-finder--results-window.bsfct-mobile-view--map .bsfct-results__window-map-column {
        display: block !important;
        position: static !important;
        min-height: 0 !important;
        padding: 10px !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__map-canvas {
        min-height: 64vh !important;
        height: 64vh !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-card {
        grid-template-columns: 30px minmax(0, 1fr) auto !important;
        padding: 10px !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__stack,
    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-panel--locked-program .bsfct-search-form__stack {
        grid-template-columns: 1fr !important;
        gap: 9px !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-filter-group--programs,
    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-search-form__actions {
        grid-column: auto !important;
        width: 100% !important;
    }

    .bsfct-finder.bsfct-finder--results-window .bsfct-results__window-topbar .bsfct-program-options {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
    }

    .bsfct-finder .bsfct-search-form--hero.bsfct-search-form--locked-program .bsfct-search-form__hero-grid--single-program {
        grid-template-columns: 1fr !important;
    }
}


/* Safety sizing for results-window program icons */
.bsfct-finder .bsfct-card__program-icon-wrap {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bsfct-finder .bsfct-card__program-icon {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.bsfct-finder.bsfct-finder--results-window .bsfct-card__program-icon-wrap {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
}
