/* ================================================================
   Express Store Locator — Frontend Styles
   ================================================================ */

/* Hide theme back-to-top button on store locator pages */
.back-top {
    display: none !important;
}

/* Reset for the store locator container */
.esl,
.esl *,
.esl *::before,
.esl *::after {
    box-sizing: border-box;
}

.esl {
    --esl-accent: #c4161c;
    --esl-text: #333;
    --esl-text-light: #666;
    --esl-border: #e0e0e0;
    --esl-bg: #fff;
    --esl-bg-hover: #f8f8f8;
    --esl-radius: 4px;

    display: flex;
    height: 700px;
    border: 1px solid var(--esl-border);
    border-radius: var(--esl-radius);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--esl-text);
    background: var(--esl-bg);
}

/* ----------------------------------------------------------------
   SIDEBAR
   ---------------------------------------------------------------- */

.esl__sidebar {
    width: 400px;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--esl-bg);
    border-right: 1px solid var(--esl-border);
    overflow: hidden;
}

/* Search */
.esl__search {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--esl-border);
    flex-shrink: 0;
}

.esl__search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.esl__search-input {
    width: 100%;
    padding: 10px 70px 10px 14px;
    border: 2px solid var(--esl-border);
    border-radius: var(--esl-radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--esl-text);
    background: var(--esl-bg);
    transition: border-color 0.2s;
    outline: none;
}

.esl__search-input::placeholder {
    color: #999;
}

.esl__search-input:focus {
    border-color: var(--esl-accent);
}

/* Enter key hint (right side) */
.esl__search-enter {
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    background: #f0f0f0;
    border: 1px solid var(--esl-border);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    color: #999;
    pointer-events: none;
    line-height: 1;
    white-space: nowrap;
}

.esl__search-enter svg {
    flex-shrink: 0;
}

.esl__search-input:focus~.esl__search-enter {
    color: var(--esl-text-light);
    border-color: #ccc;
    background: #e8e8e8;
}

/* Search spinner (replaces enter hint during loading) */
.esl__search-spinner {
    display: none;
    position: absolute;
    right: 12px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    width: 18px;
    height: 18px;
    border: 2px solid var(--esl-border);
    border-top-color: var(--esl-accent);
    border-radius: 50%;
    animation: esl-spin 0.6s linear infinite;
}

/* Search loading state */
.esl__search-input-wrapper--loading .esl__search-spinner {
    display: block;
}

.esl__search-input-wrapper--loading .esl__search-enter {
    display: none;
}

.esl__search-input-wrapper--loading .esl__search-input {
    opacity: 0.6;
}

.esl__locate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--esl-bg);
    border: 2px solid var(--esl-border);
    border-radius: var(--esl-radius);
    cursor: pointer;
    color: var(--esl-text-light);
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.esl__locate-btn svg {
    flex-shrink: 0;
}

.esl__locate-label {
    line-height: 1;
}

.esl__locate-btn:hover {
    border-color: var(--esl-accent);
    color: var(--esl-accent);
}

.esl__locate-btn.esl__locate-btn--active {
    border-color: var(--esl-accent);
    color: var(--esl-accent);
    background: rgba(196, 22, 28, 0.05);
}

/* Locate button loading state */
.esl__locate-btn.esl__locate-btn--loading {
    opacity: 0.6;
    pointer-events: none;
}

.esl__locate-btn.esl__locate-btn--loading svg {
    animation: esl-spin 0.8s linear infinite;
}

.esl__locate-btn.esl__locate-btn--loading .esl__locate-label {
    display: none;
}

.esl__locate-btn.esl__locate-btn--loading::after {
    content: 'Localisation...';
    font-size: 12px;
}

/* Filters */
.esl__filters {
    border-bottom: 1px solid var(--esl-border);
    flex-shrink: 0;
}

.esl__filters-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--esl-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.esl__filters-toggle:hover {
    background: rgba(0, 0, 0, 0.02);
}

.esl__filters-arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.esl__filters.esl__filters--open .esl__filters-arrow {
    transform: rotate(180deg);
}

.esl__filter-group {
    display: none;
    padding: 0 16px 12px;
    max-height: 200px;
    overflow-y: auto;
}

.esl__filters.esl__filters--open .esl__filter-group {
    display: block;
}

.esl__filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--esl-text);
    user-select: none;
}

