/**
 * Locator page styles. Everything that reaches outside the module's own
 * markup is anchored on #module-noi_store_locator-map - the id the core puts
 * on the body of this page and only this page (ModuleFrontController sets
 * page_name to module-<module>-<controller>, the theme layout renders it as
 * the body id). That is what lets the map take the full width of the window
 * without touching the theme and without any other page of the shop moving
 * by a single pixel.
 */

/**
 * The locator stays inside the theme's own content width instead of breaking
 * out of it. Two earlier attempts are worth remembering: widening the theme
 * containers by id also reshaped the navigation bar, because the header is
 * built from the same `.container` and `.row` classes, and pulling the
 * section out with negative margins left the panel clipped on one side and
 * the map running past the other. Nothing here touches a shared layout class.
 */

#module-noi_store_locator-map #main {
    margin: 0;
}

#module-noi_store_locator-map #left-column,
#module-noi_store_locator-map #right-column {
    display: none;
}

/**
 * The breadcrumb above the scene. Left alone it is a bare bold sentence
 * hanging over the map, so it gets the treatment the rest of the page has:
 * quiet, spaced, in the ink colour, with the current page picked out in the
 * brand pink. Scoped to this page like everything else here.
 */
#module-noi_store_locator-map .breadcrumb {
    background: transparent;
    margin: 0;
    padding: 1.1rem 0 0.9rem;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8b8190;
}

#module-noi_store_locator-map .breadcrumb ol,
#module-noi_store_locator-map .breadcrumb ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

#module-noi_store_locator-map .breadcrumb li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

#module-noi_store_locator-map .breadcrumb li + li::before {
    content: "/";
    color: #cbbfd0;
}

#module-noi_store_locator-map .breadcrumb a {
    color: #8b8190;
    text-decoration: none;
    font-weight: normal;
}

#module-noi_store_locator-map .breadcrumb a:hover {
    color: #ff00ff;
}

/**
 * The last crumb is the current page and is picked out - but only when there
 * is more than one, because this page's trail holds just the shop home and
 * marking that as "you are here" would be a lie.
 */
#module-noi_store_locator-map .breadcrumb li:last-child:not(:first-child),
#module-noi_store_locator-map .breadcrumb li:last-child:not(:first-child) span {
    color: #ff00ff;
    font-weight: bold;
}


.noi-locator {
    --noi-magenta: #ff00ff;
    --noi-pink: #ffbedc;
    --noi-pink-light: #f6ecf4;
    --noi-cream: #f8f8dc;
    --noi-mint: #b2f7e9;
    --noi-blue: #cff5f9;
    --noi-ink: #333333;
    --noi-muted: #5f5661;
    --noi-line: #efe6ee;
    --noi-panel-width: 380px;
    --noi-stage-offset: 18vh;

    display: block;
    width: 100%;
    color: var(--noi-ink);
}

