/* Map Styles */
.map-container {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.12);
    background: #f8f9fa;
}

#propertiesMapContainer {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
}

/* Map Loading Spinner */
#mapLoading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a3c6d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map Controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
}

.leaflet-control-zoom a {
    background: #fff !important;
    color: #1a3c6d !important;
    border: none !important;
    border-radius: 4px !important;
    margin: 2px !important;
    transition: all 0.3s ease !important;
    font-weight: bold !important;
}

.leaflet-control-zoom a:hover {
    background: #1a3c6d !important;
    color: #fff !important;
    transform: scale(1.05) !important;
}

/* Custom Markers */
.custom-marker {
    transition: all 0.3s ease;
    cursor: pointer;
}

.custom-marker:hover {
    transform: scale(1.3);
    z-index: 1000 !important;
}

.sale-marker {
    animation: pulse-sale 2s infinite;
}

.rent-marker {
    animation: pulse-rent 2s infinite;
}

@keyframes pulse-sale {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes pulse-rent {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Map Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    backdrop-filter: blur(10px) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
}

.leaflet-popup-tip {
    background: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.map-popup {
    padding: 16px;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    text-align: right;
    background: white;
    border-radius: 12px;
    min-width: 220px;
    max-width: 320px;
    max-height: 350px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 #fff;
}

.map-popup::-webkit-scrollbar {
    width: 6px;
    background: #fff;
}
.map-popup::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 6px;
}

.map-popup h4 {
    margin: 0 0 8px 0;
    color: #1a3c6d;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.3;
}

.map-popup .price {
    color: #059669;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 8px;
}

.map-popup .location {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.map-popup .details {
    color: #888;
    font-size: 13px;
    margin-bottom: 12px;
}

.map-popup .view-details {
    display: inline-block;
    background: #1a3c6d;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    text-align: center;
    width: 100%;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.map-popup .view-details:hover {
    background: #0f2a4a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(26, 60, 109, 0.3);
}

/* Map View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.view-btn {
    padding: 10px 20px;
    border: 2px solid #1a3c6d;
    background: #fff;
    color: #1a3c6d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.view-btn:hover,
.view-btn.active {
    background: #1a3c6d;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(26, 60, 109, 0.3);
}

/* Map Stats */
.map-stats {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.map-stats span {
    font-weight: bold;
    color: #1a3c6d;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .map-container {
        height: 400px;
    }
    
    .view-toggle {
        flex-direction: column;
        align-items: center;
    }
    
    .view-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .map-popup {
        padding: 12px;
        min-width: 250px;
    }
    
    .map-popup h4 {
        font-size: 14px;
    }
    
    .map-popup .price {
        font-size: 13px;
    }
    
    .leaflet-popup-content-wrapper {
        max-width: 280px !important;
    }
}

@media (max-width: 480px) {
    .map-container {
        height: 350px;
    }
    
    .map-popup {
        padding: 10px;
        min-width: 200px;
    }
    
    .map-popup h4 {
        font-size: 13px;
    }
    
    .map-popup .price {
        font-size: 12px;
    }
    
    .map-popup .view-details {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Map Attribution */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    font-size: 11px !important;
    color: #666 !important;
    backdrop-filter: blur(5px) !important;
}

/* Fullscreen Control */
.leaflet-control-fullscreen {
    background: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-fullscreen a {
    color: #1a3c6d !important;
    transition: all 0.3s ease !important;
}

.leaflet-control-fullscreen a:hover {
    background: #1a3c6d !important;
    color: #fff !important;
}

/* Map Error Message */
.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 18px;
    color: #666;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    border: 2px dashed #dee2e6;
}

/* Map Loading Animation */
.map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.map-loading .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #1a3c6d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.map-loading .text {
    color: #1a3c6d;
    font-size: 16px;
    font-weight: 500;
}

/* Property Type Badges */
.property-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-type-badge.sale {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.property-type-badge.rent {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

/* Enhanced Popup Styles */
.enhanced-popup {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.enhanced-popup .popup-header {
    background: linear-gradient(135deg, #1a3c6d 0%, #0f2a4a 100%);
    color: white;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 14px;
}

.enhanced-popup .popup-content {
    padding: 16px;
}

.enhanced-popup .popup-footer {
    background: #f8f9fa;
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
}

/* Map Legend */
.map-legend {
    position: absolute;
    top: 10px;
    left: 10px;
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 12px;
}

.map-legend .legend-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.map-legend .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-left: 8px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.map-legend .legend-color.sale {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.map-legend .legend-color.rent {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

/* Loading States */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.map-loading-overlay.hidden {
    display: none;
}

/* Map Tooltips */
.map-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    text-align: center;
}

/* Map Clusters */
.marker-cluster {
    background: rgba(26, 60, 109, 0.8);
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-cluster:hover {
    background: rgba(26, 60, 109, 1);
    transform: scale(1.1);
} 