/* ================================================================
   StoreLocator.css — Store locator page (map + list views)
   All values use Momento design tokens from tokens.css
   ================================================================ */

/* ── Global base (scoped to this page) ───────────────────── */
html, body {
    height: 100%;
    width: 100%;
    overflow: auto;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
}

/* ── Background & layout ──────────────────────────────────── */
.main-background {
    background: linear-gradient(180deg, var(--color-surface-info-bg) 0%, #FEFFFF 100%);
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.dn { display: flex; }

@media (max-width: 599px) {
    .main-background {
        background: linear-gradient(180deg, var(--color-surface-info-bg) 0%, #FEFFFF 100%);
    }
}

@media (min-width: 1025px) {
    .dn { display: none; }
}

/* ── Sticky header ────────────────────────────────────────── */
.header-wrapper {
    background-color: transparent;
    top: 0;
    z-index: 1000;
    width: 100%;
    padding: 0;
}

.header-content-container {
    max-width: 1048px !important;
    padding: var(--space-2) var(--space-2) 0px var(--space-2) !important;
    background-color: transparent !important;
    box-shadow: none !important;
    margin: 0 auto;
}

/* ── Back button ──────────────────────────────────────────── */
.back-button-wrapper {
    margin-bottom: 1rem;
}

.back-button {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: var(--space-1) 0;
    transition: opacity 0.2s ease;
    font-family: var(--font-body);
    font-size: 14px;
    font-style: normal;
    font-weight: var(--fw-semibold);
    line-height: 16px;
    letter-spacing: 0.2px;
}

.back-button:hover {
    opacity: 0.8;
}

/* ── Search input ─────────────────────────────────────────── */
.search-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
}

.custom-search-field {
    display: flex;
    align-items: center;
    width: 100%;
    background-color: var(--color-surface-default);
    border: 1px solid var(--color-text-primary);
    border-radius: var(--radius-md);
    padding: 0 var(--space-1);
    box-shadow: none;
    transition: border-color 0.2s ease;
}

.custom-search-field:focus-within {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 1px var(--color-brand-primary);
}

.search-input-html {
    flex-grow: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    color: var(--color-text-secondary);
    padding: 0 10px;
}

.search-input-html::placeholder {
    color: var(--color-border-subtle);
}

.search-icon-start .mud-icon {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.arrow-icon-end-html {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.arrow-icon-end-html .mud-icon {
    color: var(--color-brand-accent);
}

/* ── View selector ────────────────────────────────────────── */
.view-selector {
    background: transparent;
    padding: 0 0 var(--space-2) 0;
}

.view-button {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-brand-accent);
    background-color: var(--color-surface-default);
    color: var(--color-brand-accent);
    text-align: center;
    font-family: var(--font-body);
    font-size: 14px;
    font-style: normal;
    font-weight: var(--fw-bold);
    line-height: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
}

.view-button .mud-icon {
    color: var(--color-brand-accent) !important;
}

.view-button.active {
    background-color: var(--color-brand-accent) !important;
    color: var(--color-surface-default) !important;
}

.view-button.active .mud-icon {
    color: var(--color-surface-default) !important;
}

.view-selector .map-button {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.view-selector .list-button {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border-left: none;
}

/* ── Search results view ──────────────────────────────────── */
.search-results-container {
    width: 100%;
    background: transparent;
    padding: 0;
}

.search-results-content {
    max-width: 1048px !important;
    width: 100%;
    padding: var(--space-1) !important;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.search-results-header {
    margin-bottom: 1.5rem;
    padding: 0 var(--space-1);
    flex-shrink: 0;
}

.search-results-scrollable-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    max-height: calc(100vh - 250px);
}

.title-and-sort-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 4px;
}

.search-results-title {
    color: var(--color-text-primary) !important;
    font-family: var(--font-heading);
    font-size: 22px;
    font-style: normal;
    font-weight: var(--fw-xbold);
    line-height: 32px;
    margin: 0 !important;
}

.search-results-subtitle {
    color: var(--color-text-primary) !important;
    font-family: var(--font-body);
    font-size: 14px;
    font-style: normal;
    font-weight: var(--fw-normal);
    line-height: normal;
    margin-top: 4px !important;
    text-align: left;
    width: 100%;
    display: block;
}

.sort-button {
    background-color: var(--color-surface-default) !important;
    color: var(--color-text-primary) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-sm) !important;
    padding: var(--space-1) var(--space-2) !important;
    text-transform: none !important;
    font-family: var(--font-body) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: none !important;
    min-width: auto !important;
}

.sort-button:hover {
    background-color: var(--color-surface-subtle) !important;
}

/* ── Search results list ──────────────────────────────────── */
.search-results-list {
    width: 100%;
}

.search-result-item {
    margin-bottom: 12px;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background-color: var(--color-surface-default) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--color-border);
}

.search-result-item:hover {
    background-color: var(--color-surface-subtle) !important;
    transform: translateY(-2px);
    box-shadow: var(--elevation-sm);
}

.search-result-item .mud-stack {
    width: 100%;
    align-items: flex-start !important;
    gap: 0 !important;
}

.search-result-text-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.search-result-name {
    font-weight: var(--fw-xbold) !important;
    color: var(--color-text-secondary) !important;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: left;
    margin-bottom: 2px !important;
    font-family: var(--font-heading);
    font-style: normal;
    line-height: var(--text-action-md-lh);
}

.search-result-address {
    color: var(--color-text-primary) !important;
    line-height: 1.2;
    font-size: 14px;
    font-weight: var(--fw-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: left;
    margin-bottom: 2px !important;
    font-family: var(--font-body);
    font-style: normal;
}

.search-result-distance {
    color: var(--color-border-subtle) !important;
    font-weight: var(--fw-normal);
    font-size: 14px !important;
    line-height: var(--text-action-md-lh);
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    font-style: normal;
}

.search-result-favorite-star {
    flex-shrink: 0;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    cursor: pointer;
    margin-left: 12px;
}

/* ── Map styles ───────────────────────────────────────────── */
.content-container-fullscreen {
    flex-grow: 1;
    position: relative;
    width: 100%;
    min-height: 400px;
}

.current-location-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: var(--color-surface-default);
    border-radius: 50%;
    border: none;
    width: 48px;
    height: 48px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 500;
}

.location-icon {
    color: var(--color-brand-accent);
    font-size: 24px;
}

/* ── List view ────────────────────────────────────────────── */
.list-container-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent;
    padding: 0;
}

