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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
}

/* Boutons de sélection des calques */
#layer-selector {
    position: absolute;
    top: 20px;
    left: 50px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 10px;
}

.layer-btn {
    padding: 10px 20px;
    border: 2px solid #ccc;
    background: white;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.layer-btn:hover {
    border-color: #999;
    background: #f8f8f8;
}

.layer-btn.active {
    background: #cc0000;
    color: white;
    border-color: #cc0000;
}

.layer-btn.active:hover {
    background: #990000;
    border-color: #990000;
}

/* Panneau de statistiques */
#stats-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow-y: auto;
}

#stats-panel h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 3px solid #cc0000;
    padding-bottom: 10px;
}

#stats-panel h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #555;
    font-weight: 600;
}

.stats-section {
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

.stat-value {
    color: #cc0000;
    font-weight: bold;
    font-size: 14px;
}

#top-communes {
    font-size: 13px;
}

.top-commune-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #f8f8f8;
    border-radius: 4px;
    transition: background 0.2s;
}

.top-commune-item:hover {
    background: #ffe0e0;
}

.commune-rank {
    color: #999;
    font-weight: bold;
    margin-right: 8px;
}

.commune-name {
    flex: 1;
    color: #333;
}

.commune-count {
    color: #cc0000;
    font-weight: bold;
}

#distribution {
    font-size: 13px;
}

.distribution-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 6px;
    background: #f8f8f8;
    border-radius: 4px;
}

.distribution-color {
    width: 30px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ddd;
    margin-right: 10px;
}

.distribution-label {
    flex: 1;
    color: #333;
}

.distribution-count {
    color: #666;
    font-weight: bold;
}

/* Légende */
#legend {
    position: absolute;
    bottom: 30px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
}

#legend h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
}

#legend-items {
    font-size: 13px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ddd;
    margin-right: 10px;
}

.legend-label {
    color: #333;
}

/* Leaflet popup custom styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.popup-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    border-bottom: 2px solid #cc0000;
    padding-bottom: 5px;
}

.popup-count {
    font-size: 14px;
    color: #cc0000;
    font-weight: bold;
    margin-bottom: 10px;
}

.popup-monuments {
    max-height: 300px;
    overflow-y: auto;
}

.popup-monument-item {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #555;
}

.popup-monument-item:last-child {
    border-bottom: none;
}

.popup-monument-type {
    color: #999;
    font-size: 11px;
    font-style: italic;
}

/* Leaflet tooltip custom styling */
.leaflet-tooltip {
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    padding: 6px 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.leaflet-tooltip-top:before {
    border-top-color: rgba(0, 0, 0, 0.8);
}

.leaflet-tooltip-bottom:before {
    border-bottom-color: rgba(0, 0, 0, 0.8);
}

.leaflet-tooltip-left:before {
    border-left-color: rgba(0, 0, 0, 0.8);
}

.leaflet-tooltip-right:before {
    border-right-color: rgba(0, 0, 0, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
    #stats-panel {
        width: calc(100% - 40px);
        max-height: 40vh;
    }

    #legend {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
}

/* Scrollbar styling */
#stats-panel::-webkit-scrollbar,
.popup-monuments::-webkit-scrollbar {
    width: 6px;
}

#stats-panel::-webkit-scrollbar-track,
.popup-monuments::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#stats-panel::-webkit-scrollbar-thumb,
.popup-monuments::-webkit-scrollbar-thumb {
    background: #cc0000;
    border-radius: 3px;
}

#stats-panel::-webkit-scrollbar-thumb:hover,
.popup-monuments::-webkit-scrollbar-thumb:hover {
    background: #990000;
}
