/* style.css - Aegis 神盾应急态势感知 UI */

:root {
    /* 核心色彩基调 */
    --bg-deep: #0B1120;       /* 极夜蓝底色 */
    --hud-bg: rgba(11, 17, 32, 0.65); /* HUD 毛玻璃背景 */
    --hud-border: rgba(255, 255, 255, 0.1);
    
    /* 态势色彩 (高饱和霓虹) */
    --color-safe: #10B981;    /* 荧光绿 */
    --color-blue: #3B82F6;    /* 预警蓝 */
    --color-yellow: #FBBF24;  /* 警示黄 */
    --color-orange: #F97316;  /* 危险橙 */
    --color-red: #EF4444;     /* 致命红 */
    
    --text-main: #F3F4F6;
    --text-dim: #9CA3AF;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
    overflow: hidden; /* 锁死全局滚动，做成原生 App 体验 */
    transition: background-color 0.5s ease;
}

/* 战时状态强行覆写底色 */
body.theme-danger { background-color: #2A0808; }

/* =========================================
   🗺️ 绝对底层：地图与雷达层
========================================= */
#map-canvas {
    position: absolute;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 1;
    background: radial-gradient(circle at center, #111827 0%, #000000 100%);
}

/* 赛博朋克网格底图 */
.map-grid-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.5;
}

/* 模拟雷达扫描动画 */
.radar-scan {
    position: absolute;
    top: 50%; left: 50%;
    width: 200vw; height: 200vw;
    margin-left: -100vw; margin-top: -100vw;
    background: conic-gradient(from 0deg, transparent 70%, rgba(16, 185, 129, 0.15) 100%);
    border-radius: 50%;
    animation: scan 4s linear infinite;
    pointer-events: none;
}
@keyframes scan { 100% { transform: rotate(360deg); } }

/* =========================================
   🛡️ 悬浮层通用玻璃拟态 (Glassmorphism)
========================================= */
#hud-layer {
    position: absolute;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none; /* 让点击事件穿透到下层地图 */
}

.glass-panel {
    background: var(--hud-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--hud-border);
    pointer-events: auto; /* 恢复面板本身的点击 */
}

/* =========================================
   📍 模块一：气象 HUD (顶部)
========================================= */
#weather-hud {
    margin: 40px 20px 0;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.location-badge {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 1px;
}

.pulse-dot {
    width: 8px; height: 8px;
    background-color: var(--color-safe);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 10px var(--color-safe);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.weather-core {
    display: flex;
    align-items: center;
    gap: 20px;
}

#temp-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 56px;
    font-weight: 900;
    color: #FFF;
    line-height: 1;
    text-shadow: 0 0 20px rgba(255,255,255,0.2);
}
.temp-unit { font-size: 20px; font-weight: 700; color: var(--text-dim); }

#cond-text { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.sub-stats { font-size: 12px; color: var(--text-dim); }

/* =========================================
   📖 模块三：战术卷宗卡片 (横向滑动)
========================================= */
#cases-scroll {
    margin-top: auto;
    margin-bottom: 20px;
    pointer-events: auto;
}

.section-title {
    margin: 0 20px 10px;
    font-size: 14px;
    font-weight: 700;
    color: #FFF;
    letter-spacing: 2px;
}
.section-title span { color: var(--text-dim); font-size: 11px; font-weight: normal; }

.scroll-container {
    display: flex;
    overflow-x: auto;
    padding: 0 20px;
    gap: 15px;
    -ms-overflow-style: none; scrollbar-width: none;
}
.scroll-container::-webkit-scrollbar { display: none; }

.case-card {
    flex: 0 0 260px;
    background: var(--hud-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--hud-border);
    border-radius: 12px;
    padding: 15px;
    position: relative;
    overflow: hidden;
}
.case-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.success-case::before { background-color: var(--color-safe); }
.case-tag { font-family: 'Orbitron', sans-serif; font-size: 10px; color: var(--color-safe); margin-bottom: 5px;}
.case-title { font-size: 13px; font-weight: 500; line-height: 1.5; }

/* =========================================
   🎮 模块四：底部突击按钮
========================================= */
#action-footer {
    padding: 0 20px 40px;
    pointer-events: auto;
}

.btn-cyber {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.2) 100%);
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 16px;
    padding: 18px 24px;
    color: var(--color-safe);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
    transition: all 0.2s;
}
.btn-cyber:active { transform: scale(0.98); background: rgba(16, 185, 129, 0.3); }
.btn-progress { font-family: 'Orbitron', sans-serif; font-size: 14px; }
/* =========================================
   🚨 HUD 玻璃面板：全盘预警变色系统
========================================= */
/* 默认平安状态依然使用极夜蓝磨砂 */

