/* =====================================================================
 * 海康 · 芜湖交警大屏演示 —— 公共样式
 * 深色科技蓝主题 / 1920x1080 设计稿 / 自适应缩放
 * ===================================================================== */

:root {
  --bg-deep: #030b1a;
  --bg-panel: rgba(9, 30, 62, 0.72);
  --bg-panel-2: rgba(6, 22, 48, 0.85);
  --line: #1d9bf0;
  --line-soft: rgba(29, 155, 240, 0.25);
  --cyan: #00e5ff;
  --blue: #2f8bff;
  --green: #00d68f;
  --orange: #ff9f2e;
  --red: #ff4d5e;
  --purple: #a97bff;
  --text: #eaf4ff;
  --text-dim: #8fb2d9;
  --text-mute: #5d7ea6;
  --radius: 4px;
  --gap: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Alibaba PuHuiTi", "HarmonyOS Sans SC", "Microsoft YaHei",
    "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 自适应缩放舞台 ---------- */
#screen-stage {
  position: fixed;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  background: var(--bg-deep);
  overflow: hidden;
}
#screen-root {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(29, 155, 240, 0.20), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(0, 229, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(169, 123, 255, 0.10), transparent 60%),
    var(--bg-deep);
}
#screen-root::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(29, 155, 240, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 155, 240, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 85%);
}

/* ---------- 顶部标题栏 ---------- */
.screen-header {
  position: relative;
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.screen-header h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 4px;
  background: linear-gradient(180deg, #ffffff 10%, #6fd4ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.35);
}
.screen-header::before {
  content: "";
  position: absolute;
  left: 40px; right: 40px; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  opacity: .8;
}
.header-meta {
  position: absolute;
  top: 22px;
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.header-meta.left { left: 44px; }
.header-meta.right { right: 44px; text-align: right; }
.header-meta .hl { color: var(--cyan); font-weight: 600; }

/* ---------- 主体 ---------- */
.screen-body {
  position: relative;
  flex: 1 1 auto;
  padding: 10px 18px 14px;
  display: grid;
  gap: var(--gap);
  min-height: 0;
  z-index: 4;
}
.col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; min-width: 0; }

/* ---------- 面板 ---------- */
.panel {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  backdrop-filter: blur(2px);
}
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  border: 2px solid var(--cyan);
  pointer-events: none;
}
.panel::before { left: -1px; top: -1px; border-right: none; border-bottom: none; }
.panel::after { right: -1px; bottom: -1px; border-left: none; border-top: none; }

.panel-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  font-size: 16px;
  font-weight: 600;
  color: #cfeaff;
  letter-spacing: 1px;
}
.panel-title::before {
  content: "";
  width: 4px; height: 15px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  box-shadow: 0 0 8px var(--cyan);
}
.panel-title .sub {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
  letter-spacing: 0;
}
.panel-body { flex: 1 1 auto; position: relative; min-height: 0; }

/* ---------- 图表容器 ---------- */
.chart { width: 100%; height: 100%; }

/* ---------- KPI 卡片 ---------- */
.kpi-row { display: flex; gap: var(--gap); flex: 0 0 auto; }
.kpi {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(29,155,240,.20), rgba(9,30,62,.55));
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--cyan);
  border-radius: 3px;
  overflow: hidden;
}
.kpi .kpi-label { font-size: 13px; color: var(--text-dim); letter-spacing: .5px; }
.kpi .kpi-value {
  margin-top: 4px;
  font-family: "DIN Alternate", "Bahnschrift", Consolas, monospace;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 16px rgba(0, 229, 255, .55);
}
.kpi .kpi-value .unit { font-size: 13px; font-weight: 400; color: var(--text-dim); margin-left: 3px; }
.kpi .kpi-foot { margin-top: 2px; font-size: 12px; color: var(--text-mute); }
.kpi .kpi-foot .up { color: var(--red); }
.kpi .kpi-foot .down { color: var(--green); }
.kpi.green { border-left-color: var(--green); }
.kpi.orange { border-left-color: var(--orange); }
.kpi.red { border-left-color: var(--red); }
.kpi.purple { border-left-color: var(--purple); }

/* ---------- 列表 / 排行榜 ---------- */
.rank-list { list-style: none; height: 100%; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.rank-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 3px;
  background: rgba(29, 155, 240, .07);
  animation: rowIn .45s ease both;
}
.rank-list li .idx {
  flex: 0 0 20px; height: 20px; line-height: 20px;
  text-align: center; font-size: 12px; font-weight: 700;
  border-radius: 3px; color: #06233f;
  background: linear-gradient(180deg, #9fd8ff, #4ea8ff);
}
.rank-list li:nth-child(1) .idx { background: linear-gradient(180deg, #ffe27a, #ffb31f); }
.rank-list li:nth-child(2) .idx { background: linear-gradient(180deg, #e8f3ff, #a9c6e0); }
.rank-list li:nth-child(3) .idx { background: linear-gradient(180deg, #ffc99b, #ef8f43); }
.rank-list li .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d8ecff; }
.rank-list li .val { flex: 0 0 auto; font-family: Consolas, monospace; color: var(--cyan); font-weight: 600; }

@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 表格 ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: #a9d4ff;
  background: rgba(13, 44, 84, .95);
  font-size: 13px;
}
.data-table tbody td { padding: 6px 8px; color: #cfe4fb; border-bottom: 1px dashed rgba(29,155,240,.16); }
.data-table tbody tr:nth-child(even) { background: rgba(29, 155, 240, .05); }
.data-table tbody tr:hover { background: rgba(0, 229, 255, .10); }
.table-wrap { height: 100%; overflow: hidden; position: relative; }
.table-wrap .scroll-anim { will-change: transform; }
.td-num { font-family: Consolas, monospace; color: var(--cyan); }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: 12px;
  line-height: 18px;
  border-radius: 9px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.tag.green { color: var(--green); background: rgba(0, 214, 143, .10); }
.tag.orange { color: var(--orange); background: rgba(255, 159, 46, .10); }
.tag.red { color: var(--red); background: rgba(255, 77, 94, .10); }
.tag.blue { color: var(--blue); background: rgba(47, 139, 255, .10); }
.tag.cyan { color: var(--cyan); background: rgba(0, 229, 255, .10); }
.tag.gray { color: var(--text-mute); background: rgba(93, 126, 166, .10); }

/* ---------- 滚动条 ---------- */
.scroll-y { overflow-y: auto; }
.scroll-y::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: rgba(29, 155, 240, .45); border-radius: 3px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }

/* ---------- 闪烁提示 ---------- */
@keyframes flash { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.blink { animation: flash 1.2s infinite; }
@keyframes pulseRing {
  0% { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- 空状态 ---------- */
.empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-mute); font-size: 14px; }

/* ---------- 全屏按钮 ---------- */
.fullscreen-btn {
  position: absolute;
  right: 16px; top: 24px;
  z-index: 20;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  background: rgba(29, 155, 240, .12);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  cursor: pointer;
  font-size: 15px;
  user-select: none;
}
.fullscreen-btn:hover { color: var(--cyan); border-color: var(--cyan); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