.noi-locator-fallback {
    max-width: 720px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.noi-locator-error {
    background: var(--noi-pink-light);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    font-size: 1.1rem;
}

/* Scene: the map is the page, everything else floats above it. */

.noi-locator-stage {
    position: relative;
    width: 100%;
    height: 76vh;
    height: min(76vh, calc(100dvh - var(--noi-stage-offset)));
    min-height: 520px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 34px rgba(80, 30, 80, 0.12);
    margin-bottom: 2rem;
}

.noi-locator-map {
    position: absolute;
    inset: 0;
    background: var(--noi-cream);
}

/**
 * Only the tile layer is toned down, never the whole map: the pins, the
 * clusters and the popups sit in their own panes above it and have to keep
 * the full strength of the brand colours. Muting the map itself is what
 * makes a magenta pin readable against it.
 */
.noi-locator .leaflet-tile-pane {
    filter: saturate(0.45) brightness(1.06);
}

.noi-locator .leaflet-control-zoom a {
    color: var(--noi-ink);
}

/**
 * Both of these sit above Leaflet's own furniture. Leaflet puts its control
 * corners at z-index 1000 and its marker pane at 600, so anything below that
 * ends up underneath the zoom buttons and the attribution - which on a narrow
 * screen, where the panel reaches the bottom edge, meant the attribution
 * printed straight across the panel's own buttons.
 */
.noi-locator-area {
    position: absolute;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    border: none;
    border-radius: 22px;
    background: #ffffff;
    color: var(--noi-ink);
    font-weight: bold;
    font-size: 0.9rem;
    padding: 0.6rem 1.3rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(70, 30, 70, 0.2);
}

.noi-locator-area.is-on {
    background: var(--noi-magenta);
    color: #ffffff;
}

/* Panel floating over the map. */

.noi-locator-panel {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    bottom: 1.25rem;
    z-index: 1100;
    width: var(--noi-panel-width);
    max-width: calc(100% - 2.5rem);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(80, 30, 80, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.noi-locator-panel-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.noi-locator-panel-head {
    background: var(--noi-pink-light);
    padding: 1.15rem 1.25rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.noi-locator-title {
    color: var(--noi-magenta);
    font-size: 1.45rem;
    font-weight: bold;
    line-height: 1.05;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.noi-locator-subtitle {
    color: var(--noi-muted);
    font-size: 0.85rem;
    margin: 0;
}

.noi-locator-search {
    position: relative;
    display: flex;
    align-items: center;
}

.noi-locator-icon {
    width: 16px;
    height: 16px;
    flex: none;
}

.noi-locator-search .noi-locator-icon {
    position: absolute;
    left: 1rem;
    color: var(--noi-magenta);
    pointer-events: none;
}

.noi-locator-search input {
    width: 100%;
    height: 46px;
    border-radius: 23px;
    border: 2px solid var(--noi-pink);
    background: #ffffff;
    padding: 0 1.1rem 0 2.6rem;
    font-size: 0.95rem;
    color: var(--noi-ink);
    box-sizing: border-box;
}

.noi-locator-filters {
    display: flex;
    gap: 0.5rem;
}

/**
 * The two filters are built to match the search field above them rather than
 * whatever the browser ships: same height, same rounding, same border, and
 * the type family inherited from the shop instead of the system default. The
 * native arrow is replaced with one drawn in the brand pink, which is the
 * only part of a closed select a page can really control.
 */
.noi-locator-filters select {
    flex: 1;
    min-width: 0;
    height: 46px;
    border-radius: 23px;
    border: 2px solid var(--noi-pink);
    background-color: #ffffff;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff00ff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9 L12 15 L18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 14px 14px;
    padding: 0 2.4rem 0 1.1rem;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--noi-ink);
    box-sizing: border-box;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-overflow: ellipsis;
}

.noi-locator-filters select:hover {
    border-color: var(--noi-magenta);
}

/**
 * The open list is drawn by the operating system, so a page can set little
 * more than these two colours - and on some systems not even those. It is
 * worth setting anyway: where it works, the list stops being stark white with
 * a grey highlight and picks up the palette of the page.
 */
.noi-locator-filters select option {
    background-color: #ffffff;
    color: var(--noi-ink);
    padding: 0.4rem 0.6rem;
}

.noi-locator-filters select option:checked {
    background-color: var(--noi-pink);
    color: var(--noi-ink);
}

.noi-locator-button {
    height: 46px;
    border-radius: 23px;
    border: none;
    background: var(--noi-magenta);
    color: #ffffff;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.noi-locator-button:hover {
    background: #d900d9;
}

.noi-locator-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.noi-locator-button.is-quiet {
    background: transparent;
    border: 2px solid var(--noi-magenta);
    color: var(--noi-magenta);
    height: 38px;
}

.noi-locator-button.is-quiet:hover {
    background: var(--noi-pink);
}

.noi-locator-status {
    min-height: 1.1rem;
    font-size: 0.82rem;
    color: var(--noi-muted);
    text-align: center;
    margin: 0;
    padding: 0.5rem 1.25rem 0;
}

.noi-locator-status:empty {
    display: none;
}

.noi-locator-resultbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid var(--noi-line);
    font-size: 0.8rem;
    color: var(--noi-muted);
}

.noi-locator-context {
    color: var(--noi-ink);
    font-weight: bold;
}

.noi-locator-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.noi-locator-item {
    background: var(--noi-cream);
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 0.8rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.noi-locator-item:hover {
    border-color: var(--noi-pink);
}

.noi-locator-item.is-active {
    background: var(--noi-pink);
    border-color: var(--noi-magenta);
}

.noi-locator-item-name {
    font-weight: bold;
    font-size: 0.98rem;
    margin: 0;
    color: var(--noi-ink);
}

.noi-locator-item-address {
    font-size: 0.82rem;
    margin: 0;
    color: var(--noi-muted);
}

.noi-locator-item-meta {
    font-size: 0.8rem;
    margin: 0;
    color: var(--noi-muted);
}

.noi-locator-item-meta a {
    color: var(--noi-magenta);
    text-decoration: none;
}

.noi-locator-item-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.noi-locator-item-distance {
    font-size: 0.75rem;
    color: #ffffff;
    background: var(--noi-magenta);
    border-radius: 12px;
    padding: 0.1rem 0.55rem;
    font-variant-numeric: tabular-nums;
}

.noi-locator-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--noi-magenta);
    border: 1.5px solid var(--noi-magenta);
    border-radius: 12px;
    padding: 0.1rem 0.55rem;
    text-decoration: none;
}

.noi-locator-action:hover {
    background: var(--noi-magenta);
    color: #ffffff;
}

.noi-locator-item-note {
    font-size: 0.72rem;
    color: var(--noi-muted);
    font-style: italic;
}

.noi-locator-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--noi-muted);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    align-items: center;
}

.noi-locator-empty-title {
    font-weight: bold;
    color: var(--noi-ink);
    font-size: 0.95rem;
}

.noi-locator-empty-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.noi-locator-more {
    border: 2px dashed var(--noi-pink);
    border-radius: 14px;
    padding: 0.7rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--noi-muted);
    background: transparent;
    cursor: pointer;
    width: 100%;
}

