/* Modern Reset & Base */
.dealer-locator-container {
    display: flex;
    flex-wrap: wrap;
    height: 700px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 0;
    /* Removed Radius as requested */
    box-shadow: 0 10px 40px rgba(41, 39, 95, 0.08);
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

/* Sidebar Wrapper (includes search + list) */
.dealer-sidebar {
    width: 380px;
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-right: 1px solid #eaeaea;
}

/* Search Bar */
.dealer-search {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #eaeaea;
}

.dealer-search-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.2s;
}

.dealer-search-input:focus {
    border-color: #29275F;
}

/* Sidebar List */
.dealer-list {
    flex: 1;
    /* Takes remaining height */
    overflow-y: auto;
    padding: 20px;
}

.dealer-item {
    background: #fff;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    /* Items can keep radius for card look? "remove border radious from around the parent container" */
    border: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    display: block;
    /* Ensure display block for filtering */
}

.dealer-item.hidden-by-search {
    display: none !important;
}

.dealer-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-color: #29275F;
}

.dealer-item.active-dealer {
    border-color: #29275F;
    box-shadow: 0 0 0 1px #29275F;
    background: #fdfdfd;
}

.dealer-item h3 {
    margin: 0 0 12px 0;
    font-size: 1.15em;
    font-weight: 700;
    color: #29275F;
    line-height: 1.3;
}

.dealer-info {
    font-size: 0.95em;
    margin-bottom: 8px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dealer-info a {
    color: #29275F;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.dealer-info a:hover {
    color: #4a478a;
    text-decoration: underline;
}

.dealer-info.address {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.9em;
    color: #777;
    line-height: 1.5;
}

/* Map Wrapper (Right Column) */
.dealer-map-wrapper {
    flex: 1;
    height: 100%;
    position: relative;
    min-width: 300px;
}

.dealer-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Fix for themes that set max-width: 100% on all images globally */
.leaflet-pane img {
    max-width: none !important;
    max-height: none !important;
}

/* Scrollbar styling */
.dealer-list::-webkit-scrollbar {
    width: 6px;
}

.dealer-list::-webkit-scrollbar-track {
    background: transparent;
}

.dealer-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.dealer-list::-webkit-scrollbar-thumb:hover {
    background: #29275F;
}

/* Map Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 15px;
    line-height: 1.5;
}

.leaflet-popup-content b {
    color: #29275F;
    font-size: 1.1em;
    display: block;
    margin-bottom: 5px;
}

.leaflet-popup-content a {
    color: #29275F;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 900px) {
    .dealer-locator-container {
        flex-direction: column;
        height: auto !important;
        /* Force auto height */
        max-height: none;
    }

    /* Map First on Mobile */
    .dealer-map-wrapper {
        width: 100%;
        height: 400px;
        /* Fixed height for map on mobile */
        order: 1;
        flex: none;
        /* Don't grow/shrink */
    }

    /* List Second */
    .dealer-sidebar {
        width: 100%;
        height: auto;
        max-height: 500px;
        /* Limit list height so it doesn't scroll excessively */
        order: 2;
        border-right: none;
        border-top: 1px solid #eaeaea;
    }

    .dealer-list {
        height: auto;
        max-height: 400px;
    }

    .dealer-search-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}