/* ========== 模块样式层 ==========
   盘前村智慧水务 · 通用数据面板 + GIS 地图 + 实测工作台 + 科普模块专属样式
   加载顺序：须在 base-layout.css 之后引入 */

/* ---------- 深色科技面板（Raycast 暗黑金属高光） ---------- */
.card {
    background: var(--bg-charcoal, #0E1015);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.22), 0 8px 32px rgba(0, 0, 0, 0.45);
    transition: all 0.3s ease;
}

.card:hover {
    border-top-color: rgba(0, 240, 255, 0.35);
    box-shadow: inset 0 1px 0 0 rgba(0, 240, 255, 0.35), 0 12px 40px rgba(0, 0, 0, 0.55);
}

.card-title {
    position: relative;
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
    padding-bottom: 12px;
    padding-left: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.14);
}

/* 标题栏需要在右侧挂载操作按钮时使用 */
.card-title-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* 标题左侧荧光蓝竖形标块 */
.card-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    width: 4px;
    height: 17px;
    background: #00F0FF;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

/* ---------- 传感器连接按钮 ---------- */
.sensor-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #ffc78a;
    background: rgba(255, 145, 40, 0.12);
    border: 1px solid rgba(255, 145, 40, 0.5);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    /* 未连接时持续呼吸，提示用户必须先点击 */
    animation: breathSensor 1.8s ease-in-out infinite;
}

.sensor-btn:hover {
    background: rgba(255, 145, 40, 0.22);
}

/* 圆点指示灯 */
.sensor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff9128;
    box-shadow: 0 0 8px rgba(255, 145, 40, 0.9);
    flex-shrink: 0;
}

@keyframes breathSensor {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 145, 40, 0.35); }
    50%      { box-shadow: 0 0 16px rgba(255, 145, 40, 0.75); }
}

/* 已连接：转为荧光青色常亮，指示灯快速闪烁代表数据在推送 */
.sensor-btn.connected {
    color: #7ff0ff;
    background: rgba(0, 240, 255, 0.12);
    border-color: rgba(0, 240, 255, 0.5);
    animation: none;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.28);
}

.sensor-btn.connected .sensor-dot {
    background: #00F0FF;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.9);
    animation: blinkSensor 1s steps(1, end) infinite;
}

@keyframes blinkSensor {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0.15; }
}

/* 未连接时的表格占位提示 */
.sensor-idle-tip {
    text-align: center;
    padding: 46px 20px;
    color: #A1A1AA;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* ========== GIS地图容器：按 ditu.jpg 原始 2402×1760 等比缩放 ========== */
.map-scroll-wrap { width: 100%; }

.sat-map-wrap {
    position: relative;
    width: 100%;
    max-width: 1186px;
    margin: 0 auto;
    /* 容器比例与原图一致，100% 100% 铺满不会变形，点位百分比零偏移 */
    aspect-ratio: 2402 / 1760;
    background: #222222 url("../ditu.jpg") no-repeat center center / 100% 100%;
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 240, 255, 0.15);
}

/* GIS 图下方说明文字（原 demo.html 内联样式，深色化后收归 CSS） */
.map-tip {
    margin-top: 12px;
    font-size: 14px;
    color: #A1A1AA;
}

.map-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #ff3b3b;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    /* 双层红色微光向外扩散 */
    box-shadow: 0 0 8px rgba(255, 59, 59, 0.9),
                0 0 18px rgba(255, 59, 59, 0.45);
    transition: transform 0.22s ease, box-shadow 0.28s ease;
}

.map-dot:hover {
    transform: scale(1.35);
    box-shadow: 0 0 12px rgba(255, 59, 59, 1),
                0 0 26px rgba(255, 59, 59, 0.6);
    z-index: 20;
}

.map-dot:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 12px;
    top: -6px;
    background: rgba(7, 8, 10, 0.95);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: #F4F4F5;
    font-size: 12px;
    padding: 3px 8px;
    white-space: nowrap;
    border-radius: 4px;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
    z-index: 99;
}