.no-locations {
    width: 420px;
}

.list-container {
    max-width: 1048px !important;
    width: 100%;
    padding: var(--space-1) !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scrollable-list-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    max-height: calc(100vh - 65px);
}

/* Scrollbar styling */
.scrollable-list-container::-webkit-scrollbar,
.search-results-scrollable-container::-webkit-scrollbar {
    width: 6px;
}

.scrollable-list-container::-webkit-scrollbar-track,
.search-results-scrollable-container::-webkit-scrollbar-track {
    background: var(--color-surface-subtle);
    border-radius: 10px;
}

.scrollable-list-container::-webkit-scrollbar-thumb,
.search-results-scrollable-container::-webkit-scrollbar-thumb {
    background: var(--color-border-subtle);
    border-radius: 10px;
}

.scrollable-list-container::-webkit-scrollbar-thumb:hover,
.search-results-scrollable-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-disabled);
}

.list-item {
    margin-bottom: 12px;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background-color: var(--color-surface-default) !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.list-item:hover {
    background-color: var(--color-surface-subtle) !important;
    transform: translateY(-2px);
    box-shadow: var(--elevation-sm);
}

.list-item .mud-stack {
    width: 100%;
    align-items: flex-start !important;
    gap: 0 !important;
}

.list-text-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.location-name_store {
    color: var(--color-text-primary) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: left;
    margin-bottom: 2px !important;
    font-family: var(--font-body);
    font-style: normal;
    font-size: var(--text-action-md-size);
    font-weight: var(--fw-bold);
    line-height: var(--text-action-md-lh);
}

.location-address_store {
    color: var(--color-text-primary) !important;
    line-height: 1.2;
    font-size: var(--text-action-md-size);
    font-weight: var(--fw-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: left;
    margin-bottom: 2px !important;
    font-family: var(--font-body);
    font-style: normal;
}

.location-zipcode {
    color: var(--color-text-primary);
    margin-top: -4px;
    font-family: var(--font-body);
    font-size: 14px;
    font-style: normal;
    font-weight: var(--fw-normal);
    line-height: var(--text-action-md-lh);
}

.location-distance {
    color: var(--color-text-muted) !important;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    font-size: var(--text-action-md-size);
    font-style: normal;
    font-weight: 500;
    line-height: var(--text-action-md-lh);
}

.favorite-star-html {
    flex-shrink: 0;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    cursor: pointer;
    margin-left: 12px;
}

/* ── Loading states ───────────────────────────────────────── */
.list-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.search-results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

/* ── Favourite spinner ────────────────────────────────────── */
.star-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Utility ──────────────────────────────────────────────── */
.mud-stack {
    gap: 0 !important;
}

.search-result-text-content .mud-typography-body2,
.search-result-text-content .mud-typography-subtitle1,
.search-result-text-content .mud-typography-caption {
    margin-bottom: 0 !important;
    line-height: 1.2;
}

.search-result-name    { margin-bottom: 2px !important; }
.search-result-address { margin-bottom: 2px !important; }
.search-result-distance { margin-bottom: 0 !important; }

.list-text-content .mud-typography-body2,
.list-text-content .mud-typography-subtitle1,
.list-text-content .mud-typography-caption {
    line-height: 1.2;
}

.location-name_store    { margin-bottom: 2px !important; }
.location-address_store { margin-bottom: 2px !important; }
.location-distance      { margin-bottom: 0 !important; }

/* Selected row: grey background + outline applied while the store-details
   drawer is open for this row, so the user can see which store the drawer
   belongs to. Cleared automatically when the drawer closes.
   Uses outline (not border) so the row width stays identical to its
   unselected siblings — no layout shift between rows. */
.list-item.list-item-selected,
.search-result-item.search-result-item-selected {
    background-color: #D9D9D9 !important;
    outline: 2px solid #A8A8A8;
    outline-offset: -2px;
}

/* ── Map container ────────────────────────────────────────── */
.map-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

.map-display {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: var(--radius-lg);
}

.map_cls {
    max-width: 1280px;
    margin: 0 auto;
    gap: var(--space-2);
    padding: var(--space-2);
}

.card_cls {
    font-size: 14px;
    font-weight: var(--fw-bold);
    cursor: pointer;
}

.filter_cls {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.store_count_cls {
    font-size: var(--text-action-md-size);
    font-weight: var(--fw-normal);
    letter-spacing: 0.2px;
    color: var(--color-text-primary);
}

.mud_card_cls {
    border-radius: var(--radius-lg);
    box-shadow: none !important;
    border: 1px solid var(--color-border);
}

/* ── Sort drawer animations ───────────────────────────────── */
@keyframes store_sort_drawer_slide_up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes store_sort_drawer_slide_down {
    from { transform: translateY(0); }
    to   { transform: translateY(100%); }
}

.store_sort_drawer {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    height: auto !important;
    max-height: 90vh;
    width: 100% !important;
    max-width: 700px;
    margin: 0 auto !important;
    background-color: var(--color-surface-default);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    overflow-y: auto;
    z-index: 1300;
    animation: store_sort_drawer_slide_up 0.3s ease-out;
    will-change: transform;
}

.store_sort_drawer.store_sort_drawer--closing {
    animation: store_sort_drawer_slide_down 0.28s ease-in forwards;
}

@media (min-width: 745px) {
    .store_sort_drawer {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
    }

    @keyframes store_sort_drawer_slide_up {
        from { transform: translate(-50%, 100%); }
        to   { transform: translate(-50%, 0); }
    }

    @keyframes store_sort_drawer_slide_down {
        from { transform: translate(-50%, 0); }
        to   { transform: translate(-50%, 100%); }
    }
}

.store_sort_radio {
    border-radius: var(--radius-lg);
    width: 100%;
}

.store_sort_radio:hover {
    background: var(--color-border);
}

.radio_group_cls {
    width: 100%;
}

.store_sort_drawer .mud-drawer-content {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Handle bar */
.drawer_handle {
    width: 48px;
    height: 4px;
    background-color: var(--color-border);
    border-radius: 99px;
    margin: 12px auto 4px;
}

/* Drawer header */
.sort_drawer_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-1) var(--space-2) var(--space-1) 20px !important;
}

.sort_header_left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer_header_text {
    font-size: 20px !important;
    font-weight: var(--fw-bold) !important;
    color: var(--color-text-primary) !important;
}

/* Radio list */
.sort_radio_list {
    flex: 1;
    padding: var(--space-1) 12px;
    display: flex;
    flex-direction: column;
    margin-top: -20px;
}

.sort_radio_list .mud-radio-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2px;
}

.store_sort_radio {
    width: 100% !important;
    border-radius: 10px !important;
    padding: 0px 14px !important;
    margin: 0 !important;
}

.store_sort_radio .mud-icon-button {
    background-color: transparent !important;
    /* Brand blue overrides MudBlazor's default Color.Primary indigo on the
       radio circle (both unchecked outline and checked dot). */
    color: rgba(0, 79, 170, 1) !important;
}
.store_sort_radio .mud-icon-button:hover,
.store_sort_radio .mud-icon-button:focus { background-color: transparent !important; }

.store_sort_radio .mud-ripple,
.store_sort_radio .mud-ripple-radio { display: none !important; }

/* Force the SVG icon (the actual circle / dot) to inherit the brand blue. */
.store_sort_radio .mud-icon-root,
.store_sort_radio svg {
    color: rgba(0, 79, 170, 1) !important;
    fill: currentColor !important;
}

.store_sort_radio:has(input:checked) {
    background-color: rgba(0, 79, 170, 0.08) !important;
    border-radius: 10px !important;
}

.store_sort_radio:has(input:checked) .mud-radio-content,
.store_sort_radio:has(input:checked) .mud-typography {
    font-weight: var(--fw-bold) !important;
    color: var(--color-text-primary) !important;
}

.store_sort_radio .mud-radio-content,
.store_sort_radio .mud-typography {
    font-size: 15px;
    color: var(--color-text-primary);
}

/* Drawer footer */
.sort_drawer_footer {
    display: flex;
    gap: 12px;
    padding: var(--space-2);
    border-top: 1px solid var(--color-border);
}

/* Apply Changes button — vibrant red when there's a pending change.
   Muted when disabled (no change since last apply) so it reads as
   low-emphasis without disappearing entirely. */
.apply_changes_btn {
    flex: 1;
    background-color: var(--color-brand-accent) !important;
    color: var(--color-surface-default) !important;
    border-radius: var(--radius-lg) !important;
    font-weight: var(--fw-bold) !important;
    font-size: 15px !important;
    text-transform: none !important;
    height: 52px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.apply_changes_btn:hover:not(:disabled):not(.mud-button-disabled) {
    background-color: #8a0306 !important;
}

.apply_changes_btn:disabled,
.apply_changes_btn.mud-button-disabled {
    background-color: #c0685a !important;
    color: var(--color-surface-default) !important;
    opacity: 0.85;
    cursor: not-allowed;
    pointer-events: none;
}

/* Close button */
.close_btn {
    flex: 1;
    border: 2px solid var(--color-brand-primary) !important;
    color: var(--color-brand-primary) !important;
    border-radius: var(--radius-lg) !important;
    font-weight: var(--fw-bold) !important;
    font-size: 15px !important;
    text-transform: none !important;
    height: 52px;
    background-color: transparent !important;
}

/* Page-level loader: absolute overlay scoped to .main-background (which is
   position: relative). Topbar stays visible above it. The map container
   stays mounted in the DOM behind the loader so Google Maps can initialize
   while the user sees the loading state; both list + map become visible
   together once _isInitialLoadComplete flips.

   Height is capped at the visible viewport area so the FCLoader's flex
   centering aligns with the visible-area midpoint (otherwise .main-background
   extends past the viewport and the spinner ends up below center). */
.store-locator-init-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-default, #ffffff);
}

.store-locator-init-loader.with-topbar {
    /* Topbar is ~88px tall in browser mode; subtract it so the loader covers
       only the area visible below the Topbar. */
    height: calc(100vh - 88px);
}

.sticky_cls {
    position: sticky;
    z-index: 99;
}

.list_map_text_cls {
    font-size: var(--text-action-md-size);
    font-weight: var(--fw-bold);
    letter-spacing: 0.2px;
    line-height: var(--text-action-md-lh);
}
