/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  background: #000;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
}
#stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform-origin: center center;
  background:
    radial-gradient(ellipse at 50% 0%, #0b1a4d 0%, #070d2e 55%, #04061a 100%);
  color: #d9e6ff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== 顶栏 ========== */
#topbar {
  height: 86px;
  flex: 0 0 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: linear-gradient(180deg, rgba(16,42,110,.95) 0%, rgba(8,20,64,.75) 100%);
  border-bottom: 1px solid rgba(0,180,255,.35);
  box-shadow: 0 2px 18px rgba(0,120,255,.25);
  position: relative;
  z-index: 20;
}
.top-center { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.top-center h1 {
  font-size: 30px;
  letter-spacing: 4px;
  font-weight: 700;
  background: linear-gradient(180deg, #ffffff 20%, #8fd8ff 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 22px rgba(0,170,255,.35);
}
.title-deco {
  width: 420px; height: 4px; margin: 2px auto 0;
  background: linear-gradient(90deg, transparent, #00c8ff, #2f7bff, #00c8ff, transparent);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0,190,255,.8);
}
.top-right {
  width: 460px; display: flex; align-items: center; justify-content: flex-end;
  gap: 14px; font-size: 16px; color: #bfe3ff;
}
#clock { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: #fff; text-shadow: 0 0 10px rgba(0,200,255,.8); }
.sep { color: rgba(120,190,255,.5); }
.weather i { font-style: normal; margin-right: 4px; }

/* ========== 导航 ========== */
#tabs {
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(6,16,52,.55);
  border-bottom: 1px solid rgba(0,150,255,.25);
  z-index: 15;
}
.tab-group { display: flex; gap: 10px; }
.tab {
  position: relative;
  height: 34px;
  padding: 0 20px;
  font-size: 16px;
  color: #9fc6e8;
  background: linear-gradient(180deg, rgba(16,44,110,.6), rgba(10,28,76,.6));
  border: 1px solid rgba(0,160,255,.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all .22s;
  letter-spacing: 1px;
}
.tab:hover {
  color: #fff; border-color: #00c8ff;
  box-shadow: 0 0 12px rgba(0,180,255,.45);
  transform: translateY(-1px);
}
.tab.active {
  color: #fff;
  background: linear-gradient(180deg, #0f5cff, #0a3dcc);
  border-color: #00d4ff;
  box-shadow: 0 0 18px rgba(0,160,255,.8), inset 0 0 12px rgba(0,220,255,.28);
  transform: translateY(-1px);
  text-shadow: 0 0 10px rgba(160,230,255,.9);
}
.tab.active::after {
  content: ""; position: absolute;
  left: 15%; right: 15%; bottom: -2px;
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #00d4ff, transparent);
  box-shadow: 0 0 10px rgba(0,220,255,.95);
}

/* ========== 主体 ========== */
#main {
  flex: 1 1 auto;
  display: flex;
  gap: 14px;
  padding: 12px 18px 8px;
  min-height: 0;
}
.panel-col {
  width: 350px;
  flex: 0 0 350px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
#center-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
#scene {
  position: relative;
  flex: 1 1 auto;
  border: 1px solid rgba(0,180,255,.35);
  border-radius: 6px;
  overflow: hidden;
  background: #05102f;
  box-shadow: inset 0 0 60px rgba(0,90,220,.25), 0 0 18px rgba(0,130,255,.2);
}
#scene-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.6s ease;
}
.twin-roaming #scene-img { animation: roam 14s ease-in-out infinite; }
@keyframes roam {
  0%   { transform: scale(1.0) translate(0,0); }
  25%  { transform: scale(1.18) translate(-3%, -2%); }
  50%  { transform: scale(1.12) translate(2%, 1%); }
  75%  { transform: scale(1.22) translate(-1%, 2%); }
  100% { transform: scale(1.0) translate(0,0); }
}

/* 面板 */
.panel {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(0,170,255,.32);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(10,32,86,.72), rgba(6,18,56,.78));
  box-shadow: inset 0 0 28px rgba(0,100,255,.12), 0 2px 12px rgba(0,20,80,.4);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel::before, .panel::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border-color: #00d4ff; border-style: solid;
}
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.panel-head {
  flex: 0 0 34px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid rgba(0,170,255,.22);
  background: linear-gradient(90deg, rgba(0,140,255,.16), transparent);
}
.panel-title {
  font-size: 15px; font-weight: 700; color: #7fe0ff;
  letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.panel-title::before {
  content: ""; width: 4px; height: 16px;
  background: linear-gradient(180deg, #00d4ff, #1a6bff);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0,200,255,.9);
}
.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 10px;
  position: relative;
  overflow: hidden;
}
.panel-body .chart { width: 100%; height: 100%; }
.panel-body.scroll-body { overflow: hidden; }

/* 指标卡 */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; height: 100%; }
.kpi-card {
  border: 1px solid rgba(0,170,255,.28);
  border-radius: 5px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(0,90,220,.14), rgba(0,40,120,.1));
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
.kpi-label { font-size: 12px; color: #8fb8de; }
.kpi-value {
  font-size: 22px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(0,190,255,.6);
  line-height: 1.3;
}
.kpi-value small { font-size: 13px; color: #8fd8ff; margin-left: 2px; font-weight: 400; }
.kpi-trend { font-size: 11px; margin-top: 2px; }
.kpi-trend.up { color: #34e28a; }
.kpi-trend.down { color: #ff5c6c; }
.kpi-card.warn .kpi-value { color: #ff6b6b; text-shadow: 0 0 12px rgba(255,80,80,.6); }

/* 列表 */
.data-list { height: 100%; overflow: hidden; position: relative; }
.data-list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-list th {
  color: #7fd4ff; font-weight: 600; text-align: left; padding: 3px 5px;
  border-bottom: 1px solid rgba(0,170,255,.25);
  background: rgba(0,120,255,.08);
  position: sticky; top: 0;
}
.data-list td {
  padding: 3px 5px; color: #c9e2ff; border-bottom: 1px solid rgba(0,140,255,.08);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px;
}
.data-list .scroll-wrap { height: calc(100% - 26px); overflow: hidden; }
.data-list .scroll-body { animation: scrollUp 12s linear infinite; }
.data-list:hover .scroll-body { animation-play-state: paused; }
@keyframes scrollUp { 0% { transform: translateY(0); } 100% { transform: translateY(-50%); } }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.tag.ok { color: #34e28a; background: rgba(52,226,138,.12); border: 1px solid rgba(52,226,138,.4); }
.tag.warn { color: #ffb648; background: rgba(255,182,72,.12); border: 1px solid rgba(255,182,72,.4); }
.tag.err { color: #ff5c6c; background: rgba(255,92,108,.12); border: 1px solid rgba(255,92,108,.4); }

/* 监控画面 */
.monitor-grid { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); gap: 8px; height: 100%; }
.monitor-cell {
  border: 1px solid rgba(0,170,255,.3); border-radius: 4px;
  background: linear-gradient(160deg, #0a1c4a, #071238);
  position: relative; overflow: hidden;
}
.monitor-cell::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(120deg, transparent 40%, rgba(0,180,255,.12) 50%, transparent 60%),
    repeating-linear-gradient(0deg, rgba(0,150,255,.05) 0 2px, transparent 2px 4px);
  animation: scan 4s linear infinite;
}
@keyframes scan { 0% { background-position: -200px 0, 0 0; } 100% { background-position: 200px 0, 0 0; } }
.monitor-cell .cam-label {
  position: absolute; left: 6px; bottom: 6px; z-index: 2;
  font-size: 12px; color: #bfe9ff;
  background: rgba(0,20,60,.75); padding: 2px 8px; border-radius: 3px;
  border-left: 2px solid #00d4ff;
}
.monitor-cell .cam-ok { position: absolute; right: 6px; top: 6px; z-index: 2;
  width: 8px; height: 8px; border-radius: 50%; background: #34e28a;
  box-shadow: 0 0 8px #34e28a; animation: blink 2s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* 场景点位 */
.scene-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 5;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.scene-marker .pin {
  width: 14px; height: 14px;
  background: #00d4ff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 12px #00d4ff;
  animation: pulse 2s infinite;
}
.scene-marker.warn .pin { background: #ff4d4f; box-shadow: 0 0 14px #ff4d4f; }
.scene-marker.ok .pin { background: #34e28a; box-shadow: 0 0 12px #34e28a; }
@keyframes pulse {
  0%   { transform: scale(1); opacity: 1; }
  70%  { transform: scale(1.7); opacity: .35; }
  100% { transform: scale(1); opacity: 1; }
}
.scene-marker .pin-label {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; color: #e4f4ff;
  background: rgba(0,20,60,.8); padding: 1px 7px; border-radius: 3px;
  border: 1px solid rgba(0,200,255,.4);
}
.scene-marker:hover .pin { transform: scale(1.4); }

/* BIM 楼栋标签 */
#scene-buildings { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.building-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 5px;
  background: linear-gradient(180deg, rgba(8,30,88,.82), rgba(4,16,52,.88));
  border: 1px solid rgba(0,190,255,.42);
  border-radius: 14px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 10px rgba(0,80,200,.28), inset 0 0 10px rgba(0,140,255,.08);
  transition: all .2s;
}
.building-chip:hover {
  border-color: #00d4ff;
  box-shadow: 0 0 16px rgba(0,200,255,.55), inset 0 0 12px rgba(0,180,255,.12);
  transform: translate(-50%, -50%) scale(1.06);
}
.building-chip .b-label {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #00d4ff, #1a6bff);
  border-radius: 6px;
  text-shadow: 0 0 6px rgba(0,180,255,.8);
  box-shadow: 0 0 8px rgba(0,180,255,.5);
}
.building-chip.warn .b-label { background: linear-gradient(135deg, #ffb648, #ff7a45); box-shadow: 0 0 8px rgba(255,160,60,.5); }
.building-chip .b-name { font-size: 12px; color: #cfe9ff; white-space: nowrap; }
.building-chip .b-name::after {
  content: ""; display: block;
  width: 100%; height: 1px; margin-top: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,220,255,.7), transparent);
}

/* 监控摄像头点位 */
#scene-cams { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.cam-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
  pointer-events: auto;
}
.cam-ico {
  position: relative;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(4,16,46,.88);
  border: 1px solid rgba(0,200,255,.65);
  color: #7fe0ff;
  box-shadow: 0 0 10px rgba(0,160,255,.45);
  transition: all .2s;
}
.cam-marker.warn .cam-ico { color: #ffb648; border-color: rgba(255,182,72,.7); box-shadow: 0 0 10px rgba(255,170,60,.45); }
.cam-ico::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(0,220,255,.55);
  animation: camPulse 2.6s ease-out infinite;
}
.cam-marker.warn .cam-ico::after { border-color: rgba(255,182,72,.55); }
@keyframes camPulse {
  0%   { transform: scale(.85); opacity: .9; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
.cam-marker:hover .cam-ico { transform: scale(1.15); border-color: #00d4ff; box-shadow: 0 0 14px rgba(0,200,255,.7); }
.cam-tag {
  font-size: 11px; color: #cfe9ff;
  background: rgba(4,16,46,.82);
  padding: 1px 7px; border-radius: 3px;
  border: 1px solid rgba(0,200,255,.35);
  white-space: nowrap;
}
.cam-marker.warn .cam-tag { border-color: rgba(255,182,72,.45); color: #ffd9a0; }

/* 顶部悬浮指标 */
#scene-top-kpis {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 24px; z-index: 6;
  background: linear-gradient(90deg, rgba(0,40,110,.75), rgba(0,70,160,.75));
  border: 1px solid rgba(0,200,255,.4);
  border-radius: 6px;
  padding: 8px 26px;
  box-shadow: 0 0 18px rgba(0,140,255,.35);
}
.scene-kpi { text-align: center; }
.scene-kpi .v { font-size: 22px; font-weight: 700; color: #fff; text-shadow: 0 0 10px rgba(0,200,255,.7); }
.scene-kpi .l { font-size: 12px; color: #8fc8e8; margin-top: 2px; }

/* 弹窗 */
#drill-popup {
  position: absolute; z-index: 30;
  width: 330px;
  border: 1px solid rgba(0,200,255,.55);
  border-radius: 8px;
  background: rgba(5,16,48,.96);
  box-shadow: 0 8px 30px rgba(0,80,220,.35), 0 0 18px rgba(0,160,255,.35);
  overflow: hidden;
}
#drill-popup.hidden, #scene-overlay.hidden { display: none; }
.drill-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(0,120,255,.28), rgba(0,80,200,.08));
  border-bottom: 1px solid rgba(0,170,255,.25);
}
.drill-title {
  color: #7fe0ff; font-size: 15px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.drill-title::before {
  content: ""; width: 4px; height: 15px;
  background: linear-gradient(180deg, #00d4ff, #1a6bff);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0,200,255,.8);
}
.drill-body { padding: 10px 14px 12px; }
#drill-popup .row { display: flex; gap: 10px; font-size: 13px; padding: 5px 0; }
#drill-popup .row .k { flex: 0 0 44px; color: #6fa8d8; }
#drill-popup .row .v { flex: 1; color: #dfefff; line-height: 1.55; }
#drill-popup .row .v.status { font-weight: 700; }
#drill-popup .row .v.status.good { color: #34e28a; text-shadow: 0 0 8px rgba(52,226,138,.5); }
#drill-popup .row .v.status.bad { color: #ff6b6b; text-shadow: 0 0 8px rgba(255,90,90,.5); }
#drill-popup .close {
  cursor: pointer; color: #8fb8de; font-size: 18px; line-height: 1;
}
#drill-popup .close:hover { color: #fff; }

/* 数字孪生控制 */
#twin-controls {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 10px; z-index: 8;
}
.twin-btn {
  padding: 8px 16px;
  font-size: 14px; color: #bfe9ff;
  background: linear-gradient(180deg, rgba(0,80,180,.55), rgba(0,45,120,.55));
  border: 1px solid rgba(0,200,255,.45);
  border-radius: 4px;
  cursor: pointer;
  transition: all .2s;
}
.twin-btn:hover, .twin-btn.active {
  color: #fff; border-color: #00d4ff;
  box-shadow: 0 0 12px rgba(0,180,255,.6);
}

/* 场景覆盖层（推演/仿真） */
#scene-overlay {
  position: absolute; inset: 0; z-index: 7;
  pointer-events: none;
}
#scene-overlay.fire { background: radial-gradient(ellipse at 58% 40%, rgba(255,90,20,.35), transparent 55%); animation: fireFade 3s ease-in-out infinite; }
@keyframes fireFade { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
#scene-overlay.flow .dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #00e0ff; box-shadow: 0 0 8px #00e0ff;
  animation: flowMove linear infinite;
}
@keyframes flowMove {
  0%   { left: -10px; top: 50%; }
  25%  { left: 35%; top: 32%; }
  50%  { left: 60%; top: 55%; }
  75%  { left: 80%; top: 38%; }
  100% { left: 105%; top: 60%; }
}
#scene-overlay.flow .dot.car { width: 10px; height: 4px; border-radius: 2px; background: #ffd166; box-shadow: 0 0 8px #ffd166; }

/* 底部 */
#footer {
  flex: 0 0 46px;
  display: flex; align-items: center;
  padding: 0 24px;
  background: rgba(6,16,52,.65);
  border-top: 1px solid rgba(0,150,255,.25);
  z-index: 12;
}
.footer-ticker { display: flex; align-items: center; width: 100%; gap: 14px; overflow: hidden; }
.ticker-label {
  flex: 0 0 auto;
  font-size: 13px; color: #fff;
  background: linear-gradient(90deg, #0f5cff, #0a3dcc);
  padding: 3px 12px; border-radius: 3px;
  box-shadow: 0 0 8px rgba(0,150,255,.5);
}
.ticker-box { flex: 1; overflow: hidden; height: 24px; position: relative; }
.ticker-content {
  position: absolute; white-space: nowrap;
  font-size: 13px; color: #9fc6e8;
  animation: ticker 28s linear infinite;
}
@keyframes ticker { 0% { left: 100%; } 100% { left: -100%; } }

/* 图表公共 */
.chart-tip {
  position: absolute; right: 12px; top: 10px;
  font-size: 11px; color: #6fa8d8;
}
.tooltip-style {
  background: rgba(4,16,48,.94);
  border: 1px solid rgba(0,190,255,.5);
  color: #dfefff;
  box-shadow: 0 0 12px rgba(0,140,255,.35);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: rgba(0,180,255,.4); border-radius: 2px; }