.esl__filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--esl-accent);
    cursor: pointer;
    flex-shrink: 0;
}

.esl__filter-label {
    line-height: 1.3;
}

/* Radius slider */
.esl__radius {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--esl-border);
    flex-shrink: 0;
    background: #fafafa;
}

.esl__radius-label {
    font-size: 12px;
    color: var(--esl-text-light);
    white-space: nowrap;
    font-weight: 500;
}

.esl__radius-label strong {
    color: var(--esl-accent);
    font-weight: 700;
    min-width: 28px;
    display: inline-block;
    text-align: center;
}

.esl__radius-input {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--esl-border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.esl__radius-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--esl-accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.esl__radius-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--esl-accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Results info */
.esl__results-info {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--esl-text-light);
    border-bottom: 1px solid var(--esl-border);
    flex-shrink: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Store list */
.esl__store-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Loading */
.esl__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--esl-text-light);
    font-size: 13px;
}

.esl__loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--esl-border);
    border-top-color: var(--esl-accent);
    border-radius: 50%;
    animation: esl-spin 0.6s linear infinite;
}

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

/* No results */
.esl__no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--esl-text-light);
    font-size: 14px;
}

/* Store item */
.esl__store-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.esl__store-item:hover {
    background: var(--esl-bg-hover);
}

.esl__store-item--active {
    background: var(--esl-bg-hover);
    border-left-color: var(--esl-accent);
}

.esl__store-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #E30019;
    margin-bottom: 4px;
    line-height: 1.3;
}

.esl__oriflamme {
    flex-shrink: 0;
}

.esl__store-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.esl__store-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--esl-text);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.esl__store-distance {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--esl-accent);
    background: rgba(196, 22, 28, 0.08);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.5;
}

.esl__store-address {
    font-size: 13px;
    color: var(--esl-text-light);
    margin-bottom: 8px;
    line-height: 1.4;
}

.esl__store-contact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    color: var(--esl-text-light);
}

.esl__store-contact-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.esl__store-contact-row svg {
    flex-shrink: 0;
    color: var(--esl-text-light);
}

.esl__store-contact a {
    color: var(--esl-accent);
    text-decoration: none;
}

.esl__store-contact a:hover {
    text-decoration: underline;
}

.esl__store-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.esl__store-directions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #1d4059;
    text-decoration: none;
    font-weight: 600;
}

.esl__store-directions:hover {
    text-decoration: underline;
}

.esl__store-directions svg {
    flex-shrink: 0;
}

.esl__store-image {
    flex-shrink: 0;
    width: 100px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esl__store-image img {
    max-width: 100%;
    max-height: 50px;
    min-height: 30px;
    object-fit: contain;
    display: block;
}

/* Load more */
.esl__load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 12px;
    margin: 0;
    border: none;
    border-top: 1px dashed var(--esl-border);
    background: var(--esl-bg);
    color: var(--esl-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.esl__load-more:hover {
    background: var(--esl-bg-hover);
}

.esl__load-more-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--esl-border);
    border-top-color: var(--esl-accent);
    border-radius: 50%;
    animation: esl-spin 0.6s linear infinite;
}

.esl__load-more--loading {
    pointer-events: none;
    opacity: 0.7;
}

.esl__load-more--loading .esl__load-more-label {
    display: none;
}

.esl__load-more--loading .esl__load-more-spinner {
    display: block;
}

.esl__load-more--loading::before {
    content: 'Chargement...';
    font-size: 12px;
}

html[lang^="de"] .esl__load-more--loading::before {
    content: 'Wird geladen...';
}

html[lang^="en"] .esl__load-more--loading::before {
    content: 'Loading...';
}

html[lang^="pl"] .esl__load-more--loading::before {
    content: 'Ładowanie...';
}


/* ----------------------------------------------------------------
   MAP
   ---------------------------------------------------------------- */

.esl__map-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
    z-index: 1;
}

.esl__map {
    width: 100%;
    height: 100%;
}

/* Popup */
.esl__popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    min-width: 240px;
    max-width: 320px;
}

.esl__popup-image {
    margin-bottom: 10px;
    max-height: 50px;
}

.esl__popup-image img {
    max-width: 100%;
    max-height: 50px;
    object-fit: contain;
    display: block;
}

