/* WP Immo Search - Map Styles (from original frontend.css) */

/* Map Styles */
.wp-immo-map-container {
    position: relative;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wp-immo-map-wrapper {
    position: relative;
}

#wp-immo-map {
    position: relative;
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 12px;
}

.wp-immo-map-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.map-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

.map-control-item label {
    font-weight: 500;
    margin: 0;
}

#search-radius-display {
    font-weight: 600;
    color: #007cba;
    min-width: 50px;
    text-align: right;
}

.wp-immo-map-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #333;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.legend-marker-exact {
    background: #007cba;
}

.legend-marker-approximate {
    background: #ff6b6b;
}

/* Custom Leaflet Marker Styles */
.wp-immo-marker {
    background: #007cba;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-immo-marker:hover {
    transform: scale(1.1);
    z-index: 1000;
}

.wp-immo-marker.approximate {
    background: #ff6b6b;
}

.wp-immo-marker.exact {
    background: #007cba;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    max-width: 280px;
}

.wp-immo-marker-popup {
    min-width: 250px;
}

.wp-immo-popup-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.wp-immo-popup-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.wp-immo-popup-type {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-immo-popup-content {
    padding: 0;
}

.wp-immo-popup-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.wp-immo-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-immo-popup-details {
    padding: 16px;
}

.wp-immo-popup-price {
    font-size: 18px;
    font-weight: 700;
    color: #007cba;
    margin-bottom: 12px;
}

.wp-immo-popup-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.wp-immo-popup-rooms,
.wp-immo-popup-area {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.wp-immo-popup-footer {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.wp-immo-popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    width: 100%;
    justify-content: center;
}

.wp-immo-popup-link:hover {
    background: #005a87;
    color: white;
}

/* Search Radius Circle */
.search-radius-circle {
    fill: rgba(0, 124, 186, 0.1);
    stroke: #007cba;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

/* CRITICAL: Ensure Leaflet container has proper setup */
#wp-immo-map {
    width: 100% !important;
    height: 400px !important;
    position: relative !important;
    background: #f0f0f0 !important;
    z-index: 1 !important;
}

/* CRITICAL: Fix for Leaflet tiles not showing */
.leaflet-container {
    background: #ddd !important;
}

.leaflet-tile {
    max-width: none !important;
}

.leaflet-tile-pane {
    z-index: 2 !important;
}

.leaflet-objects-pane {
    z-index: 3 !important;
}

/* Enhanced marker styles */
.wp-immo-marker {
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
    width: 24px !important;
    height: 24px !important;
}

.wp-immo-marker:hover {
    transform: scale(1.1);
    z-index: 1000;
}

.wp-immo-marker.exact {
    background-color: #007cba;
}

.wp-immo-marker.approximate {
    background-color: #ff6b6b;
}

.marker-label {
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

/* Enhanced popup styles */
.wp-immo-marker-popup {
    padding: 12px;
    text-align: center;
    min-width: 200px;
}

.wp-immo-marker-popup h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
    line-height: 1.2;
}

.wp-immo-marker-popup p {
    margin: 4px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.3;
}

.wp-immo-marker-popup a {
    color: #007cba;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wp-immo-marker-popup a:hover {
    background: #007cba;
    color: white;
}

/* Enhanced cluster styles */
.marker-cluster {
    background-color: rgba(0, 124, 186, 0.8) !important;
    border-radius: 50% !important;
    text-align: center !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 12px !important;
    line-height: 40px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid white !important;
}

.marker-cluster div {
    background-color: rgba(0, 124, 186, 0.9) !important;
    border-radius: 50% !important;
    text-align: center !important;
    color: white !important;
    font-weight: bold !important;
    line-height: 36px !important;
    width: 36px !important;
    height: 36px !important;
    margin: 2px !important;
    padding-bottom: 9px !important;
}

.marker-cluster-small {
    background-color: rgba(0, 124, 186, 0.8) !important;
}

.marker-cluster-small div {
    background-color: rgba(0, 124, 186, 0.9) !important;
}

.marker-cluster-medium {
    background-color: rgba(74, 144, 226, 0.8) !important;
}

.marker-cluster-medium div {
    background-color: rgba(74, 144, 226, 0.9) !important;
}

.marker-cluster-large {
    background-color: rgba(255, 107, 107, 0.8) !important;
}

.marker-cluster-large div {
    background-color: rgba(255, 107, 107, 0.9) !important;
}

/* Map loading and error states */
.wp-immo-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #333;
}

.wp-immo-map-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: mapSpin 1s linear infinite;
}

@keyframes mapSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wp-immo-map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    max-width: 300px;
    text-align: center;
}

.wp-immo-map-error h4 {
    margin: 0 0 8px 0;
    color: #721c24;
}

/* CRITICAL: Leaflet control fixes */
.leaflet-control-container {
    position: relative !important;
}

.leaflet-control-zoom {
    position: relative !important;
    z-index: 1000 !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f4f4f4 !important;
}

/* CRITICAL: Fix for popup positioning */
.leaflet-popup {
    z-index: 1010 !important;
}

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

/* Responsive fixes */
@media (max-width: 768px) {
    .wp-immo-marker {
        width: 20px !important;
        height: 20px !important;
        font-size: 10px !important;
    }
    
    .marker-cluster {
        line-height: 32px !important;
    }
    
    .marker-cluster div {
        width: 28px !important;
        height: 28px !important;
        line-height: 28px !important;
    }
    
    .wp-immo-map-loading {
        padding: 15px;
        font-size: 13px;
    }
}