/**
 * 地图可视化样式模块
 * 版本: 1.1.0
 * 变更记录:
 * - 1.1.0: 添加热力图样式优化，增强视觉效果和动画
 * - 1.0.0: 新建文件，包含Leaflet地图、聚类、热力图等相关样式
 */

/* ========== 地图容器 ========== */
#map {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    box-shadow: var(--shadow-md);
}

#mapContainer {
    animation: fadeIn 0.3s ease-in-out;
}

/* ========== Leaflet弹窗样式 ========== */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 12px 16px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========== 聚类中心图标 ========== */
.cluster-center-icon {
    background: transparent !important;
    border: none !important;
}

/* ========== 地图控件 ========== */
.leaflet-control-layers {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
}

/* ========== 全屏控件 ========== */
.leaflet-control-fullscreen a {
    background-color: var(--color-white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.leaflet-control-fullscreen a:hover {
    background-color: var(--color-gray-50);
}

.leaflet-container:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
}

.leaflet-container:fullscreen {
    width: 100% !important;
    height: 100% !important;
}

/* ========== 噪声点标记 ========== */
.noise-marker {
    filter: drop-shadow(0 0 3px rgba(107, 114, 128, 0.5));
}

/* ========== 热力图样式优化 ========== */
.leaflet-heatmap-layer {
    /* 增强热力图的渲染效果 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    opacity: 0.95;
    transition: opacity 0.3s ease-in-out;
}

/* 热力图容器动画 */
.leaflet-heatmap-layer canvas {
    animation: heatmapFadeIn 0.5s ease-in-out;
}

@keyframes heatmapFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 热力图模式下的地图容器优化 */
#map.heatmap-mode {
    transition: all 0.3s ease;
}

/* 热力图提示样式 */
.heatmap-legend {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    line-height: 1.5;
}

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

.heatmap-legend-color {
    width: 20px;
    height: 10px;
    margin-right: 8px;
    border-radius: 2px;
}

#refreshMapBtn {
    background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.35);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

#refreshMapBtn:hover {
    background: linear-gradient(135deg, #fb923c 0%, #f87171 100%);
    box-shadow: 0 14px 30px rgba(249, 115, 22, 0.45);
}

#refreshMapBtn:focus {
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.35), 0 12px 28px rgba(239, 68, 68, 0.3);
}

/* ========== 响应式地图高度 ========== */
@media (max-width: 768px) {
    #map {
        height: var(--map-height-mobile) !important;
    }
}

/* ========== 地图加载进度条 ========== */
.map-loading-bar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.map-loading-bar .bar-fill {
    height: 20px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.map-loading-bar .bar-text {
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@media (max-width: 640px) {
    .map-loading-bar {
        width: 90%;
        max-width: 280px;
    }
}

