/* ============================================================
   OSM Location Map - Styles
   ============================================================ */

/* ---- Map Wrapper ---- */
.osm-map-wrapper {
    display: flex;
    gap: 0;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.osm-map-wrapper.osm-list-left {
    flex-direction: row;
}

.osm-map-wrapper.osm-list-right {
    flex-direction: row-reverse;
}

.osm-map-wrapper.osm-list-bottom {
    flex-direction: column;
}

/* ---- Map Container ---- */
.osm-map-container {
    flex: 1;
    min-height: 300px;
    position: relative;
    z-index: 1;
}

.osm-map-container .leaflet-container {
    height: 100%;
    width: 100%;
    border-radius: 0;
}

/* ---- Location List Sidebar ---- */
.osm-location-list {
    width: 320px;
    min-width: 280px;
    max-height: 500px;
    overflow-y: auto;
    background: #fafafa;
    border-right: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 1.5;
}

.osm-list-right .osm-location-list {
    border-right: none;
    border-left: 1px solid #e0e0e0;
}

.osm-list-bottom .osm-location-list {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.osm-list-bottom .osm-list-title {
    flex-shrink: 0;
}

.osm-list-bottom .osm-list-items {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px;
    gap: 8px;
}

.osm-list-bottom .osm-list-item {
    min-width: 220px;
    max-width: 260px;
    flex-shrink: 0;
    border-bottom: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
}

.osm-list-title {
    margin: 0;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.osm-list-items {
    padding: 0;
    margin: 0;
}

.osm-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
}

.osm-list-item:hover {
    background: #e8f4fd;
}

.osm-list-item.active {
    background: #d4edfd;
    border-left: 3px solid #3388ff;
}

.osm-list-marker-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.osm-list-item-content {
    flex: 1;
    min-width: 0;
}

.osm-list-item-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    margin-bottom: 2px;
}

.osm-list-item-address {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.4;
}

.osm-list-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.osm-btn-locate,
.osm-btn-drive {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-weight: 500;
}

.osm-btn-locate {
    background: #e8f4fd;
    color: #1a73e8;
}

.osm-btn-locate:hover {
    background: #d0e8fc;
    color: #1557b0;
}

.osm-btn-drive {
    background: #e6f4ea;
    color: #1e8e3e;
}

.osm-btn-drive:hover {
    background: #ceead6;
    color: #157a33;
}

/* ---- Map Popup Customization ---- */
.osm-popup-content {
    font-size: 13px;
    line-height: 1.5;
    min-width: 180px;
    max-width: 280px;
}

.osm-popup-content h4 {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.osm-popup-content .osm-popup-address {
    color: #555;
    margin-bottom: 4px;
}

.osm-popup-content .osm-popup-phone {
    color: #555;
    margin-bottom: 4px;
}

.osm-popup-content .osm-popup-phone a {
    color: #1a73e8;
    text-decoration: none;
}

.osm-popup-content .osm-popup-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.osm-popup-content .osm-popup-actions a {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.15) !important;
}

/* ---- Search / Geocoder ---- */
.osm-search-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    width: calc(100% - 80px);
    max-width: 400px;
}

.osm-search-container input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    font-size: 14px;
    background: white;
    box-shadow: 0 1px 5px rgba(0,0,0,0.15);
    outline: none;
    box-sizing: border-box;
}

.osm-search-container input:focus {
    border-color: #3388ff;
}

.osm-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: none;
}

.osm-search-results.active {
    display: block;
}

.osm-search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.osm-search-result-item:hover {
    background: #f0f7ff;
}

/* ---- Empty State ---- */
.osm-map-empty {
    padding: 40px 20px;
    text-align: center;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 8px;
    color: #888;
    margin: 20px 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .osm-map-wrapper.osm-list-left,
    .osm-map-wrapper.osm-list-right {
        flex-direction: column;
    }

    .osm-location-list {
        width: 100%;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .osm-list-right .osm-location-list {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        border-bottom: none;
    }

    .osm-map-container {
        min-height: 350px;
    }

    .osm-list-bottom .osm-list-items {
        flex-wrap: nowrap;
    }

    .osm-list-bottom .osm-list-item {
        min-width: 180px;
    }
}

/* ---- Leaflet Fixes ---- */
.leaflet-default-icon-path {
    background-image: url(https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png);
}
