/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background-color: #1a1a1a;
    background-image: linear-gradient(to bottom, #1a1a1a, #2a2a2a);
    min-height: 100vh;
}

/* Loading and Error Styles */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 1.2em;
    color: #7ab0ff;
    background-color: rgba(40, 40, 40, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 1.2em;
    color: #ff6b6b;
    background-color: rgba(40, 40, 40, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 80%;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px 0;
    background-color: rgba(40, 40, 40, 0.8);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

h1 {
    margin-bottom: 15px;
    color: #7ab0ff;
    font-size: 2.2em;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

h2 {
    margin-bottom: 15px;
    color: #7ab0ff;
    font-size: 1.4em;
    font-weight: 500;
    border-bottom: 2px solid #444;
    padding-bottom: 8px;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

/* Map Styles */
#map {
    height: 700px;
    flex: 1;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border: 3px solid #333;
    transition: box-shadow 0.3s ease;
}

#map:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Controls Container */
#controls-container {
    width: 320px;
    padding: 20px;
    background-color: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.filter-section, .global-controls, .legend-container, .stats-container {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}

.filter-section h2, .global-controls h2, .legend-container h2, .stats-container h2 {
    color: #7ab0ff;
}

/* Filter Styles */
.filter-group {
    margin-bottom: 18px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ccc;
    font-size: 0.95em;
}

.filter-group select, .filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 0.95em;
    background-color: #333;
    color: #e0e0e0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.filter-group select:focus, .filter-group input:focus {
    border-color: #7ab0ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(122, 176, 255, 0.2);
}

/* Button Styles */
button {
    padding: 10px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

/* Legend Styles */
.legend-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.legend-controls button {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9em;
}

#legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

#legend::-webkit-scrollbar {
    width: 6px;
}

#legend::-webkit-scrollbar-track {
    background: #333;
    border-radius: 10px;
}

#legend::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
}

#legend::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.95em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(50, 50, 50, 0.9);
    border: 1px solid #444;
    position: relative;
    margin-bottom: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    color: #e0e0e0;
}

.legend-item:hover {
    background-color: #3a3a3a;
    transform: translateX(3px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.legend-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    border: 2px solid #3498db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    background-color: #3498db;
    transition: all 0.2s ease;
}

.legend-item-hidden .legend-checkbox {
    background-color: transparent;
    color: transparent;
}

.legend-icon {
    width: 28px;
    height: 36px;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.legend-item-hidden {
    opacity: 0.7;
    background-color: #222;
    border-color: #333;
}

.legend-item-hidden .legend-icon {
    filter: grayscale(100%);
    opacity: 0.5;
}

/* Progress Stats */
#progress-stats {
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    background-color: #333;
    border-radius: 8px;
    color: #e0e0e0;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

#collected-count, #percentage {
    color: #7ab0ff;
}

/* Marker Styles */
.leaflet-marker-icon.collected {
    opacity: 0.4;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.leaflet-marker-icon {
    transition: all 0.3s ease;
}

.leaflet-marker-icon:hover {
    transform: scale(1.2);
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }
    
    #controls-container {
        width: 100%;
        margin-top: 20px;
    }
    
    #map {
        height: 500px;
    }
    
    .legend-item:hover {
        transform: none;
    }
}

/* Leaflet Control Styling */
.leaflet-control-zoom {
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-zoom a {
    background-color: #333 !important;
    color: #e0e0e0 !important;
    transition: all 0.2s ease;
}

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

/* Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    background-color: #333 !important;
    color: #e0e0e0 !important;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content {
    margin: 15px;
    line-height: 1.5;
}

.leaflet-popup-tip {
    background-color: #333 !important;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.legend-item, button, .filter-group select, .filter-group input {
    animation: fadeIn 0.3s ease-in-out;
}