/* ESP32 实测节点（PQ-DEMO-001）：青绿放大 + 呼吸脉冲光环，与 126 座台账节点区分 */
.map-dot.is-iot {
    width: 16px;
    height: 16px;
    margin: -3px 0 0 -3px;
    background-color: #00F0FF;
    border: 2px solid #ffffff;
    z-index: 30;
    animation: iotPulse 1.6s ease-out infinite;
}

@keyframes iotPulse {
    0%   { box-shadow: 0 0 8px #00F0FF, 0 0 0 0 rgba(0, 240, 255, 0.7); }
    100% { box-shadow: 0 0 8px #00F0FF, 0 0 0 16px rgba(0, 240, 255, 0); }
}

/* ---------- 深色数据表格 ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #F4F4F5;
}

th {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    text-align: center;
    color: #A1A1AA;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

td {
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    text-align: center;
    color: #F4F4F5;
}

tbody tr { transition: all 0.3s ease; }
tbody tr:hover { background: rgba(0, 240, 255, 0.06); }

/* ---------- 状态标签：圆角微发光 + 呼吸灯 ---------- */
.tag-normal,
.tag-warn,
.tag-alarm {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.tag-normal {
    background: rgba(16, 92, 62, 0.55);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

/* 警告：橙色呼吸灯，2s 周期 */
.tag-warn {
    background: rgba(180, 83, 9, 0.55);
    color: #fdba74;
    border: 1px solid rgba(251, 146, 60, 0.45);
    animation: breathWarn 2s ease-in-out infinite;
}

@keyframes breathWarn {
    0%, 100% { box-shadow: 0 0 0 rgba(251, 146, 60, 0); }
    50%      { box-shadow: 0 0 14px rgba(251, 146, 60, 0.85); }
}

/* 告警：猩红呼吸灯，1.2s 急促周期 */
.tag-alarm {
    background: rgba(185, 28, 28, 0.75);
    color: #ffffff;
    border: 1px solid rgba(248, 113, 113, 0.55);
    animation: breathAlarm 1.2s ease-in-out infinite;
}

@keyframes breathAlarm {
    0%, 100% { box-shadow: 0 0 2px rgba(239, 68, 68, 0.4); }
    50%      { box-shadow: 0 0 18px rgba(239, 68, 68, 1); }
}

/* 尊重系统「减弱动态效果」偏好，关闭闪烁类动画（含实测节点脉冲） */
@media (prefers-reduced-motion: reduce) {
    .tag-warn,
    .tag-alarm,
    .map-dot.is-iot {
        animation: none;
    }
}

.chart-container {
    width: 100%;
    height: 380px;
}

.filter-bar {
    margin-bottom: 16px;
    color: #F4F4F5;
    font-size: 14px;
}

select {
    padding: 6px 10px;
    font-size: 14px;
    color: #F4F4F5;
    background: rgba(7, 8, 10, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

select:focus { border-color: #00F0FF; }

/* ========== 科普区图文并茂样式 ========== */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

/* 实景卡片：深色科技遮罩压在本地底图之上，保证白字清晰 */
.popular-card {
    position: relative;
    min-height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    overflow: hidden;
    /* 兜底底色：底图缺失时不塌成透明块 */
    background-color: #07080A;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.popular-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 224, 255, 0.55);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.6),
                0 0 20px rgba(0, 240, 255, 0.28);
}

/* 实景层：独立伪元素承载放大动效，避免遮罩一起被缩放 */
.popular-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: inherit;
    /* 放大裁取底图局部，各卡片通过 --bg-pos 取不同片区 */
    background-size: 260% auto;
    background-position: var(--bg-pos, center);
    transform: scale(1);
    transition: transform 1.2s ease;
}

.popular-card:hover::before {
    transform: scale(1.08);
}

/* 深色科技遮罩层 */
.popular-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
                rgba(7, 8, 10, 0.7) 0%,
                rgba(7, 8, 10, 0.95) 100%);
}

.popular-card-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px 22px;
}

.popular-tag {
    align-self: flex-start;
    margin-bottom: 14px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #00F0FF;
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 4px;
}

.popular-card-inner h3 {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #ffffff;
    margin-bottom: 12px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.popular-card-inner p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.75;
    margin-bottom: 14px;
}

.popular-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.popular-list li {
    position: relative;
    padding-left: 14px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.9;
}

/* 荧光青色方块项目符号 */
.popular-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 4px;
    height: 4px;
    background: #00F0FF;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.8);
}

/* ---------- 四张卡片底图：本地 ditu.jpg 不同局部 + 主题色调，断网零请求 ---------- */
.card-temp {
    --bg-pos: 15% 20%;
    background-image: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(7, 8, 10, 0.2)), url("../ditu.jpg");
}

.card-water {
    --bg-pos: 85% 30%;
    background-image: linear-gradient(135deg, rgba(0, 240, 255, 0.35), rgba(7, 8, 10, 0.2)), url("../ditu.jpg");
}

.card-variety {
    --bg-pos: 30% 85%;
    background-image: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(7, 8, 10, 0.2)), url("../ditu.jpg");
}

