/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #0a1628;
    color: #e0e8f0;
    overflow: hidden;
    height: 100vh;
}

/* ===== 顶部标题栏 ===== */
.header {
    height: 56px;
    background: linear-gradient(135deg, #0d2137 0%, #132d4a 100%);
    border-bottom: 1px solid rgba(64,158,255,0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.header .title {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(90deg, #409eff, #67c8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 4px;
}
.header .time-display {
    font-size: 14px;
    color: #8ab4d6;
}

/* ===== 主体布局 ===== */
.main-content {
    display: flex;
    height: calc(100vh - 56px);
}

/* 左侧: 组态图 */
.topology-panel {
    flex: 1;
    position: relative;
    border-right: 1px solid rgba(64,158,255,0.15);
}
.topology-panel .panel-title {
    position: absolute;
    top: 8px;
    left: 16px;
    z-index: 10;
    font-size: 14px;
    color: #409eff;
    background: rgba(10,22,40,0.8);
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid rgba(64,158,255,0.2);
}

/* 右侧: 数据面板 */
.data-panel {
    width: 360px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: rgba(13,33,55,0.6);
}

/* 右侧面板区块 */
.panel-section {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(64,158,255,0.1);
}
.panel-section .section-title {
    font-size: 13px;
    color: #409eff;
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 3px solid #409eff;
}

/* 系统概览指标卡 */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.overview-card {
    background: rgba(20,45,75,0.7);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(64,158,255,0.12);
}
.overview-card .label {
    font-size: 11px;
    color: #7ea4c4;
    margin-bottom: 4px;
}
.overview-card .value {
    font-size: 20px;
    font-weight: 700;
    color: #67c8ff;
}
.overview-card .unit {
    font-size: 11px;
    color: #7ea4c4;
    margin-left: 2px;
}
.overview-card.warning .value { color: #e6a23c; }
.overview-card.success .value { color: #67c23a; }

/* 设备状态列表 */
.device-list {
    max-height: 200px;
    overflow-y: auto;
}
.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(64,158,255,0.06);
    font-size: 12px;
}
.device-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}
.device-item .dot.running { background: #67c23a; box-shadow: 0 0 6px #67c23a; }
.device-item .dot.stopped { background: #909399; }
.device-item .dot.alarm { background: #f56c6c; animation: blink 1s infinite; }
.device-item .device-name { flex: 1; }
.device-item .device-val { color: #8ab4d6; font-family: "Consolas", monospace; }
.device-item .toggle-btn {
    background: none;
    border: 1px solid rgba(64,158,255,0.3);
    color: #409eff;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    margin-left: 8px;
}
.device-item .toggle-btn:hover {
    background: rgba(64,158,255,0.15);
}

/* 告警区 */
.alarm-list {
    max-height: 120px;
    overflow-y: auto;
}
.alarm-item {
    padding: 6px 10px;
    margin-bottom: 4px;
    background: rgba(245,108,108,0.1);
    border-left: 3px solid #f56c6c;
    border-radius: 2px;
    font-size: 12px;
    color: #f5a6a6;
}
.alarm-item .alarm-time {
    color: #8ab4d6;
    font-size: 11px;
    margin-right: 8px;
}
.no-alarm {
    font-size: 12px;
    color: #67c23a;
    text-align: center;
    padding: 16px;
}

/* 底部趋势图区域 */
.charts-panel {
    height: 200px;
    display: flex;
    border-top: 1px solid rgba(64,158,255,0.15);
    background: rgba(10,22,40,0.5);
}
.chart-box {
    flex: 1;
    position: relative;
    border-right: 1px solid rgba(64,158,255,0.08);
}
.chart-box:last-child { border-right: none; }
.chart-box .chart-title {
    position: absolute;
    top: 6px;
    left: 12px;
    font-size: 12px;
    color: #409eff;
    z-index: 10;
}

/* ===== 动画 ===== */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== 设备弹窗 ===== */
.device-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #132d4a;
    border: 1px solid rgba(64,158,255,0.3);
    border-radius: 8px;
    padding: 20px;
    z-index: 1000;
    min-width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.device-popup.show { display: block; }
.device-popup .popup-title {
    font-size: 16px;
    font-weight: 700;
    color: #67c8ff;
    margin-bottom: 12px;
}
.device-popup .popup-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(64,158,255,0.06);
}
.device-popup .popup-row .val {
    color: #67c8ff;
    font-family: "Consolas", monospace;
}
.device-popup .popup-actions {
    margin-top: 16px;
    text-align: right;
}
.device-popup .btn {
    padding: 6px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    margin-left: 8px;
}
.device-popup .btn-primary {
    background: #409eff;
    color: #fff;
}
.device-popup .btn-danger {
    background: #f56c6c;
    color: #fff;
}
.device-popup .btn-default {
    background: rgba(64,158,255,0.15);
    color: #8ab4d6;
    border: 1px solid rgba(64,158,255,0.3);
}
.popup-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.popup-overlay.show { display: block; }

/* 自定义滚动条 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(64,158,255,0.3); border-radius: 2px; }
