/* War Database - Map Styles for Leaflet */

.map-container {
    flex: 1;
    position: relative;
    background-color: #0d1117;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background: #0d1117;
}

/* Override Leaflet default styles for dark theme */
.leaflet-container {
    background: #0d1117;
    font-family: inherit;
}

.leaflet-control-zoom {
    border: none !important;
}

.leaflet-control-zoom a {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
    border: 1px solid #30363d !important;
}

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

.leaflet-control-attribution {
    background: rgba(22, 27, 34, 0.8) !important;
    color: #8b949e !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: #58a6ff !important;
}

/* Custom marker styles */
.conflict-marker-icon {
    background: transparent !important;
    border: none !important;
}

.marker-pin {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marker-pin:hover {
    transform: scale(1.3);
}

.marker-pin.ongoing {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(255, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
    }
}

/* Popup styles */
.leaflet-popup-content-wrapper {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-content {
    margin: 12px 16px !important;
    color: #e6edf3 !important;
}

.leaflet-popup-tip {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
}

.leaflet-popup-close-button {
    color: #8b949e !important;
    font-size: 20px !important;
    padding: 8px !important;
}

.leaflet-popup-close-button:hover {
    color: #e6edf3 !important;
}

/* Tooltip styles */
.conflict-tooltip {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 4px !important;
    color: #e6edf3 !important;
    font-size: 12px !important;
    padding: 6px 10px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important;
}

.conflict-tooltip::before {
    border-top-color: #30363d !important;
}

/* Reset Map Button */
.reset-map-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 999;
    padding: 8px 14px;
    background: rgba(22, 27, 34, 0.95);
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
}

.reset-map-btn.visible {
    display: block;
}

.reset-map-btn:hover {
    background: #30363d;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 30px;
    left: 10px;
    background-color: rgba(22, 27, 34, 0.95);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 999;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin: 2px -8px;
    font-size: 0.8rem;
    color: #8b949e;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.legend-item.clickable {
    cursor: pointer;
}

.legend-item.clickable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.legend-item.clickable:not(.active) {
    opacity: 0.4;
}

.legend-item.clickable:not(.active) .legend-marker {
    background-color: #666 !important;
    box-shadow: none !important;
    animation: none !important;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.legend-marker.ongoing {
    background-color: #ff4444;
    box-shadow: 0 0 8px #ff4444;
    animation: pulse 2s infinite;
}

.legend-marker.war {
    background-color: #ff8c00;
}

.legend-marker.colonization {
    background-color: #9b59b6;
}

.legend-marker.massacre {
    background-color: #e74c3c;
}

/* Marker Cluster Styles */
.marker-cluster {
    background: transparent !important;
}

.cluster-icon {
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

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

.cluster-icon.cluster-small {
    width: 16px;
    height: 16px;
}

.cluster-icon.cluster-medium {
    width: 18px;
    height: 18px;
}

.cluster-icon.cluster-large {
    width: 20px;
    height: 20px;
}

/* Cluster colors based on ongoing status */
.cluster-icon.cluster-ongoing {
    background: #ff4444;
    box-shadow: 0 0 10px #ff4444;
    animation: pulse 2s infinite;
}

.cluster-icon.cluster-historical {
    background: #ff8c00;
    box-shadow: 0 0 6px #ff8c00;
}

/* Override default markercluster styles */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform 0.2s ease-out, opacity 0.2s ease-in;
}

/* Responsive */
@media (max-width: 768px) {
    .map-legend {
        bottom: 10px;
        left: 10px;
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .legend-marker {
        width: 10px;
        height: 10px;
    }
}
