/* ============================================
   HiLo Store Locator — Clean Mapbox Build
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ---------- Variables ---------- */
:root {
    --hilo-green: #007a3d;
    --hilo-green-dark: #005c2d;
    --hilo-green-light: #e6f4ec;
    --hilo-red: #d32f2f;
    --hilo-text: #1a1a1a;
    --hilo-text-light: #555;
    --hilo-bg: #fafafa;
    --hilo-white: #ffffff;
    --hilo-border: #e0e0e0;
    --hilo-shadow: 0 2px 12px rgba(0,0,0,.08);
    --hilo-radius: 10px;
    --hilo-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --hilo-sidebar-w: 400px;
}

/* ---------- Container ---------- */
#hilo-store-locator {
    position: relative;
    display: flex;
    width: 100%;
    height: 700px;
    max-height: 85vh;
    font-family: var(--hilo-font);
    color: var(--hilo-text);
    border-radius: var(--hilo-radius);
    overflow: hidden;
    box-shadow: var(--hilo-shadow);
    border: 1px solid var(--hilo-border);
    box-sizing: border-box;
}

#hilo-store-locator *, #hilo-store-locator *::before, #hilo-store-locator *::after {
    box-sizing: border-box;
}

/* ---------- Sidebar ---------- */
.hilo-sl-sidebar {
    width: var(--hilo-sidebar-w);
    min-width: var(--hilo-sidebar-w);
    background: var(--hilo-white);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--hilo-border);
    z-index: 2;
}

.hilo-sl-header {
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--hilo-border);
    background: var(--hilo-white);
}

.hilo-sl-title {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 700;
    color: var(--hilo-green);
    letter-spacing: -0.3px;
}

/* ---------- Search ---------- */
.hilo-sl-search-wrap {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--hilo-border);
    transition: border-color .2s;
}

.hilo-sl-search-wrap:focus-within {
    border-color: var(--hilo-green);
}

#hilo-sl-search {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--hilo-font);
    border: none;
    outline: none;
    background: var(--hilo-white);
    color: var(--hilo-text);
}

#hilo-sl-search::placeholder {
    color: #999;
}

#hilo-sl-search-btn {
    background: var(--hilo-green);
    border: none;
    color: white;
    padding: 0 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

#hilo-sl-search-btn:hover {
    background: var(--hilo-green-dark);
}

.hilo-sl-results-count {
    font-size: 12px;
    color: var(--hilo-text-light);
    margin-top: 10px;
    font-weight: 500;
}

/* ---------- Store List ---------- */
.hilo-sl-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.hilo-sl-list::-webkit-scrollbar {
    width: 5px;
}

.hilo-sl-list::-webkit-scrollbar-track {
    background: transparent;
}

.hilo-sl-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.hilo-sl-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--hilo-text-light);
    font-size: 14px;
}

.hilo-sl-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--hilo-border);
    cursor: pointer;
    transition: background .15s;
    position: relative;
}

.hilo-sl-item:hover {
    background: var(--hilo-green-light);
}

.hilo-sl-item.active {
    background: var(--hilo-green-light);
    border-left: 4px solid var(--hilo-green);
    padding-left: 16px;
}

.hilo-sl-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--hilo-text);
    margin-bottom: 4px;
}

.hilo-sl-item-address {
    font-size: 13px;
    color: var(--hilo-text-light);
    line-height: 1.4;
    margin-bottom: 6px;
}

.hilo-sl-item-phone {
    font-size: 13px;
    color: var(--hilo-green);
    font-weight: 500;
}

.hilo-sl-item-distance {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--hilo-text-light);
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 20px;
}

.hilo-sl-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--hilo-text-light);
}

.hilo-sl-no-results svg {
    display: block;
    margin: 0 auto 12px;
    opacity: .4;
}

/* ---------- Map ---------- */
.hilo-sl-map-wrap {
    flex: 1;
    position: relative;
}

#hilo-sl-map {
    width: 100%;
    height: 100%;
}

/* Mapbox overrides */
#hilo-sl-map .mapboxgl-popup-content {
    padding: 0;
    border-radius: var(--hilo-radius);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.15);
    min-width: 240px;
    max-width: 280px;
    font-family: var(--hilo-font);
}

