/* ===============================
   LAYOUT WRAPPER
================================ */

.locations-wrapper {
    display: flex;
    flex-direction: column;

    width: 100%;
    height: 100vh; /* ✅ ahora ocupa toda la pantalla */
    background: #fff;
    font-family: 'Barlow', sans-serif;

    /* ✅ FIX mac scroll (padres deben cortar overflow) */
    overflow: hidden;
}

.locations-body {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* ===============================
   SIDEBAR
================================ */

.locations-sidebar {
    width: 360px;
    border-right: 1px solid #ddd;

    display: flex;
    flex-direction: column;

    height: 100%;
    min-height: 0;

    /* ✅ el sidebar ya NO scrollea */
    overflow: hidden;
}

svg.icon-search-map {
    position: absolute;
    left: 15px;
    top: 50%;
    margin-top: -10px;
    width: 20px;
}

/* SEARCH fijo arriba */
.locations-search-bar {
    background-color: #E0E0E0;
    padding: 15px;
    padding-left: 35px;
}

.locations-search-bar h3 {
    margin: 0 0 24px 0;
}

.radius-text {
    font-size: 14px;
    color: #444;
}

/* Radius filter dropdown */
.radius-filter-wrapper {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.radius-filter-wrapper label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

#radius-filter {
    flex: 1;
    padding: 0px 12px;
    font-size: 14px;
    font-family: 'Barlow', sans-serif;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

#radius-filter:hover {
    border-color: #f47d20;
}

#radius-filter:focus {
    outline: none;
    border-color: #f47d20;
    box-shadow: 0 0 0 2px rgba(244, 125, 32, 0.1);
}

/* ✅ scroll solo para lista y detalle */
.locations-sidebar-scroll {
    flex: 1;
    min-height: 0;
    padding-left: 35px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ✅ OPCIONAL: Scrollbar visible (WebKit: Safari/Chrome) */
.locations-sidebar-scroll::-webkit-scrollbar {
    width: 10px;
}
.locations-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
}
.locations-sidebar-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
}

/* ===============================
   MAP
================================ */

#locations-map {
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* ===============================
   HELPERS
================================ */

.hidden {
    display: none;
}

/* ===============================
   LIST ITEMS
================================ */

.dealer-item {
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dealer-item:hover {
    background: #f47d20;
}

.dealer-item.active {
    background: #f47d20;
    border-top: 1px solid #fff;
    border-bottom: 1px solid #fff;
}

.dealer-item.active::after {
    color: #000;
}

.dealer-item::after {
    content: '›';
    font-size: 30px;
    color: #F1B382;
    margin-top: -5px;
    font-weight: 500;
    margin-right: 10px;
}

/* ===============================
   DETAIL VIEW
================================ */

#back-to-list {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    display: block;
    background: #f47d20;
    width: 100%;
    font-weight: bold;
    padding: 20px;
    cursor: pointer;
    text-transform: uppercase;
}

#get-directions,
.get-directions {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 14px;
    background: #1a73e8;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}

/* ===============================
   CUSTOM POPUP CONTAINER
================================ */

.custom-popup {
    position: absolute;
    z-index: 9999;
    font-family: 'Barlow', sans-serif;
}

.custom-popup.hidden {
    display: none;
}

/* Mobile responsive positioning */
@media (max-width: 768px) {
    /* Mobile layout: stack sidebar on top */
    .locations-wrapper {
        flex-direction: column;
    }
    
    .locations-body {
        flex-direction: column;
    }
    
    /* Sidebar becomes top search bar on mobile */
    .locations-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #ddd;
        position: relative;
        z-index: 1000;
        padding: 0;
        background: white;
        overflow: visible;
    }
    
    .locations-sidebar-scroll {
        position: static;
        padding-left: 0;
        overflow: visible;
    }
    
    /* Map takes remaining space */
    #locations-map {
        flex: 1;
        height: calc(100vh - 100px);
    }
    
    /* Search input full width on mobile */
    #location-search {
        width: 100%;
    }
    
    /* Location list view container */
    #locations-list-view {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        max-height: 300px;
        overflow-y: auto;
        z-index: 10001;
        margin: 0;
    }
    
    /* Show list when search is active */
    .locations-sidebar.search-active #locations-list-view {
        display: block !important;
    }
    
    /* Location list items */
    #locations-list {
        display: block !important;
        position: static;
        background: transparent;
        box-shadow: none;
        margin: 0;
        padding: 0 15px 30px;
    }
    
    /* Custom popup mobile styling */
    .custom-popup {
        position: absolute !important;
        bottom: 20% !important;
        top: auto !important;
        overflow-y: auto;
        z-index: 10000 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2) !important;
        border-radius: 20px;
    }
    
    .custom-popup .map-infowindow {
        max-width: none;
        min-width: auto;
        width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        border: none;
    }
}

/* ===============================
   INFO WINDOW (EXISTING STYLES)
================================ */

.map-infowindow {
    min-width: 320px;
    max-width: 380px;
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #ddd;
    padding: 0;
    margin: 0;
}

/* Header with title and close X */
.infowindow-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 10px 20px;
    position: relative;
}

/* Close X button */
.infowindow-close-x {
    background: none;
    border: none;
    font-size: 40px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 15px;
    right: 15px;
    transition: all 0.2s;
}

.infowindow-close-x:hover {
    color: #333;
}

/* Hide the default infowindow pointer/tail */
.gm-style .gm-style-iw-c {
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.gm-style .gm-style-iw-t::after {
    display: none;
}

.infowindow-title {
    font-weight: 600;
    font-size: 24px;
    color: #f47d20;
    margin: 0;
    padding: 0;
    padding-right: 35px;
    flex: 1;
}

.infowindow-content {
    padding: 10px 20px 20px 20px;
    font-size: 14px !important;
    font-weight: 400 !important;
}

.infowindow-content div {
    margin-bottom: 7px;
    color: #000;
}

.infowindow-content div:last-child {
    margin-bottom: 0;
}

.infowindow-actions {
    text-align: right;
    margin-top: 15px !important;
}

/* Get Directions button */
.directions-btn {
        display: inline-block;
    color: #000000 !important;
    padding: 12px 24px;
    border-radius: 4px;
    border: 1px solid #f47d20 !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: 'Barlow', sans-serif;
    transition: background 0.2s;
}

.directions-btn:hover {

}

.map-infowindow a {
    color: #000;
    text-decoration: none !IMPORTANT;
    outline: none !IMPORTANT;
}

.map-infowindow a:hover {
    text-decoration: underline;
    color: #000;
}

.map-infowindow a:focus {
    outline: none !IMPORTANT;
    border: none !IMPORTANT;
    text-decoration: underline;
}

.map-infowindow strong {
    color: #000;
    font-weight: 600;
}

.gm-style-iw-chr {
    display: none !important;
}

.gm-style-iw-d {
    padding: 30px 10px 15px 30px;
}

.gm-style-iw-d div {
    border: 0 !important;
    box-shadow: none !important;
}
/* ===============================
   SEARCH
================================ */

.location-search-wrapper {
    position: relative;
    width: 100%;
}

#location-search {
    padding: 0 15px 0 40px;
    height: 40px;
    border-radius: 4px;
    border-width: 2px;
    border-color: #B3B3B3;
    font-size: 16px;
    outline: none;
    width: calc(100% - 30px);
}

#location-search:focus {
    outline: none;
    border-color: #f47d20;
}

#clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    text-decoration: none;
    font-size: 18px;
    color: #666;
    display: none;
    cursor: pointer;
}

#clear-search.visible {
    display: block;
}
#location-detail {
    padding: 10px;
}