/* Modern map styling */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

#map {
    width: 100%;
    height: 100vh;
    transition: filter 0.3s ease;
}

[data-theme="dark"] .leaflet-tile {
    filter: brightness(0.8) contrast(1.2) saturate(0.8);
}

.over_map_container {
    z-index: 1000;
    position: fixed;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

#controllers_container {
    top: 20px;
    left: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

#results_container {
    top: 80px;
    right: 30px;
    max-width: 450px;
    min-width: 350px;
}

#legend_container {
    bottom: 30px;
    right: 30px;
    max-width: 450px;
}

#legend_max_controls_container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.legend-colors-container {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    margin: 10px 0;
}

.legend {
    padding: 15px;
    background-color: var(--legend-bg);
    border: none;
    border-radius: 12px;
    margin: 20px;
    box-shadow: 0 4px 15px var(--shadow);
    backdrop-filter: blur(10px);
}

.legend h4 {
    margin-top: 0;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.legend p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 15px;
    margin-bottom: 5px;
}

.legend-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-secondary);
    padding: 10px;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 5px;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-bottom: 5px;
    box-sizing: border-box;
    box-shadow: 0 2px 4px var(--shadow);
}

.legend-editable-color {
    border: 2px solid var(--accent-color);
    cursor: pointer;
}

.legend-label {
    font-size: 12px;
    text-align: center;
    color: var(--text-primary);
}

input.legend-label {
    width: 35px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 2px 4px;
    text-align: center;
}

input[type="color"] {
    border: none;
    background: none;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #controllers_container {
        top: 10px;
        left: 10px;
    }
    
    #results_container {
        top: 60px;
        right: 20px;
        max-width: 300px;
        min-width: 280px;
    }
    
    #legend_container {
        bottom: 20px;
        right: 20px;
        max-width: 300px;
    }
    
    .options_panel {
        max-width: 280px;
    }
}

/* Spinner styles */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-secondary);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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