.noi-locator-sentinel {
    height: 1px;
}

/* Map furniture kept in the brand colours. */

.noi-locator-marker-icon {
    background: var(--noi-magenta);
    border: 3px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    width: 24px;
    height: 24px;
    transform: rotate(-45deg);
}

.noi-locator-marker-icon.is-active {
    box-shadow: 0 0 0 8px rgba(255, 0, 255, 0.18), 0 3px 10px rgba(0, 0, 0, 0.3);
}

.noi-locator .marker-cluster,
.noi-locator .marker-cluster-small,
.noi-locator .marker-cluster-medium,
.noi-locator .marker-cluster-large {
    background-color: rgba(255, 190, 220, 0.55);
    border-radius: 50%;
}

.noi-locator .marker-cluster div,
.noi-locator .marker-cluster-small div,
.noi-locator .marker-cluster-medium div,
.noi-locator .marker-cluster-large div {
    background-color: var(--noi-magenta);
    color: #ffffff;
    border-radius: 50%;
    font-family: inherit;
    font-weight: bold;
}

.noi-locator .leaflet-popup-content-wrapper {
    border-radius: 14px;
    background: var(--noi-cream);
    color: var(--noi-ink);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.noi-locator .leaflet-popup-tip {
    background: var(--noi-cream);
}

.noi-locator .leaflet-popup-content {
    font-size: 0.9rem;
    line-height: 1.4;
}

.noi-locator .leaflet-popup-content a {
    color: var(--noi-magenta);
    text-decoration: none;
}

.noi-locator .leaflet-popup-close-button {
    color: var(--noi-ink);
}

/* Keyboard users have to see where they are. */

.noi-locator-item:focus-visible,
.noi-locator-button:focus-visible,
.noi-locator-area:focus-visible,
.noi-locator-more:focus-visible,
.noi-locator-action:focus-visible,
.noi-locator-grabber:focus-visible,
.noi-locator-search input:focus-visible,
.noi-locator-filters select:focus-visible {
    outline: 3px solid var(--noi-magenta);
    outline-offset: 2px;
}

.noi-locator-search input:focus,
.noi-locator-filters select:focus {
    outline: none;
    border-color: var(--noi-magenta);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* The grabber belongs to the phone sheet and has no job on a wide screen. */

.noi-locator-grabber {
    display: none;
}

/**
 * Phone: the map takes the whole screen and the panel becomes a sheet pulled
 * up from the bottom. Three heights, switched by class - peek on arrival,
 * half while browsing the list, full when reading it. The height is written
 * twice on purpose: a browser that does not know dvh keeps the vh rule, and
 * one that does uses the second and stops jumping when the address bar of
 * the browser slides away.
 */

@media (max-width: 900px) {
    /**
     * The scene fills what is left of the screen below the shop header, not
     * the whole screen: taking the full height here would push the page
     * exactly one header taller than the phone and leave the customer
     * scrolling to see the bottom of the map. The offset is measured by
     * locator.js, because this theme changes header height between layouts.
     */
    .noi-locator-stage {
        height: calc(100vh - var(--noi-stage-offset));
        height: calc(100dvh - var(--noi-stage-offset));
        min-height: 420px;
    }

    .noi-locator-area {
        top: 0.75rem;
        font-size: 0.78rem;
        padding: 0.45rem 0.9rem;
        white-space: nowrap;
        max-width: calc(100% - 1.5rem);
    }

    /**
     * The attribution belongs to the map provider and has to stay readable,
     * so it is lifted above the sheet in its resting height instead of being
     * buried under it. The zoom buttons move with it for the same reason.
     */
    .noi-locator .leaflet-bottom {
        bottom: calc(30dvh + 0.4rem);
    }

    .noi-locator .leaflet-top {
        top: 3.4rem;
    }

    .noi-locator-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        border-radius: 22px 22px 0 0;
        background: #ffffff;
        box-shadow: 0 -8px 30px rgba(70, 30, 70, 0.22);
        transition: height 0.25s ease;
        touch-action: none;
    }

    .noi-locator-panel.is-peek {
        height: 30vh;
        height: 30dvh;
    }

    .noi-locator-panel.is-half {
        height: 55vh;
        height: 55dvh;
    }

    .noi-locator-panel.is-full {
        height: 90vh;
        height: 90dvh;
    }

    .noi-locator-grabber {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 26px;
        border: none;
        background: transparent;
        cursor: grab;
        flex: none;
        padding: 0;
        touch-action: none;
    }

    .noi-locator-grabber-bar {
        width: 44px;
        height: 5px;
        border-radius: 3px;
        background: var(--noi-pink);
        display: block;
    }

    .noi-locator-panel-body {
        touch-action: auto;
    }

    .noi-locator-panel-head {
        padding: 0.5rem 1rem 0.8rem;
    }

    .noi-locator-title {
        font-size: 1.15rem;
    }

    .noi-locator-subtitle {
        display: none;
    }

    .noi-locator-list {
        padding: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .noi-locator-panel,
    .noi-locator-item,
    .noi-locator-button {
        transition: none;
    }
}
