/* ============================================================
   Fonts
   ============================================================ */
@font-face {
    font-family: 'PPWoodland';
    src: url("https://cdn.shopify.com/s/files/1/0644/0189/9625/files/PPWoodland-Regular.otf?v=1755709377") format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'PPWoodland';
    src: url("https://cdn.shopify.com/s/files/1/0644/0189/9625/files/PPWoodland-Bold.otf?v=1755709377") format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Urbanist';
    src: url("https://cdn.shopify.com/s/files/1/0644/0189/9625/files/Urbanist-Regular.ttf?v=1755709394") format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Urbanist';
    src: url("https://cdn.shopify.com/s/files/1/0644/0189/9625/files/Urbanist-SemiBold.ttf?v=1755709394") format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Urbanist';
    src: url("https://cdn.shopify.com/s/files/1/0644/0189/9625/files/Urbanist-Bold.ttf?v=1755709394") format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   Reset / Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Urbanist', sans-serif;
    font-size: 15px;
    color: #2E4A36;
    background: #EAF1E8;
    overflow: hidden;
}

/* ============================================================
   Layout
   ============================================================ */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---- NAV ---- */
#nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #DCE6D9;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    flex-shrink: 0;
    gap: 16px;
}

#logo {
    height: 56px;
    width: auto;
    flex-shrink: 0;
}

/* ---- Search row ---- */
#search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

#search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #C8D8C3;
    border-radius: 12px;
    padding: 0 14px;
    height: 56px;
    width: 520px;
    max-width: 100%;
    transition: box-shadow .2s;
}
#search-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(45,106,65,0.18);
    border-color: #2D6A41;
}

#search-icon {
    color: #5A7651;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

#search-input {
    border: none;
    outline: none;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    color: #2E4A36;
    background: transparent;
    flex: 1;
    min-width: 0;
}
#search-input::placeholder { color: #6D7E68; }

#search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #6D7E68;
    padding: 0;
    display: none;
    align-items: center;
}
#search-clear.visible { display: flex; }

/* ---- Geo button ---- */
#geo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #2D6A41;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s, transform .15s;
    color: #fff;
}
#geo-btn:hover { background: #1F4D2F; }
#geo-btn:active { transform: scale(.93); }
#geo-btn svg { width: 20px; height: 20px; }

/* ---- Map + Sidebar wrapper ---- */
#content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ---- Map ---- */
#map {
    flex: 1;
    height: 100%;
    background: linear-gradient(180deg, #DDE8D7 0%, #F4F8F2 100%);
}

/* ---- Sidebar / Overlay ---- */
#sidebar {
    width: 500px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    background: rgba(255,255,255,0.91);
    border-left: 1px solid #D7E3D2;
    box-shadow: 3px 5px 6px rgba(29,62,42,0.15);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px;
    z-index: 500;
}

#sidebar-title {
    font-family: 'PPWoodland', serif;
    font-size: 18px;
    font-weight: 700;
    color: #1F3C2B;
    margin-bottom: 14px;
    flex-shrink: 0;
}

/* ---- Company cards ---- */
#results-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.company-card {
    background: #fff;
    border: 1px solid #DCE8D8;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.company-card:first-child { background: #EAF1E8; }
.company-card:hover { background: #EAF1E8; box-shadow: 0 2px 8px rgba(45,106,65,0.12); }
.company-card.active { background: #EAF1E8; border-color: #2D6A41; box-shadow: 0 0 0 2px rgba(45,106,65,0.2); }

.card-name {
    font-weight: 700;
    font-size: 14px;
    color: #1F3C2B;
    line-height: 1.3;
}
.card-address {
    font-size: 13px;
    color: #2E4A36;
    line-height: 1.35;
}
.card-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2px;
}
.card-distance {
    font-size: 12px;
    font-weight: 600;
    color: #2D6A41;
    background: rgba(45,106,65,0.1);
    border-radius: 20px;
    padding: 2px 8px;
}
.card-phone {
    font-size: 12px;
    color: #5A7651;
    text-decoration: none;
}
.card-phone:hover { text-decoration: underline; }
.card-website {
    font-size: 12px;
    color: #2D6A41;
    text-decoration: none;
    font-weight: 600;
}
.card-website:hover { text-decoration: underline; }

/* ---- Product badges ---- */
.card-products {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 4px 0 2px;
}

.product-badge {
    display: inline-flex;
    align-items: center;
    background: #EAF1E8;
    color: #1F3C2B;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Urbanist', sans-serif;
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid #C8D8C3;
    white-space: nowrap;
    line-height: 1.4;
    transition: background .15s, border-color .15s;
}
.company-card.active .product-badge,
.company-card:hover .product-badge {
    background: #D4E8CE;
    border-color: #A8C9A0;
}

/* ---- Empty / loading states ---- */
#sidebar-empty {
    text-align: center;
    color: #6D7E68;
    font-size: 14px;
    padding: 40px 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
#sidebar-empty svg {
    display: block;
    margin: 0 auto;
    opacity: .4;
}

.btn-devenir-detaillant {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2D6A41;
    color: #fff !important;
    font-family: 'Urbanist', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    padding: 10px 20px;
    border-radius: 24px;
    border: none;
    cursor: pointer;
    transition: background .2s, transform .15s;
    box-shadow: 0 2px 8px rgba(45,106,65,0.25);
    margin-top: 4px;
}
.btn-devenir-detaillant:hover {
    background: #1F4D2F;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45,106,65,0.3);
}
.btn-devenir-detaillant:active {
    transform: translateY(0);
}

