:root {
    --bt-location-orange: #ff681f;
    --bt-location-orange-dark: #eb5310;
    --bt-location-ink: #151515;
    --bt-location-muted: #6f7078;
    --bt-location-line: #e8e8ec;
    --bt-location-surface: #ffffff;
}

.bt-location-picker[aria-hidden="true"],
.bt-location-picker [hidden],
.bt-location-picker-toast[hidden] {
    display: none !important;
}

.bt-location-picker {
    position: fixed;
    top: var(--bt-location-viewport-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 1600;
    width: 100%;
    height: var(--bt-location-viewport-height, 100dvh);
    min-height: 0;
    display: grid;
    align-items: end;
    justify-items: center;
    padding: 16px;
}

.bt-location-picker-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(16, 16, 18, 0.58);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    cursor: default;
}

.bt-location-picker-sheet {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    max-height: min(calc(var(--bt-location-viewport-height, 100dvh) - 32px), 760px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
    transform: translateY(22px) scale(0.985);
    opacity: 0;
    transition: transform 180ms ease, opacity 180ms ease;
}

.bt-location-picker.is-open .bt-location-picker-sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.bt-location-picker-handle {
    display: block;
    width: 52px;
    height: 5px;
    margin: 0 auto 13px;
    border-radius: 999px;
    background: #d4d5da;
}

.bt-location-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.bt-location-picker-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--bt-location-orange-dark);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.bt-location-picker-header h2 {
    margin: 0;
    color: var(--bt-location-ink);
    font-size: clamp(1.55rem, 5.6vw, 2rem);
    line-height: 1.04;
    letter-spacing: -0.045em;
}

.bt-location-picker-close {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border: 1px solid #ececf0;
    border-radius: 50%;
    background: #fff;
    color: #1b1b1d;
    font-size: 1.05rem;
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.07);
}

.bt-location-picker-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 10px;
    align-items: stretch;
}

.bt-location-picker-search {
    min-width: 0;
    height: 56px;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
    padding: 0 10px 0 17px;
    border: 1.5px solid #e1e2e7;
    border-radius: 19px;
    background: #fff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.bt-location-picker-search:focus-within {
    border-color: rgba(255, 104, 31, 0.72);
    box-shadow: 0 0 0 4px rgba(255, 104, 31, 0.10);
}

.bt-location-picker-search > i {
    color: #858794;
    font-size: 1rem;
}

.bt-location-picker-search input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #171719;
    font: inherit;
    font-size: 0.98rem;
}

.bt-location-picker-search input::placeholder {
    color: #8c8e98;
    opacity: 1;
}

.bt-location-picker-clear {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f2f2f5;
    color: #646670;
}

.bt-location-picker-current {
    width: 54px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(145deg, #ff7b38, var(--bt-location-orange));
    color: #fff;
    font-size: 1.18rem;
    box-shadow: 0 10px 22px rgba(255, 104, 31, 0.28);
}

.bt-location-picker-current.is-loading i {
    animation: bt-location-spin 0.75s linear infinite;
}

@keyframes bt-location-spin {
    to { transform: rotate(360deg); }
}

.bt-location-picker-helper {
    margin: 10px 3px 0;
    color: #7c7e87;
    font-size: 0.79rem;
    line-height: 1.4;
}

.bt-location-picker-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 13px;
    background: #fff3ed;
    color: #9b4017;
    font-size: 0.82rem;
    font-weight: 700;
}

.bt-location-picker-local-results,
.bt-location-picker-recents {
    margin-top: 15px;
    overflow: hidden;
    border: 1px solid var(--bt-location-line);
    border-radius: 18px;
    background: #fff;
}

.bt-location-picker-section-title {
    padding: 12px 16px 7px;
    color: #858791;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.bt-location-picker-result,
.bt-location-picker-recent {
    width: 100%;
    min-height: 53px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    gap: 10px;
    align-items: center;
    padding: 10px 15px;
    border: 0;
    border-top: 1px solid #f0f0f3;
    background: #fff;
    color: #1d1d20;
    text-align: left;
}

.bt-location-picker-result:first-child,
.bt-location-picker-recent:first-child {
    border-top: 0;
}

.bt-location-picker-result-icon,
.bt-location-picker-recent-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #fff1ea;
    color: var(--bt-location-orange);
}

