@import '../../css/variables.css';

/* 地图应用样式 */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
}

/* 地图容器样式 */
#map-container {
    height: 100vh;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* 控制栏样式 */
.control-bar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 300px;
    text-align: center;
}

/* 按钮通用样式 */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 0 5px;
}

/* 加载按钮 */
#load-data-btn {
    background-color: #3498db;
    color: white;
}

#load-data-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

#load-data-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* 加载最后一次数据按钮 */
#load-last-data-btn {
    background-color: #2ecc71;
    color: white;
}

#load-last-data-btn:hover:not(:disabled) {
    background-color: #27ae60;
}

#load-last-data-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* 停止按钮 */
#stop-query-btn {
    background-color: #e74c3c;
    color: white;
    display: none; /* 默认隐藏 */
}

#stop-query-btn:hover {
    background-color: #c0392b;
}

/* 状态容器 */
.status-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 400px;
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

#progress-bar {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s ease;
}

/* 进度文本 */
#progress-text {
    font-weight: 500;
    color: #2c3e50;
}

#progress-stats {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 2px;
}

/* 错误视图 */
#error-view {
    padding: 10px;
    border-radius: 4px;
    background-color: #fdf2f0;
}

#error-message {
    color: #e74c3c;
    font-size: 13px;
    font-weight: 500;
}

#error-detail {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 4px;
}

/* 弹窗样式 */
.popup-content {
    min-width: 200px;
    font-size: 13px;
}

.popup-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.popup-info {
    margin-bottom: 4px;
    line-height: 1.4;
}

/* 通知样式 */
.notification-stack {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 11050;
    pointer-events: none;
    width: min(92vw, 420px);
}

.notification {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: auto;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-info {
    border-left: 4px solid var(--info-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

.notification-error {
    border-left: 4px solid var(--error-color);
}

.notification-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.notification-progress-bar {
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius-full);
    overflow: hidden;
}

.notification-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--info-color), var(--primary-color));
    transition: width var(--transition-normal);
}

.notification-progress-stats {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-align: right;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--bg-secondary);
        color: var(--text-primary);
    }

    .control-bar,
    .status-container {
        background-color: var(--surface-overlay);
        color: var(--text-primary);
        border: 1px solid var(--border-light);
        box-shadow: var(--shadow-map-panel);
        backdrop-filter: blur(16px);
    }

    #load-data-btn,
    #load-last-data-btn,
    #stop-query-btn {
        color: var(--on-accent);
    }

    #load-data-btn {
        background-color: var(--primary-color);
    }

    #load-data-btn:hover:not(:disabled) {
        background-color: var(--primary-hover);
    }

    #load-last-data-btn {
        background-color: var(--secondary-color);
    }

    #load-last-data-btn:hover:not(:disabled) {
        background-color: var(--secondary-hover);
    }

    #stop-query-btn {
        background-color: var(--error-color);
    }

    #stop-query-btn:hover {
        background-color: var(--error-hover);
    }

    #load-data-btn:disabled,
    #load-last-data-btn:disabled {
        background-color: var(--bg-quaternary);
        color: var(--text-muted);
    }

    .progress-bar,
    .notification-progress-bar {
        background-color: var(--bg-tertiary);
    }

    #progress-bar,
    .notification-progress-fill {
        background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    }

    #progress-text,
    .popup-title {
        color: var(--text-primary);
    }

    #progress-stats,
    .stat-label,
    #error-detail {
        color: var(--text-secondary);
    }

    .stat-value,
    .marker-icon {
        color: var(--primary-color);
    }

    #error-view {
        background-color: var(--error-soft);
        border: 1px solid rgba(248, 113, 113, 0.28);
    }

    #error-message {
        color: var(--error-hover);
    }

    .notification {
        background-color: var(--surface-raised);
        color: var(--text-primary);
        border-color: var(--border-light);
    }

    .notification-progress-stats {
        color: var(--text-secondary);
    }

    .leaflet-div-icon {
        background: var(--surface-raised);
        border-color: var(--primary-color);
        box-shadow: var(--shadow-md);
    }
}

/* 风险标记样式 */
.risk-marker {
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.risk-marker:hover {
    opacity: 0.9;
}

/* 自定义图钉样式 */
.leaflet-div-icon {
    background: white;
    border: 2px solid #3498db;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaflet-div-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #2980b9;
}

/* 图钉图标样式 */
.marker-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #3498db;
    font-size: 14px;
}

/* 不同风险级别的图钉样式 */
.marker-red {
    border-color: #e74c3c;
    color: #e74c3c;
}

.marker-orange {
    border-color: #e67e22;
    color: #e67e22;
}

.marker-yellow {
    border-color: #f1c40f;
    color: #f1c40f;
}

.marker-blue {
    border-color: #3498db;
    color: #3498db;
}

.marker-gray {
    border-color: #7f8c8d;
    color: #7f8c8d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-bar {
        min-width: auto;
        padding: 10px;
    }

    button {
        padding: 8px 15px;
        font-size: 13px;
        margin: 2px;
    }

    .status-container {
        max-width: 100%;
        left: 10px;
        right: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