#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(234,241,232,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
#loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #C8D8C3;
    border-top-color: #2D6A41;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Leaflet custom pin ---- */
.map-pin {
    width: 22px;
    height: 22px;
    background: #E4572E;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform .15s;
}
.map-pin:hover, .map-pin.active { transform: scale(1.35); background: #c73d1a; }
.map-pin.active { border-color: #fff; box-shadow: 0 0 0 3px rgba(228,87,46,0.4); }

/* ---- Leaflet popup ---- */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
    font-family: 'Urbanist', sans-serif !important;
}
.leaflet-popup-content {
    margin: 12px 16px !important;
    font-size: 13px;
    color: #2E4A36;
    line-height: 1.5;
    min-width: 180px;
}
.popup-name {
    font-weight: 700;
    font-size: 14px;
    color: #1F3C2B;
    margin-bottom: 4px;
}
.popup-address { color: #5A7651; margin-bottom: 6px; }
.popup-links { display: flex; gap: 10px; flex-wrap: wrap; }
.popup-links a {
    font-size: 12px;
    color: #2D6A41;
    font-weight: 600;
    text-decoration: none;
}
.popup-links a:hover { text-decoration: underline; }

/* ---- Autocomplete dropdown ---- */
#autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #C8D8C3;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 9999;
    overflow: hidden;
    display: none;
}
#autocomplete.open { display: block; }
.autocomplete-item {
    padding: 10px 14px;
    font-size: 13px;
    color: #2E4A36;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.autocomplete-item:hover { background: #EAF1E8; }
.autocomplete-item svg { flex-shrink: 0; color: #5A7651; }

/* ---- Layer switcher ---- */
.ls-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ls-btn-bar { margin: 0 !important; }

.layer-switcher-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px !important;
    height: 30px !important;
    color: #444 !important;
    background: #fff !important;
    text-decoration: none !important;
    transition: color .15s, background .15s;
}
.layer-switcher-btn:hover {
    background: #f0f0f0 !important;
    color: #2D6A41 !important;
}

/* Panel — hidden by default, shown with .ls-open */
.ls-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 36px;   /* right of the 30px button + 6px gap */
    background: #fff;
    border: 1px solid #D0DCC9;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    min-width: 160px;
    overflow: hidden;
    z-index: 9999;
    flex-direction: column;
}
.ls-panel.ls-open { display: flex; }

.ls-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px 8px;
    font-family: 'Urbanist', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #6D7E68;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid #EEF4EC;
}

.ls-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-family: 'Urbanist', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #2E4A36;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid #EEF4EC;
    user-select: none;
}
.ls-item:last-child { border-bottom: none; }
.ls-item:hover { background: #EAF1E8; }
.ls-item.active { color: #1F3C2B; font-weight: 700; }

/* Radio dot */
.ls-radio {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #C8D8C3;
    flex-shrink: 0;
    background: #fff;
    transition: border-color .15s, background .15s;
    position: relative;
}
.ls-item.active .ls-radio {
    border-color: #2D6A41;
    background: #2D6A41;
    box-shadow: inset 0 0 0 3px #fff;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* --- Tablet (≤ 1024px) --- */
@media (max-width: 1024px) {
    #sidebar { width: 360px; }
    #search-wrap { width: 380px; }
}

/* --- Mobile (≤ 768px): portrait layout
       logo centred · map top · list bottom                     --- */
@media (max-width: 768px) {
    /* Nav */
    #nav {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 12px 14px !important;
    }
    #logo {
        height: 44px !important;
        display: block !important;
        margin: 0 auto !important;
        align-self: center !important;
    }
    #search-row {
        width: 100% !important;
        justify-content: center !important;
    }
    #search-wrap {
        width: 100% !important;
        max-width: 100% !important;
        height: 46px !important;
        flex: 1 !important;
    }

    /* Content: map on top, list below */
    #content {
        flex-direction: column !important;
    }
    #map {
        order: 1 !important;
        flex: none !important;
        width: 100% !important;
        height: 45vh !important;
    }
    #sidebar {
        order: 2 !important;
        width: 100% !important;
        height: 55vh !important;
        border-left: none !important;
        border-top: 1px solid #D7E3D2 !important;
        overflow-y: auto !important;
    }
    #loading-overlay { order: 3 !important; }
}

/* --- Mobile landscape (≤ 768px AND landscape):
       map left · list right                                     --- */
@media (max-width: 768px) and (orientation: landscape) {
    #nav {
        flex-direction: row !important;
        align-items: center !important;
        padding: 8px 14px !important;
        gap: 12px !important;
    }
    #logo {
        height: 36px !important;
        margin: 0 !important;
    }
    #search-wrap {
        width: 220px !important;
        height: 40px !important;
        flex: 1 !important;
    }
    #content {
        flex-direction: row !important;
    }
    #map {
        order: 1 !important;
        flex: 1 !important;
        width: auto !important;
        height: 100% !important;
    }
    #sidebar {
        order: 2 !important;
        width: 260px !important;
        height: 100% !important;
        border-left: 1px solid #D7E3D2 !important;
        border-top: none !important;
    }
}