.bt-location-picker-result strong,
.bt-location-picker-recent strong {
    display: block;
    overflow: hidden;
    color: #1b1b1e;
    font-size: 0.93rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-location-picker-result small,
.bt-location-picker-recent small {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #83858d;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-location-picker-result > i,
.bt-location-picker-recent > i {
    color: #a0a1a8;
    font-size: 0.75rem;
}

.bt-location-picker-map-toggle {
    width: 100%;
    min-height: 63px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    gap: 12px;
    align-items: center;
    margin-top: 15px;
    padding: 10px 14px;
    border: 1px solid var(--bt-location-line);
    border-radius: 18px;
    background: #fff;
    color: #1c1c1e;
    text-align: left;
}

.bt-location-picker-map-toggle-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #f4f4f6;
    color: #222326;
}

.bt-location-picker-map-toggle strong,
.bt-location-picker-map-toggle small {
    display: block;
}

.bt-location-picker-map-toggle strong {
    font-size: 0.92rem;
}

.bt-location-picker-map-toggle small {
    margin-top: 2px;
    color: #85868e;
    font-size: 0.75rem;
}

.bt-location-picker-map-toggle > i {
    color: #92939a;
    font-size: 0.78rem;
    transition: transform 160ms ease;
}

.bt-location-picker-map-toggle.is-open > i {
    transform: rotate(90deg);
}

.bt-location-picker-map-panel {
    position: relative;
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid #e1e2e6;
    border-radius: 20px;
    background: #f1f2f4;
}

.bt-location-picker-map {
    width: 100%;
    height: 260px;
}

.bt-location-picker-center-pin {
    position: absolute;
    top: 130px;
    left: 50%;
    z-index: 2;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 4px solid #fff;
    border-radius: 50% 50% 50% 12px;
    background: var(--bt-location-orange);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
    transform: translate(-50%, -100%) rotate(-45deg);
    pointer-events: none;
}

.bt-location-picker-center-pin i {
    transform: rotate(45deg);
}

.bt-location-picker-map-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 13px;
    background: #fff;
}

.bt-location-picker-map-footer strong,
.bt-location-picker-map-footer small {
    display: block;
}

.bt-location-picker-map-footer strong {
    overflow: hidden;
    color: #1c1c1f;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-location-picker-map-footer small {
    margin-top: 2px;
    color: #85868f;
    font-size: 0.72rem;
}

.bt-location-picker-map-footer button {
    min-height: 42px;
    padding: 0 17px;
    border: 0;
    border-radius: 13px;
    background: var(--bt-location-orange);
    color: #fff;
    font-weight: 850;
}

.bt-location-picker-toast {
    position: fixed;
    left: 50%;
    bottom: calc(22px + env(safe-area-inset-bottom));
    z-index: 1800;
    width: min(calc(100% - 32px), 440px);
    padding: 14px 16px;
    border-left: 4px solid #2eb85c;
    border-radius: 17px;
    background: #fff;
    color: #1b1b1d;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.23);
    transform: translateX(-50%);
}

.bt-location-picker-toast i {
    margin-right: 8px;
    color: #2eb85c;
}

body.bt-location-picker-open {
    overflow: hidden;
}

/* Google Places dropdown must stay above the bottom sheet. */
.pac-container {
    z-index: 1750 !important;
    margin-top: 6px;
    border: 1px solid #e5e5e8;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    font-family: inherit;
}

.pac-item {
    min-height: 47px;
    padding: 9px 12px;
    border-top-color: #f0f0f2;
    color: #777983;
    font-size: 0.78rem;
    line-height: 1.35;
    cursor: pointer;
}

.pac-item:hover,
.pac-item-selected {
    background: #fff4ee;
}

.pac-item-query {
    color: #1c1c1e;
    font-size: 0.91rem;
    font-weight: 750;
}


/*
 * Mobile keyboard protection.
 * Android browsers resize the visual viewport while leaving fixed overlays
 * attached to the larger layout viewport. JavaScript updates the variables
 * below so the sheet always remains above the on-screen keyboard.
 */
@media (max-width: 699px) {
    .bt-location-picker.is-keyboard-open {
        padding: 7px;
    }

    .bt-location-picker.is-keyboard-open .bt-location-picker-sheet {
        max-height: calc(var(--bt-location-viewport-height, 100dvh) - 14px);
        padding-top: 9px;
        padding-bottom: 12px;
        border-radius: 24px 24px 18px 18px;
    }

    .bt-location-picker.is-keyboard-open .bt-location-picker-handle {
        margin-bottom: 8px;
    }

    .bt-location-picker.is-keyboard-open .bt-location-picker-header {
        margin-bottom: 12px;
    }

    .bt-location-picker.is-keyboard-open .bt-location-picker-header h2 {
        font-size: 1.45rem;
    }

    .bt-location-picker.is-keyboard-open .bt-location-picker-helper {
        margin-top: 7px;
    }

    .bt-location-picker.is-keyboard-open .bt-location-picker-map-toggle {
        margin-top: 11px;
    }
}

@media (min-width: 700px) {
    .bt-location-picker {
        align-items: center;
    }

    .bt-location-picker-sheet {
        border-radius: 30px;
    }
}

@media (max-width: 420px) {
    .bt-location-picker {
        padding: 7px;
    }

    .bt-location-picker-sheet {
        width: 100%;
        padding-right: 15px;
        padding-left: 15px;
        border-radius: 26px 26px 22px 22px;
    }

    .bt-location-picker-search-row {
        grid-template-columns: minmax(0, 1fr) 52px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bt-location-picker-sheet,
    .bt-location-picker-map-toggle > i {
        transition: none;
    }
}

/* Make the existing ByTowns location row feel like one clear action. */
.bt-search-location-text {
    width: 100%;
    justify-self: stretch;
    justify-content: flex-start;
    text-align: left;
}

.bt-search-location-text [data-search-location-label] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-search-location-chevron {
    margin-left: auto;
    color: #a5a6ad;
    font-size: 0.75rem;
}

.bt-filter-location-v15 {
    text-align: left;
}

.bt-filter-location-v15 [data-results-location-label] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-results-location-chevron {
    margin-left: auto;
    color: #a5a6ad;
    font-size: 0.75rem;
}