.esl__popup-header {
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

.esl__popup-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.esl__popup-name {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.esl__popup-distance {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--esl-accent, #c4161c);
    background: rgba(196, 22, 28, 0.08);
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.5;
}

.esl__popup-commercial {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #E30019;
    margin-top: 3px;
    line-height: 1.3;
}

.esl__popup-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 8px;
}

.esl__popup-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.esl__popup-row-icon {
    flex-shrink: 0;
    color: #999;
    margin-top: 1px;
}

.esl__popup-row a {
    color: var(--esl-accent, #c4161c);
    text-decoration: none;
}

.esl__popup-row a:hover {
    text-decoration: underline;
}

.esl__popup-footer {
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.esl__popup-directions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #1d4059;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
}

.esl__popup-directions:hover {
    text-decoration: underline;
}

/* Override Leaflet cluster default colors */
.marker-cluster-small {
    background-color: rgba(196, 22, 28, 0.2) !important;
}

.marker-cluster-small div {
    background-color: rgba(196, 22, 28, 0.5) !important;
    color: #fff !important;
}

.marker-cluster-medium {
    background-color: rgba(196, 22, 28, 0.3) !important;
}

.marker-cluster-medium div {
    background-color: rgba(196, 22, 28, 0.6) !important;
    color: #fff !important;
}

.marker-cluster-large {
    background-color: rgba(196, 22, 28, 0.4) !important;
}

.marker-cluster-large div {
    background-color: rgba(196, 22, 28, 0.7) !important;
    color: #fff !important;
}

/* Layer switcher buttons — positioned on the map */
.esl__layers {
    position: absolute;
    top: 80px;
    left: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.esl__layer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    font-family: inherit;
    cursor: pointer;
    border: 0px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: #fff;
    color: var(--esl-text-light);
    transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.esl__layer-btn:hover {
    border-color: rgba(0, 0, 0, 0.3);
    color: var(--esl-text);
}

.esl__layer-btn--active {
    border-color: var(--esl-accent);
    color: var(--esl-accent);
    box-shadow: 0 0 0 1px var(--esl-accent), 0 1px 4px rgba(0, 0, 0, 0.15);
}

.esl__layer-btn--active:hover {
    border-color: var(--esl-accent);
    color: var(--esl-accent);
}

.esl__layer-img {
    width: 28px;
    height: 28px;
    border-radius: 4px !important;
    object-fit: cover;
    flex-shrink: 0;
}

.esl__layer-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1;
}

/* User location marker pulse */
.esl__user-marker {
    width: 16px;
    height: 16px;
    background: var(--esl-accent, #c4161c);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--esl-accent, #c4161c), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ----------------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------------- */

@media (max-width: 900px) {
    .esl__sidebar {
        width: 320px;
        min-width: 320px;
    }
}

@media (max-width: 768px) {
    .esl {
        flex-direction: column;
        height: auto;
    }

    .esl__sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-top: 1px solid var(--esl-border);
        order: 2;
        max-height: none;
        height: auto;
    }

    .esl__map-wrapper {
        flex: none;
        height: 300px;
        min-height: 300px;
        order: 1;
    }

    /* Give the store list a proper scrollable height on mobile */
    .esl__store-list {
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Layer switcher: compact on mobile — hide labels, keep thumbnails */
    .esl__layers {
        top: auto;
        bottom: 10px;
        left: 10px;
        flex-direction: row;
    }

    .esl__layer-label {
        display: none;
    }

    .esl__layer-btn {
        padding: 3px;
        border-radius: 3px;
    }

    .esl__layer-img {
        width: 24px;
        height: 24px;
        border-radius: 3px !important;
    }

    /* Filters: smooth push behavior instead of overlay */
    .esl__filter-group {
        max-height: 0;
        overflow: hidden;
        display: block !important;
        padding: 0 16px;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .esl__filters.esl__filters--open .esl__filter-group {
        max-height: 300px;
        overflow-y: auto;
        padding: 0 16px 12px;
    }
}

@media (max-width: 480px) {
    .esl__search {
        padding: 12px;
    }

    .esl__locate-btn {
        padding: 10px;
    }

    .esl__store-item {
        padding: 12px;
    }

    .esl__map-wrapper {
        flex: none;
        height: 300px;
        min-height: 300px;
    }

    /* More space for the listing on small screens */
    .esl__store-list {
        max-height: 55vh;
    }
}