/* The --brand-* tokens are declared once in brand.css and driven by the brand's Theme
   document; they are NOT redefined here. Only page-local tokens live below. */
:root {
    /* Chained through the brand tokens — same values --brand-text / --brand-border default to, so
       this is pixel-identical until a brand sets TextColor / BorderColor. See menu.css. */
    --text: var(--brand-text, #1a1a1a);
    --muted: #6b6b6b;
    --border: var(--brand-border, #E5E7EB);
    --bg-soft: #F4F4F5;
    --header-h: 72px;
    --sidebar-w: 390px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: #fff;
}

button { font-family: inherit; cursor: pointer; }

/* -------- Page layout -------- */
.loc-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.loc-header {
    height: var(--header-h);
    padding: 0 28px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}

.loc-logo {
    display: inline-flex;
    align-items: center;
    height: 100%;
}

/* Theme.HeaderLogoHeight IS the logo's height (matches the store-page header, .menu-brand img). The
   only ceiling is the header row itself: max-height ties to --header-h, which drops to 52px on
   phones, so the logo always fits the current bar without a hardcoded per-breakpoint cap. Unset, it
   falls back to 36px. width:auto + max-width + object-fit:contain keep the aspect ratio and never
   crop or stretch; object-position pins it left. */
.loc-logo img {
    height: var(--brand-header-logo-height, 36px);
    max-height: calc(var(--header-h) - 12px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
}

.loc-shell {
    flex: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 0;
}

/* -------- Sidebar -------- */
.loc-sidebar {
    border-right: 1px solid #d4d4d8;
/*    box-shadow: 4px 0 14px rgba(0, 0, 0, 0.06);*/
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 2;
}

.loc-tabs {
    flex-shrink: 0;
    margin: 20px 18px 14px;
    background: var(--bg-soft);
    border-radius: 999px;
    padding: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* Body holds the active panel + loader overlay. Only the inner list scrolls. */
.loc-sidebar-body {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.loc-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.loc-panel[hidden] { display: none; }

.loc-panel-head {
    flex-shrink: 0;
    padding: 4px 18px 12px;
}

.loc-tab {
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease;
}

.loc-tab.is-active {
    background: var(--brand-red);
    color: var(--brand-secondary, #fff);
    box-shadow: 0 2px 6px rgba(226, 27, 34, 0.25);
}

.loc-heading {
    margin: 0 0 14px 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.loc-label {
    display: block;
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Wrap that anchors the autocomplete dropdown to the search box */
.loc-search-wrap {
    position: relative;
    margin-bottom: 14px;
}

/* Search input shell (used for both Pickup search and Delivery address) */
.loc-search {
    position: relative;
}

/* ---------- Place autocomplete dropdown ---------- */
.loc-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}

.loc-suggest[hidden] { display: none; }

.loc-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    background: #fff;
    transition: background 0.12s ease;
}

.loc-suggest-item:last-child { border-bottom: 0; }
.loc-suggest-item:hover,
.loc-suggest-item.is-active { background: #fafafa; }

.loc-suggest-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.loc-suggest-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loc-suggest-region {
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loc-suggest-chev {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #9a9a9a;
}

.loc-suggest-empty {
    padding: 14px;
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: center;
}

.loc-suggest-loading {
    padding: 14px;
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: center;
}

.loc-search input {
    width: 100%;
    height: 46px;
    padding: 0 44px 0 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--text);
    background: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.loc-search input::placeholder { color: #9a9a9a; }

.loc-search input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(226, 27, 34, 0.12);
}

.loc-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #6b6b6b;
    pointer-events: none;
}

.loc-locate {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b6b6b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loc-locate:hover { background: var(--bg-soft); color: var(--brand-red); }
.loc-locate.is-active { color: var(--brand-red); }
.loc-locate svg { width: 18px; height: 18px; }

.loc-search-clear {
    position: absolute;
    right: 46px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-soft);
    color: #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.loc-search-clear:hover { background: #e5e7eb; color: #000; }
.loc-search-clear svg { width: 14px; height: 14px; }

.loc-search.is-locked input {
    color: #1a1a1a;
    font-weight: 500;
}

.loc-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: -4px 2px 14px;
    padding: 10px 12px;
    background: #fff1f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 0.8125rem;
    color: var(--brand-danger, #b91c1c);
    line-height: 1.4;
}

.loc-error-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    color: var(--brand-danger, #b91c1c);
}

/* Help text under the search input — guides the user on what to type */
.loc-help {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: -4px 2px 14px;
    padding: 0;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
}

.loc-help-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-top: 1px;
    color: var(--muted);
}

.loc-help[hidden] { display: none; }

.loc-count strong {
    font-weight: 700;
    color: var(--text);
}

.loc-count {
    margin: 6px 2px 14px;
    font-size: 0.8125rem;
    color: var(--muted);
    font-weight: 500;
}

.loc-hint {
    margin: 6px 2px 0;
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Store list — only this section scrolls inside the sidebar */
.loc-stores {
    list-style: none;
    margin: 0;
    padding: 0 18px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
}

/* Custom scrollbar for webkit */
.loc-stores::-webkit-scrollbar { width: 8px; }
.loc-stores::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 4px; }
.loc-stores::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

.loc-store {
    padding: 16px 4px 18px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: #fff;
    transition: background 0.18s ease;
}

.loc-store:last-child { border-bottom: 0; }

.loc-store:hover { background: #fafafa; }

.loc-store.is-selected {
    background: var(--brand-red-soft);
    border-bottom-color: var(--brand-red);
}

/* Matched store(s) — highlighted at the top of the list when search is active.
   Pink background, distance badge, slightly stronger styling. */
.loc-store.is-matched {
    background: var(--brand-red-soft);
    border-bottom: 0;
    padding: 16px 14px 18px;
    margin: 0 -14px 5px;
    border-radius: 8px;
}

.loc-store.is-matched + .loc-stores-toggle {
    margin-top: 12px;
}

/* "See all stores" toggle pill inside the list */
.loc-stores-toggle {
    list-style: none;
    padding: 0;
    margin: 8px 0 14px;
}

.loc-stores-toggle-btn {
    width: 100%;
    height: 48px;
    padding: 0 18px;
    border: 1px solid #1a1a1a;
    border-radius: 999px;
    background: #fff;
    color: #1a1a1a;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
}

.loc-stores-toggle-btn:hover { background: #fafafa; }

.loc-stores-toggle-chev {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.loc-stores-toggle.is-open .loc-stores-toggle-chev {
    transform: rotate(180deg);
}

/* Hide the older "See all stores" reset link — replaced by the in-list toggle */
#seeAllStores { display: none !important; }

.loc-store.is-selected {
    background: var(--brand-red-soft);
}

.loc-store-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.loc-store-name {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.loc-store-distance {
    flex-shrink: 0;
    align-self: flex-start;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* Status + timing block for the selected order type. */
.loc-store-statewrap {
    display: flex;
    margin: 4px 0 8px 0;
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 7px;
    align-items:baseline;
}

.loc-store-state {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #d97706;
}
/* Status colours (driven by the is-open / is-schedule / is-closed modifier). */
.loc-store-state.is-open     { color: #16a34a; }
.loc-store-state.is-schedule { color: #2563eb; }
.loc-store-state.is-closed   { color: #d97706; }

/* "Store Timing : 11:00 PM - 11:15 AM" — secondary line under the status. */
.loc-store-timing {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.loc-store-addr {
    margin: 0 0 8px 0;
    font-size: 0.6875rem;            /* reduced from 13px per request (smaller address) */
    color: var(--muted);
    line-height: 1.4;
    /* Keep the full address on a single line; clip the overflow with an ellipsis
       instead of wrapping (the full text is available via the title tooltip). */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loc-store-phone {
    margin: 0 0 4px 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

/* Order-type availability row: a wrap of small "[icon] Label" chips, the icon a
   rounded square that's green w/ a check when enabled, red w/ an ✕ when not. */
.loc-store-types {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0 0 12px 0;
}
.loc-store-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.loc-store-type-ico {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.loc-store-type-ico svg { width: 11px; height: 11px; display: block; }
.loc-store-type.is-on  .loc-store-type-ico { background: #16a34a; }
.loc-store-type.is-off .loc-store-type-ico { background: var(--brand-danger, #b91c1c); }
.loc-store-type.is-off .loc-store-type-label { color: var(--muted); }

.loc-order-btn {
    display: inline-block;
    height: 36px;
    line-height: 2.25rem;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--brand-button, var(--brand-red));
    color: var(--brand-secondary, #fff);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.loc-order-btn:hover { background: var(--brand-red-dark); color: var(--brand-secondary, #fff); }

.loc-order-btn.is-disabled,
.loc-order-btn[aria-disabled="true"] {
    background: #d4d4d8;
    color: #6b6b6b;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.85;
}

.loc-store-status {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: #f4f4f5;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* "See all stores" reset link — appears when search/filter/location mode is active */
.loc-see-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: -4px 2px 12px;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: var(--brand-link, var(--brand-red));
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.loc-see-all:hover { text-decoration: underline; }

.loc-see-all[hidden] { display: none; }

.loc-see-all svg { width: 14px; height: 14px; }

/* Language select pinned at bottom */
.loc-lang {
    border-top: 1px solid var(--border);
    padding: 12px 18px;
    background: #fff;
    flex-shrink: 0;
}

.loc-lang-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
}

.loc-lang-icon {
    width: 16px;
    height: 16px;
    color: #6b6b6b;
    margin-right: 8px;
}

.loc-lang-wrap select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    outline: none;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    padding-right: 18px;
    cursor: pointer;
}

.loc-lang-chev {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid #6b6b6b;
    border-bottom: 2px solid #6b6b6b;
    transform: translateY(-75%) rotate(45deg);
    pointer-events: none;
}

/* -------- Map -------- */
.loc-map-wrap {
    position: relative;
    min-height: 0;
    background: #0a1d3e;
}

.loc-map {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* CSS custom properties updated by stores.js whenever the map moves/zooms.
   `--globe-cx`/`--globe-cy` track the globe centre in pixels, `--globe-r`
   tracks the globe's screen radius. Defaults are a sensible fallback for
   first paint before JS runs. */
.loc-map-wrap {
    --globe-cx: 50%;
    --globe-cy: 50%;
    --globe-r: 350px;
}

/* Outer glow / shadow that radiates from the globe's edge into space.
   Tightened spread: gradient size = globe-r × 1.18, so the halo fades out
   ~18% beyond the globe edge instead of spilling far into space. */
.loc-map-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: radial-gradient(
        circle calc(var(--globe-r) * 1.18) at var(--globe-cx) var(--globe-cy),
        transparent 0%,
        transparent 81%,                         /* inside globe — fully clear */
        rgba(200, 230, 255, 0.75) 85%,           /* bright peak flush at edge */
        rgba(160, 205, 250, 0.45) 91%,
        rgba(110, 165, 230, 0.18) 96%,
        transparent 100%
    );
}

/* Starfield overlay — stars only show OUTSIDE the globe. The mask is
   anchored to the globe's actual position so it follows pans/zooms. */
.loc-map-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    mix-blend-mode: screen;
    -webkit-mask-image: radial-gradient(circle calc(var(--globe-r) * 1.45) at var(--globe-cx) var(--globe-cy), transparent 0%, transparent 72%, #000 80%);
            mask-image: radial-gradient(circle calc(var(--globe-r) * 1.45) at var(--globe-cx) var(--globe-cy), transparent 0%, transparent 72%, #000 80%);
    background-color: transparent;
    background-image:
        radial-gradient(1px 1px at 17px 26px,   #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 53px 94px,   #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 108px 45px,  #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 160px 16px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 202px 74px,  #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 236px 134px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 32px 169px,  #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 76px 217px,  #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 121px 182px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 180px 244px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 220px 199px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 274px 64px,  #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 326px 114px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 365px 29px,  #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 295px 224px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 96px 294px,  #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 250px 314px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 385px 284px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 145px 354px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 55px 384px,  #fff 50%, transparent 51%);
    background-repeat: repeat;
    background-size: 400px 400px;
    background-position: var(--star-shift-x, 0px) var(--star-shift-y, 0px);
    transition: background-position 0.4s ease-out;
}

.loc-map-empty {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loc-map-empty svg {
    width: 240px;
    height: auto;
    opacity: 0.85;
}

/* Brand pin marker (MapLibre positions via anchor; no extra transform needed).
   The box matches the 40×56 viewBox of the shared pin in PTBrand.marker, so the SVG fills it
   exactly instead of being letterboxed inside a differently-proportioned frame. */
.pt-pin {
    width: 30px;
    height: 42px;
    cursor: pointer;
}

.pt-pin svg { width: 100%; height: 100%; display: block; }

.pt-pin.is-selected {
    width: 36px;
    height: 36px;
}

/* Hand cursor for panning, fist while dragging — MapLibre canvas */
.maplibregl-canvas-container,
.maplibregl-canvas {
    cursor: grab !important;
}

.maplibregl-canvas-container.maplibregl-interactive:active,
.maplibregl-canvas:active {
    cursor: grabbing !important;
}

/* Markers should stay click-cursor even though canvas is grab */
.maplibregl-marker { cursor: pointer !important; }

/* MapLibre control polish */
.maplibregl-ctrl-group {
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.maplibregl-ctrl-attrib.maplibregl-compact {
    background: rgba(255, 255, 255, 0.85) !important;
}

.pt-store-tile {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--brand-red);
    color: var(--brand-secondary, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* The glow tints with the brand rather than staying red under, say, a green primary.
       color-mix keeps one source of truth; the rgba() fallback is the shipped red. */
    box-shadow: 0 4px 10px rgba(226, 27, 34, 0.35);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--brand-primary) 35%, transparent);
}

.pt-store-tile svg { width: 20px; height: 20px; }

/* "You-are-here" marker — bright blue dot + pulsing halo */
.pt-user-pin {
    position: relative;
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.pt-user-dot {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #1d7af3;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(29, 122, 243, 0.6);
}

.pt-user-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(29, 122, 243, 0.35);
    animation: pt-user-pulse 1.8s ease-out infinite;
}

@keyframes pt-user-pulse {
    0%   { transform: scale(0.5); opacity: 0.9; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Loader — covers ONLY the outlet-list + search section
   inside the sidebar (not the tabs or the language dropdown) ---------- */
.loc-loader {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loc-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loc-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loc-loader-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #fde2e4;
    border-top-color: var(--brand-red);
    border-radius: 50%;
    animation: loc-spin 0.9s linear infinite;
}

.loc-loader-text {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
}

@keyframes loc-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Full-page loader — sits over the entire stores/map page until
   the Leaflet `load` event fires (tiles + style ready) ---------- */
.loc-page-loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loc-page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loc-page-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.loc-page-loader-spinner {
    width: 64px;
    height: 64px;
    border: 6px solid #fde2e4;
    border-top-color: var(--brand-red);
    border-radius: 50%;
    animation: loc-spin 0.9s linear infinite;
}

.loc-page-loader-text {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
}

/* ---------- Store-locator skeleton — fills #locPageLoader while map tiles
   stream in. Mirrors .loc-page (header + .loc-shell grid: sidebar + map) so the
   page's shape is visible instead of a bare spinner. .pt-skel lives in
   skeleton.css. ---------- */
.loc-skel-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.loc-skel-header {
    height: var(--header-h);
    flex-shrink: 0;
    padding: 0 28px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.loc-skel-logo { width: 120px; height: 34px; border-radius: 6px; }

.loc-skel-shell {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
}
.loc-skel-sidebar {
    border-right: 1px solid #d4d4d8;
    background: #fff;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
}
.loc-skel-tabs   { height: 52px; border-radius: 999px; flex-shrink: 0; }
.loc-skel-search { height: 46px; border-radius: 12px; flex-shrink: 0; }
.loc-skel-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}
.loc-skel-store {
    border: 1px solid #ececf0;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.loc-skel-store .loc-skel-btn { height: 40px; border-radius: 999px; margin-top: 4px; }

.loc-skel-map {
    background: #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loc-skel-map-pin { width: 64px; height: 64px; border-radius: 50%; }

/* Match the real shell's mobile collapse: hide the map, sidebar fills. */
@media (max-width: 820px) {
    .loc-skel-shell { grid-template-columns: 1fr; }
    .loc-skel-map { display: none; }
}

/* Visually-hidden status text for screen readers (the loader is aria-busy). */
.loc-skel-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Inline spinner for "fetching your location" state on the locate button */
.loc-locate.is-loading {
    pointer-events: none;
    color: var(--brand-red);
}

.loc-locate.is-loading svg { display: none; }

.loc-locate.is-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #fde2e4;
    border-top-color: var(--brand-red);
    border-radius: 50%;
    animation: loc-spin 0.7s linear infinite;
}

/* -------- Responsive -------- */
@media (max-width: 1024px) {
    :root { --sidebar-w: 340px; }
    .loc-sidebar-scroll { padding: 16px 14px 10px; }
    .loc-header { padding: 0 18px; }
}

/* Stack on tablets / phones — KEEP the viewport locked so only the store
   list scrolls, with the map / tabs / search / count pinned at the top.
   Map height is a fraction of the viewport (with min/max bounds) so the
   list still gets meaningful real estate on short screens. */
@media (max-width: 820px) {
    .loc-page { height: 100vh; min-height: 100vh; overflow: hidden; }
    .loc-shell {
        /*grid-template-columns: 1fr;*/
        /* Map + tabs are hidden at this breakpoint, so the sidebar is the only
           remaining cell — single 1fr row lets it fill the full shell height
           instead of being stranded in the old (fixed-height) map row. */
        grid-template-rows: 1fr;
        min-height: 0;
    }
    .loc-tabs,
    .loc-map-wrap { display: none; }
    .loc-sidebar {
        border-right: 0;
        border-top: 1px solid var(--border);
        min-height: 0;
        /* No shadow at this breakpoint — overrides the base 4px 0 14px so the
           stacked, full-width sidebar sits flush. */
        box-shadow: none;
    }
    .loc-sidebar-scroll { max-height: none; }
    /* Hide the language picker on mobile — no room in the compact sidebar */
    .loc-lang { display: none; }

    /* ── Order Here button: keep it inside the card across the WHOLE stacked
       layout (tablet + phone), not just ≤560. As a full-width, border-box
       block it can never extend past the card / viewport — important because
       .loc-page is overflow:hidden here, so any horizontal overflow would clip
       the button's edge ("going out of page"). */
    .loc-order-btn {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        height: 44px;
        line-height: 2.75rem;
        padding: 0 16px;
        text-align: center;
    }
    /* Belt-and-braces: a long unbroken store name / address can't force the card
       wider than the viewport (which would then clip the full-width button). */
    .loc-store { min-width: 0; }
    .loc-store-name { overflow-wrap: anywhere; }
    .loc-stores,
    .loc-sidebar-scroll { min-width: 0; max-width: 100%; }
}

/* Phones — tune type/spacing/buttons to the touch viewport. Values use
   clamp() so they scale smoothly between 360px and 560px without extra
   breakpoints. */
@media (max-width: 560px) {
    :root {
        /* Shorter header row on phones; .loc-logo img's max-height ties to this, so the logo tracks
           it automatically without a separate logo ceiling. */
        --header-h: 52px;
        --sidebar-w: 100%;
    }

    .loc-header {
        padding: 0 clamp(12px, 4vw, 16px);
    }

    .loc-shell {
        /* Map hidden ≤820px — keep the sidebar filling a single row. */
        grid-template-rows: 1fr;
    }

    /* Pickup / Delivery tabs */
    .loc-tabs {
        margin: 12px clamp(12px, 4vw, 16px) 8px;
        padding: 3px;
    }
    .loc-tab {
        height: 38px;
        font-size: 0.8125rem;
        font-weight: 600;
    }

    /* Panel head — search + help text + count */
    .loc-panel-head {
        padding: 2px clamp(12px, 4vw, 16px) 8px;
    }
    .loc-heading {
        font-size: clamp(15px, 4.2vw, 17px);
        margin: 0 0 10px;
    }
    .loc-label { font-size: 0.8125rem; margin-bottom: 6px; }

    /* Search input — taller for touch, comfortable font that won't trigger
       iOS zoom on focus (≥16px). */
    .loc-search-wrap { margin-bottom: 10px; }
    .loc-search input {
        height: 44px;
        padding: 0 80px 0 40px;
        font-size: 1rem;
        border-radius: 10px;
    }
    .loc-search-icon { left: 12px; width: 18px; height: 18px; }
    .loc-locate {
        right: 4px;
        width: 36px;
        height: 36px;
    }
    .loc-locate svg { width: 18px; height: 18px; }
    .loc-search-clear {
        right: 44px;
        width: 26px;
        height: 26px;
    }
    .loc-search-clear svg { width: 12px; height: 12px; }

    /* Autocomplete suggestions */
    .loc-suggest { max-height: 50vh; border-radius: 10px; }
    .loc-suggest-item { padding: 11px 12px; gap: 10px; }
    .loc-suggest-name { font-size: 0.875rem; }
    .loc-suggest-region { font-size: 0.75rem; }

    /* Help / error / count rows */
    .loc-help,
    .loc-error {
        font-size: 0.6875rem;
        margin: -2px 0 10px;
        line-height: 1.35;
    }
    .loc-error { padding: 9px 10px; }
    .loc-count {
        font-size: 0.75rem;
        margin: 4px 0;
    }

    /* Store list — only this scrolls. Cards become rounded tiles. */
    .loc-stores {
        padding: 0 clamp(12px, 4vw, 16px) 20px;
        -webkit-overflow-scrolling: touch;
    }
    .loc-store {
        padding: 12px 14px 14px;
        margin-bottom: 10px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }
    .loc-store:last-child { margin-bottom: 8px; }
    .loc-store:hover { background: #fff; }
    .loc-store.is-selected {
        background: var(--brand-red-soft);
        border-color: var(--brand-red);
    }
    .loc-store.is-matched {
        padding: 12px 14px 14px;
        margin: 0 0 12px;
        border: 1px solid var(--brand-red);
        border-radius: 12px;
    }

    .loc-store-row {
        gap: 8px;
        margin-bottom: 2px;
    }
    .loc-store-name {
        font-size: 0.9375rem;
        line-height: 1.25;
        font-weight: 700;
    }
    .loc-store-distance {
        padding: 2px 7px;
        font-size: 0.6875rem;
        border-radius: 6px;
    }
    .loc-store-addr {
        font-size: 0.6875rem;
        line-height: 1.4;
        margin: 2px 0 4px;
    }
    .loc-store-phone { font-size: 0.78125rem; margin-bottom: 4px; }
    .loc-store-types {
        font-size: 0.6875rem;
        margin: 0 0 10px;
    }
    .loc-store-state {
        font-size: 0.75rem;
        margin: 0 0 8px;
    }
    .loc-store-status {
        margin-left: 6px;
        padding: 2px 7px;
        font-size: 0.625rem;
    }

    /* Order button — full width, touch-friendly 44px target */
    .loc-order-btn {
        display: block;
        width: 100%;
        height: 44px;
        line-height: 2.75rem;
        text-align: center;
        font-size: 0.875rem;
        font-weight: 600;
        padding: 0;
        border-radius: 999px;
    }

    /* "See all stores" toggle pill */
    .loc-stores-toggle { margin: 6px 0 12px; }
    .loc-stores-toggle-btn {
        height: 44px;
        padding: 0 14px;
        font-size: 0.8125rem;
    }

    /* Hide the language picker on phones so the list fills the screen */
    .loc-lang { display: none; }

    /* Page loader spinner — smaller on phones */
    .loc-page-loader-spinner { width: 52px; height: 52px; border-width: 5px; }
    .loc-page-loader-text { font-size: 0.875rem; }
    .loc-loader-spinner { width: 44px; height: 44px; border-width: 4px; }
    .loc-loader-text { font-size: 0.8125rem; }
}

/* Very small phones (iPhone SE, Android compact). Tighten spacing and drop
   font sizes one notch so cards never overflow horizontally. */
@media (max-width: 380px) {
    .loc-shell { grid-template-rows: 1fr; }

    .loc-tabs { margin: 10px 10px 6px; }
    .loc-tab { height: 30px; font-size: 0.78125rem; }

    .loc-panel-head { padding: 2px 10px 6px; }
    .loc-heading { font-size: 0.90625rem; margin-bottom: 8px; }

    .loc-search input { height: 42px; padding: 0 62px 0 36px; }
    .loc-search-icon { left: 10px; }
    .loc-locate { width: 32px; height: 32px; }
    .loc-search-clear { right: 38px; width: 24px; height: 24px; }

    .loc-stores { padding: 0 10px 16px; }
    .loc-store { padding: 10px 12px 12px; margin-bottom: 8px; }
    .loc-store.is-matched { padding: 10px 12px 12px; }
    .loc-store-name { font-size: 0.875rem; }
    .loc-store-addr {
        font-size: 0.6875rem;
    }
    .loc-store-state, .loc-store-phone { font-size: 0.75rem; }
    .loc-store-type {
        gap: 4.3px;
    }


    .loc-order-btn {
        height: 42px;
        line-height: 2.625rem;
        font-size: 0.84375rem;
    }
    .loc-stores-toggle-btn { height: 42px; font-size: 0.78125rem; }
}
