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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
}

.container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto 1fr;
    gap: 15px;
    padding: 15px;
    height: 100vh;
}

header {
    grid-column: 1 / -1;
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
    color: #1e3c72;
    font-size: 2em;
    margin-bottom: 0;
}

header h1 .subtitle {
    color: #666;
    font-size: 0.55em;
    font-weight: normal;
}

.controls {
    grid-column: 1 / -1;
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

#searchInput {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: #1e3c72;
}

.filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filters label {
    font-weight: 600;
    color: #555;
}

#typeFilter {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    background: white;
}

.stats {
    padding: 10px 20px;
    background: #1e3c72;
    color: white;
    border-radius: 5px;
    font-weight: 600;
}

#siteCount {
    font-size: 1.2em;
    color: #ffd700;
}

#map {
    grid-column: 1;
    grid-row: 3;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    z-index: 1;
    position: relative;
}

.map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 1000;
    font-size: 0.85em;
}

.map-legend h4 {
    margin: 0 0 8px 0;
    color: #1e3c72;
    font-size: 0.95em;
    border-bottom: 2px solid #1e3c72;
    padding-bottom: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
    color: #333;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 3px rgba(0,0,0,0.4);
    margin-right: 8px;
    flex-shrink: 0;
}

/* Map Style Control */
.map-style-control {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 1000 !important;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    overflow: hidden;
    max-width: 140px;
    font-size: 12px;
}

.map-style-button {
    background: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: background 0.3s;
    width: 100%;
}

.map-style-button:hover {
    background: #f0f0f0;
}

.map-style-menu {
    background: white;
    border-top: 1px solid #e0e0e0;
    min-width: 140px;
}

.map-style-option {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11px;
    color: #333;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.map-style-option:hover {
    background: #f5f5f5;
    border-left-color: #1e3c72;
}

.map-style-option.active {
    background: #e8f0fe;
    color: #1e3c72;
    font-weight: 600;
    border-left-color: #1e3c72;
}

.sidebar {
    grid-column: 2;
    grid-row: 3;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    overflow-y: auto;
}

.sidebar h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    border-bottom: 3px solid #ffd700;
    padding-bottom: 10px;
}

#siteList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.site-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #1e3c72;
    cursor: pointer;
    transition: all 0.3s;
}

.site-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.site-item h4 {
    color: #1e3c72;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.site-item p {
    font-size: 0.85em;
    color: #666;
}

.site-type {
    display: inline-block;
    padding: 3px 8px;
    background: #ffd700;
    color: #1e3c72;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    margin-top: 5px;
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}

.leaflet-popup-content {
    margin: 15px;
    font-size: 0.95em;
    line-height: 1.5;
}

.popup-content h3 {
    color: #1e3c72;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.popup-content p {
    margin: 5px 0;
    color: #555;
}

.popup-year {
    font-weight: 600;
    color: #2a5298;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #1e3c72;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #2a5298;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 500px auto;
    }

    #map {
        grid-column: 1;
    }

    .sidebar {
        grid-column: 1;
        grid-row: 4;
        max-height: 400px;
    }
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 100%);
    color: #e0e0e0;
}

body.dark-mode header {
    background: #1a1a2e;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

body.dark-mode header h1 {
    color: #64b5f6;
}

body.dark-mode header h1 .subtitle {
    color: #aaa;
}

body.dark-mode .controls {
    background: #1a1a2e;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

body.dark-mode #searchInput {
    background: #2a2a3e;
    color: #e0e0e0;
    border: 2px solid #444;
}

body.dark-mode #searchInput:focus {
    border-color: #64b5f6;
}

body.dark-mode #searchInput::placeholder {
    color: #888;
}

body.dark-mode .filters label {
    color: #ccc;
}

body.dark-mode #typeFilter {
    background: #2a2a3e;
    color: #e0e0e0;
    border: 2px solid #444;
}

body.dark-mode .stats {
    background: #0d47a1;
    color: white;
}

body.dark-mode #siteCount {
    color: #ffd700;
}

body.dark-mode .sidebar {
    background: #1a1a2e;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

body.dark-mode .sidebar h3 {
    color: #64b5f6;
    border-bottom: 3px solid #ffd700;
}

body.dark-mode .site-item {
    background: #2a2a3e;
    border-left: 4px solid #64b5f6;
}

body.dark-mode .site-item:hover {
    background: #363650;
}

body.dark-mode .site-item h4 {
    color: #64b5f6;
}

body.dark-mode .site-item h4 span {
    color: #999 !important;
}

body.dark-mode .site-item p {
    color: #aaa;
}

body.dark-mode .site-type {
    background: #ffd700;
    color: #1a1a2e;
}

body.dark-mode .map-legend {
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

body.dark-mode .map-legend h4 {
    color: #64b5f6;
    border-bottom: 2px solid #64b5f6;
}

body.dark-mode .legend-item {
    color: #e0e0e0;
}

body.dark-mode .map-style-control {
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

body.dark-mode .map-style-button {
    background: #1a1a2e;
    color: #64b5f6;
}

body.dark-mode .map-style-button:hover {
    background: #2a2a3e;
}

body.dark-mode .map-style-menu {
    background: #1a1a2e;
    border-top: 1px solid #444;
}

body.dark-mode .map-style-option {
    color: #e0e0e0;
}

body.dark-mode .map-style-option:hover {
    background: #2a2a3e;
    border-left-color: #64b5f6;
}

body.dark-mode .map-style-option.active {
    background: #1e3a5f;
    color: #64b5f6;
    border-left-color: #64b5f6;
}

body.dark-mode .sidebar::-webkit-scrollbar-track {
    background: #2a2a3e;
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: #64b5f6;
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb:hover {
    background: #42a5f5;
}