/* 蓝色预警状态下的磨砂面板 */
#weather-hud.hud-blue {
    background: rgba(59, 130, 246, 0.15); /* 蓝色半透明 */
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
}
/* 黄色预警状态下的磨砂面板 */
#weather-hud.hud-yellow {
    background: rgba(245, 158, 11, 0.15); /* 黄色半透明 */
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.15);
}
/* 橙色预警状态下的磨砂面板 */
#weather-hud.hud-orange {
    background: rgba(234, 88, 12, 0.15); /* 橙色半透明 */
    border-color: rgba(234, 88, 12, 0.4);
    box-shadow: 0 10px 30px rgba(234, 88, 12, 0.15);
}
/* 红色预警状态下的磨砂面板 */
#weather-hud.hud-red {
    background: rgba(239, 68, 68, 0.15); /* 红色半透明 */
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
    /* 红色警报增加轻微呼吸边框效果 */
    animation: borderBreathing 2s infinite alternate;
}
@keyframes borderBreathing {
    from { border-color: rgba(239, 68, 68, 0.3); }
    to { border-color: rgba(239, 68, 68, 0.8); }
}

/* =========================================
   📡 周边态势：战术跑马灯 (无缝循环版)
========================================= */
.surrounding-marquee-box {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    font-size: 12px;
}

.marquee-label {
    font-weight: 700;
    color: var(--text-dim);
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.marquee-label::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--color-safe);
    border-radius: 50%;
    margin-right: 6px;
}

.marquee-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    /* 左右两端保留你绝妙的渐变遮罩 */
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

/* 核心移动轨道 */
.marquee-scroll {
    display: flex;           /* 改为 flex 布局，让两组内容水平排列 */
    width: max-content;      /* 宽度无限延伸，包裹住双倍内容 */
    color: var(--text-main);
    animation: marquee-move 15s linear infinite; /* 时间可根据文字长度微调 */
}

/* 单组内容的包装盒 (为了首尾相接的呼吸感) */
.marquee-group {
    display: flex;
    padding-right: 25px; /* 补偿两组内容拼接处的间隙 */
}

.marquee-group span {
    margin-right: 25px;
    font-weight: 500;
    white-space: nowrap; /* 强制单行不换行 */
}

.warn-text { color: var(--color-yellow); font-weight: 700 !important; }
.safe-text { color: var(--color-safe); }

/* 核心魔法：刚好移动整体宽度的一半 (-50%)，然后瞬间重置，肉眼完全看不出闪烁 */
@keyframes marquee-move {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
/* =========================================
   🛰️ 顶部绝对悬浮：官方数据链路状态栏
========================================= */
#top-credit-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    /* 极夜蓝半透明底色，与 HUD 完美融合 */
    background: rgba(11, 17, 32, 0.85); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    text-align: center;
    /* 核心魔法：自动避开 iPhone 刘海屏/灵动岛，如果不是全面屏则默认 6px padding */
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 15px 6px; 
    z-index: 9998; /* 层级极高，仅次于推演全屏界面 */
    font-family: -apple-system, "PingFang SC", sans-serif;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

.credit-icon {
    font-size: 11px;
    opacity: 0.8;
    margin-right: 4px;
}
/* =========================================
   🎯 隐患扫描雷达 (Hazard Radar)
========================================= */
.radar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(239, 68, 68, 0.4);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.radar-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-red);
    font-family: 'Orbitron', sans-serif;
}

.radar-status {
    font-size: 10px;
    font-family: 'Orbitron', sans-serif;
    color: var(--color-yellow);
    letter-spacing: 1px;
}

/* 扫描闪烁动画 */
.scanning {
    animation: textBlink 0.8s infinite alternate;
}
@keyframes textBlink {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* 扫描进度条光效 */
.radar-scanner {
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, transparent, var(--color-red), transparent);
    animation: scanSweep 1.5s infinite linear;
    margin-bottom: 10px;
}
@keyframes scanSweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 列表项 UI */
.hazard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.hazard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--color-red);
    padding: 10px 12px;
    border-radius: 4px 8px 8px 4px;
    font-size: 13px;
    color: #E5E7EB;
    transition: all 0.3s ease;
}

/* 红色极危，橙色高危 */
.hazard-item.level-1 { border-left-color: #EF4444; background: rgba(239, 68, 68, 0.15); }
.hazard-item.level-2 { border-left-color: #F97316; background: rgba(249, 115, 22, 0.15); }

.hazard-name { font-weight: bold; margin-bottom: 3px; }
.hazard-type { font-size: 11px; color: var(--text-dim); }
.hazard-dist { font-family: 'Orbitron', sans-serif; color: var(--color-yellow); font-size: 14px; font-weight: bold; 
}
/* =========================================
   🗺️ 高德底图战术反转滤镜 (纯粹黑白灰版)
========================================= */
.aegis-dark-tiles {
    /* 原理：100%色彩反转(变黑底) -> 100%去色(剥离所有彩色变纯灰度) -> 压暗背景 -> 拉高对比度让路网犀利 */
    filter: invert(100%) grayscale(100%) brightness(0.8) contrast(1.2);
    -webkit-filter: invert(100%) grayscale(100%) brightness(0.8) contrast(1.2);
}