#hilo-sl-map .mapboxgl-popup-close-button {
    font-size: 20px;
    padding: 4px 8px;
    color: var(--hilo-text-light);
    z-index: 2;
}

.hilo-popup-inner {
    padding: 14px 16px;
}

.hilo-popup-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--hilo-green-dark);
    margin-bottom: 6px;
}

.hilo-popup-address {
    font-size: 12px;
    color: var(--hilo-text-light);
    line-height: 1.4;
    margin-bottom: 8px;
}

.hilo-popup-phone {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}

.hilo-popup-phone a {
    color: var(--hilo-green);
    text-decoration: none;
}

.hilo-popup-actions {
    display: flex;
    gap: 8px;
}

.hilo-popup-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--hilo-font);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all .15s;
    border: none;
}

.hilo-popup-btn-directions {
    background: var(--hilo-green);
    color: white;
}

.hilo-popup-btn-directions:hover {
    background: var(--hilo-green-dark);
    color: white;
}

.hilo-popup-btn-details {
    background: #f0f0f0;
    color: var(--hilo-text);
}

.hilo-popup-btn-details:hover {
    background: #e0e0e0;
}

/* ---------- Detail Panel ---------- */
.hilo-sl-detail {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: var(--hilo-white);
    z-index: 10;
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(0,0,0,.1);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.hilo-sl-detail.visible {
    transform: translateX(0);
}

.hilo-sl-detail.hidden {
    transform: translateX(100%);
}

.hilo-sl-detail-close {
    position: sticky;
    top: 0;
    float: right;
    background: var(--hilo-white);
    border: none;
    font-size: 28px;
    color: var(--hilo-text-light);
    cursor: pointer;
    padding: 12px 16px;
    z-index: 2;
    line-height: 1;
}

.hilo-sl-detail-close:hover {
    color: var(--hilo-text);
}

.hilo-detail-inner {
    padding: 16px 24px 32px;
    clear: both;
}

.hilo-detail-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
}

.hilo-detail-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--hilo-green-dark);
    margin-bottom: 12px;
}

.hilo-detail-section {
    margin-bottom: 16px;
}

.hilo-detail-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--hilo-text-light);
    margin-bottom: 4px;
}

.hilo-detail-value {
    font-size: 14px;
    color: var(--hilo-text);
    line-height: 1.5;
}

.hilo-detail-value a {
    color: var(--hilo-green);
    text-decoration: none;
}

.hilo-detail-value a:hover {
    text-decoration: underline;
}

.hilo-detail-directions {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px;
    background: var(--hilo-green);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--hilo-font);
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    margin-top: 8px;
    transition: background .2s;
}

.hilo-detail-directions:hover {
    background: var(--hilo-green-dark);
    color: white;
}

/* ---------- Custom Marker ---------- */
.hilo-marker {
    width: 32px;
    height: 40px;
    cursor: pointer;
    transition: transform .15s;
}

.hilo-marker:hover {
    transform: scale(1.15);
}

.hilo-marker svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}

.hilo-marker.active svg .marker-body {
    fill: var(--hilo-red);
}

/* ---------- User location pulse ---------- */
.hilo-user-location {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4285f4;
    border: 3px solid white;
    box-shadow: 0 0 0 2px rgba(66,133,244,.3), 0 2px 6px rgba(0,0,0,.2);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    #hilo-store-locator {
        flex-direction: column;
        height: auto;
        max-height: none;
    }

    .hilo-sl-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 320px;
        border-right: none;
        border-bottom: 1px solid var(--hilo-border);
    }

    .hilo-sl-map-wrap {
        height: 450px;
    }

    .hilo-sl-detail {
        width: 100%;
    }

    :root {
        --hilo-sidebar-w: 100%;
    }
}

@media (max-width: 600px) {
    .hilo-sl-header {
        padding: 14px 14px 10px;
    }

    .hilo-sl-title {
        font-size: 18px;
    }

    .hilo-sl-item {
        padding: 12px 14px;
    }

    .hilo-sl-map-wrap {
        height: 350px;
    }
}
