body { 
    margin: 0; 
    padding: 0; 
}

#map { 
    position: absolute; 
    top: 0; 
    bottom: 0; 
    width: 100%; 
}

/* Custom styles for clusters */
.custom-cluster {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #647eff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

/* Mapbox popup styling */
.mapboxgl-popup-content {
    padding: 15px 20px;
    border-radius: 8px;
    min-width: 180px;
}

.mapboxgl-popup-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: bold;
}

.mapboxgl-popup-content p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Bigger close button for popup */
.mapboxgl-popup-close-button {
    font-size: 24px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    padding: 0;
    margin: 0;
    top: 5px;
    right: 5px;
}

.mapboxgl-popup-close-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Legend overlay */
#legend {
    position: absolute;
    top: 10px;
    left: 10px;
    background: white;
    padding: 6px 14px 6px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 0;
    max-width: 300px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 1;
    transition: box-shadow 0.3s ease, height 0.2s;
}

#legend:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

#legend h3 {
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #555;
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.legend-dot.analyzed {
    background-color: #ff9193;
    border: 3px solid #f24e51;
    box-sizing: border-box;
}

.legend-dot.not-analyzed {
    background-color: #ff9193;
}

.legend-dot.demolished {
    background-color: #ffe27a;
}

.legend-note {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #777;
    line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    #legend {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 15px;
    }
    
    #legend h3 {
        font-size: 14px;
    }
    
    .legend-item {
        font-size: 13px;
    }
    
    .legend-note {
        font-size: 11px;
    }
}

/* Adjust Mapbox controls to avoid legend overlap */
.mapboxgl-ctrl-top-left {
    top: 360px;
    left: 10px; /* Align with legend */
}

@media (max-width: 640px) {
    .mapboxgl-ctrl-top-left {
        top: 240px;
        left: 10px;
    }
}

/* Scale control styling */
.mapboxgl-ctrl-bottom-right {
    bottom: 20px;
    right: 10px;
}

.mapboxgl-ctrl-scale {
    background-color: rgba(255, 255, 255, 0.8);
    border: 2px solid #333;
    border-top: none;
    padding: 0 5px;
    font-size: 11px;
}

/* Attribution positioning */
.mapboxgl-ctrl-attrib {
    margin-bottom: 5px;
}