.card-season {
    --bg-pos: 75% 80%;
    background-image: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(7, 8, 10, 0.2)), url("../ditu.jpg");
}

/* 窄屏：两列矩阵退化为单列 */
@media (max-width: 1100px) { .popular-grid { grid-template-columns: 1fr; } }

/* ========== 驾驶舱 KPI 卡片 ========== */
.cockpit-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi-card { background: rgba(0, 240, 255, 0.08); border: 1px solid rgba(0, 240, 255, 0.25); border-radius: 8px; padding: 16px; text-align: center; transition: all 0.28s ease; }
.kpi-card:hover { background: rgba(0, 240, 255, 0.15); box-shadow: 0 0 16px rgba(0, 240, 255, 0.3); }
.kpi-label { font-size: 12px; color: #A1A1AA; margin-bottom: 8px; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 600; color: #00F0FF; }
.kpi-unit { font-size: 14px; color: #52525B; margin-left: 4px; }

/* 投影仪断点 */
@media (max-width: 1366px) { .card { padding: 16px; } .card-title { font-size: 16px; } .chart-container { height: clamp(260px, 42vh, 340px); } .popular-card { min-height: 260px; } }

/* ========== 03 物联网实测：三栏工作台 ========== */
.iot-tri-grid { display: grid; grid-template-columns: 1fr 240px 1fr; gap: 12px; min-height: 340px; }
.iot-pane { display: flex; flex-direction: column; gap: 8px; background: rgba(0,0,0,0.3); border: 1px solid rgba(0,240,255,0.15); border-radius: 6px; padding: 12px; overflow: hidden; }
.iot-pane-title { font-size: 13px; font-weight: 600; color: #00F0FF; margin-bottom: 4px; }
.iot-health { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: 11px; }
.iot-health > div { display: flex; align-items: center; gap: 6px; }
.hw-icon { width: 24px; height: 24px; color: #00F0FF; }
.hw-icon span { flex: 1; color: #A1A1AA; }
.hw-icon b { color: #00F0FF; font-family: monospace; }
.json-terminal { flex: 1; background: rgba(16,40,30,0.6); border: 1px solid rgba(16,185,129,0.3); border-radius: 4px; padding: 8px; overflow-y: auto; font-size: 10px; font-family: 'Courier New', monospace; color: #10B981; line-height: 1.4; }
.json-terminal > div { margin-bottom: 2px; white-space: pre-wrap; word-break: break-word; }
.iot-hardware-card { grid-column: 2; border-radius: 6px; }

@media (max-width: 1024px) { .card { padding: 14px; } table { font-size: 12px; } th, td { padding: 7px 6px; } .chart-container { height: clamp(220px, 38vh, 300px); } }
