/* ============================================================
   theme.css — 设计 Token（§1.2）+ 全局基础样式
   禽类病原检测数字大屏 Demo
   ============================================================ */

:root {
  /* ===== 自适应缩放系数（JS 按 min(w/1920, h/1080) 写入，基准 1920×1080 = 1） ===== */
  --ui-scale: 1;
  /* ===== 背景 ===== */
  --bg-deep:        #050A17;
  --bg-panel:       #0A1428;
  --bg-panel-glass: rgba(10, 20, 40, 0.55);

  /* ===== 主色系：青蓝 ===== */
  --primary:        #00D4FF;
  --primary-deep:   #0090D8;
  --primary-glow:   rgba(0, 212, 255, 0.35);

  /* ===== 强调色：荧光绿 ===== */
  --accent:         #00FFA3;
  --accent-glow:    rgba(0, 255, 163, 0.30);

  /* ===== 告警色 ===== */
  --warn:           #FF5C5C;
  --warn-mid:       #FF9F43;
  --warn-glow:      rgba(255, 92, 92, 0.35);

  /* ===== 辅助色板 ===== */
  --c1: #00D4FF; --c2: #00FFA3; --c3: #7B61FF; --c4: #FFD166;
  --c5: #FF6B9D; --c6: #4DD8FF; --c7: #B8F34E; --c8: #FF9F43;

  /* ===== 文本 ===== */
  --text-main:      #EAF6FF;
  --text-sub:       #8FA6C8;
  --text-dim:       #5A7298;

  /* ===== 线条与边框 ===== */
  --line-grid:      rgba(64, 120, 190, 0.16);
  --border-panel:   rgba(0, 212, 255, 0.25);
  --border-corner:  #00D4FF;

  /* ===== 字体 ===== */
  --font-display: "Orbitron", "Rajdhani", "DIN Alternate", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body:    "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--font-body);
  color: var(--text-main);
  cursor: none; /* 演示干净：默认隐藏光标，鼠标移动恢复 */
}

html.mouse-active, html.mouse-active body { cursor: default; }

#viewport {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ===== 自适应画布：铺满视口（100vw×100vh），固定尺寸区块按 --ui-scale 缩放，
   main 图表区 flex:1 弹性吸收剩余高度 → 任意分辨率无黑边 ===== */
#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  flex: none;
  background:
    radial-gradient(ellipse 60% 45% at 18% 8%, rgba(0, 90, 180, 0.20), transparent 60%),
    radial-gradient(ellipse 55% 40% at 88% 90%, rgba(0, 60, 160, 0.18), transparent 60%),
    var(--bg-deep);
  overflow: hidden;
  padding: calc(22px * var(--ui-scale)) calc(24px * var(--ui-scale)) calc(20px * var(--ui-scale));
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--ui-scale));
}

/* ===== 背景网格（氛围层） ===== */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

#particle-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ===== 扫描光带（顶部 2px 青蓝 6s 横扫） ===== */
.scan-beam {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  height: 3px;
  z-index: 2;
  background: linear-gradient(90deg, transparent, var(--primary), #ffffff, var(--primary), transparent);
  filter: blur(0.5px) drop-shadow(0 0 8px var(--primary));
  animation: scan 6s linear infinite;
  pointer-events: none;
}
@keyframes scan {
  0%   { transform: translateX(-340px); opacity: 0; }
  4%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateX(105vw); opacity: 0; }
}

/* ===== 标题流光 ===== */
@keyframes title-shine {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ============================================================
   A 顶部标题栏
   ============================================================ */
.header {
  position: relative;
  z-index: 3;
  flex: none;
  height: calc(84px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(6px * var(--ui-scale));
}

.header-brand {
  width: 380px;
  display: flex;
  align-items: center;
}
.brand-chip {
  font-size: calc(15px * var(--ui-scale));
  letter-spacing: calc(3px * var(--ui-scale));
  color: var(--text-sub);
  border: 1px solid var(--border-panel);
  background: var(--bg-panel-glass);
  padding: calc(6px * var(--ui-scale)) calc(14px * var(--ui-scale));
  border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(0, 212, 255, 0.08);
}

.header-title-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.header-title {
  font-family: var(--font-display);
  font-size: calc(34px * var(--ui-scale));
  font-weight: 700;
  letter-spacing: calc(8px * var(--ui-scale));
  color: transparent;
  background: linear-gradient(90deg,
    var(--primary-deep) 0%, var(--primary) 25%, #ffffff 50%,
    var(--primary) 75%, var(--primary-deep) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  animation: title-shine 5s linear infinite;
  text-shadow: 0 0 22px var(--primary-glow);
  white-space: nowrap;
}
.header-sub {
  margin-top: calc(2px * var(--ui-scale));
  font-family: var(--font-display);
  font-size: calc(12px * var(--ui-scale));
  letter-spacing: calc(5px * var(--ui-scale));
  color: var(--text-dim);
  white-space: nowrap;
}
.header-deco {
  margin-top: calc(6px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(8px * var(--ui-scale));
}
.deco-line {
  width: calc(220px * var(--ui-scale));
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
}
.deco-diamond {
  width: calc(7px * var(--ui-scale));
  height: calc(7px * var(--ui-scale));
  transform: rotate(45deg);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.header-right {
  width: calc(380px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(12px * var(--ui-scale));
}
.period-badge {
  font-family: var(--font-display);
  font-size: calc(13px * var(--ui-scale));
  letter-spacing: calc(1px * var(--ui-scale));
  color: var(--accent);
  border: 1px solid rgba(0, 255, 163, 0.4);
  background: rgba(0, 255, 163, 0.07);
  padding: calc(5px * var(--ui-scale)) calc(12px * var(--ui-scale));
  border-radius: 3px;
  white-space: nowrap;
}
.clock-box {
  text-align: right;
}
.clock {
  font-family: var(--font-display);
  font-size: calc(22px * var(--ui-scale));
  font-weight: 700;
  letter-spacing: calc(2px * var(--ui-scale));
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary-glow);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  /* 防跳动：固定 19 字符等宽槽位（YYYY-MM-DD HH:mm:ss），数字变化不左右位移 */
  display: inline-block;
  min-width: 19ch;
  text-align: right;
}
.clock-date {
  font-size: calc(11px * var(--ui-scale));
  color: var(--text-dim);
  letter-spacing: 2px;
  text-align: right;
}
.icon-btn {
  width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  background: var(--bg-panel-glass);
  border: 1px solid var(--border-panel);
  color: var(--primary);
  font-size: calc(17px * var(--ui-scale));
  border-radius: 4px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, color .2s, background-color .2s, transform .2s, opacity .2s, max-height .2s;
  line-height: 1;
}
.icon-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  color: #fff;
}

/* ============================================================
   全局筛选器（客户第一诉求）
   ============================================================ */
.filter-bar {
  position: relative;
  z-index: 3;
  flex: none;
  height: calc(52px * var(--ui-scale));
  display: flex;
  align-items: center;
  gap: calc(14px * var(--ui-scale));
  padding: 0 calc(16px * var(--ui-scale));
  background: var(--bg-panel-glass);
  border: 1px solid var(--border-panel);
  border-radius: 6px;
}
.filter-label {
  display: flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale));
  font-size: calc(14px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: calc(2px * var(--ui-scale));
  color: var(--primary);
  white-space: nowrap;
}
.filter-dot {
  width: calc(8px * var(--ui-scale));
  height: calc(8px * var(--ui-scale));
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%,100% {opacity:1} 50% {opacity:.3} }

.filter-group {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale));
}
.filter-group label {
  font-size: calc(12px * var(--ui-scale));
  color: var(--text-sub);
  letter-spacing: calc(1px * var(--ui-scale));
  white-space: nowrap;
}
.filter-group select {
  height: calc(30px * var(--ui-scale));
  min-width: calc(118px * var(--ui-scale));
  background: rgba(5, 12, 26, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-panel);
  border-radius: 4px;
  font-size: calc(13px * var(--ui-scale));
  font-family: var(--font-body);
  padding: 0 calc(8px * var(--ui-scale));
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
}
.filter-group select:hover, .filter-group select:focus {
  border-color: var(--primary);
}
.f-sep { color: var(--text-dim); }
.filter-reset {
  height: calc(30px * var(--ui-scale));
  padding: 0 calc(14px * var(--ui-scale));
  background: rgba(255, 92, 92, 0.12);
  color: var(--warn);
  border: 1px solid rgba(255, 92, 92, 0.45);
  border-radius: 4px;
  font-size: calc(13px * var(--ui-scale));
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, color .2s, background-color .2s, transform .2s, opacity .2s, max-height .2s;
}
.filter-reset:hover {
  background: rgba(255, 92, 92, 0.25);
  box-shadow: 0 0 10px var(--warn-glow);
}
.filter-state {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale));
  font-size: calc(12px * var(--ui-scale));
  color: var(--text-sub);
  white-space: nowrap;
}
.state-dot {
  width: calc(7px * var(--ui-scale));
  height: calc(7px * var(--ui-scale));
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.filter-state.filtered .state-dot { background: var(--warn-mid); box-shadow: 0 0 6px var(--warn-mid); }
.filter-state.filtered { color: var(--warn-mid); }

/* ============================================================
   B 六大 KPI 卡
   ============================================================ */
.kpi-row {
  position: relative;
  z-index: 3;
  flex: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: calc(14px * var(--ui-scale));
}
.kpi-card {
  position: relative;
  height: calc(108px * var(--ui-scale));
  display: flex;
  align-items: center;
  gap: calc(14px * var(--ui-scale));
  padding: 0 calc(18px * var(--ui-scale));
  background: var(--bg-panel-glass);
  border: 1px solid var(--border-panel);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color .25s, box-shadow .25s, transform .25s; /* 不含尺寸：resize 时高度立即跟随 --ui-scale */
}
.kpi-card::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--primary), transparent 85%);
  opacity: .55;
}
.kpi-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow), inset 0 0 30px rgba(0,212,255,.05);
  transform: translateY(-2px);
}
.kpi-icon {
  width: calc(44px * var(--ui-scale));
  height: calc(44px * var(--ui-scale));
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(22px * var(--ui-scale));
  color: var(--primary);
  border: 1px solid var(--border-panel);
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.07);
  box-shadow: inset 0 0 10px rgba(0, 212, 255, 0.12);
}
.kpi-value {
  font-family: var(--font-display);
  font-size: calc(38px * var(--ui-scale));
  font-weight: 700;
  line-height: 1.05;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px var(--primary-glow);
}
.kpi-value.green { color: var(--accent); text-shadow: 0 0 14px var(--accent-glow); }
.kpi-value.orange { color: var(--warn-mid); text-shadow: 0 0 14px rgba(255,159,67,.35); }
.kpi-value.red { color: var(--warn); text-shadow: 0 0 14px var(--warn-glow); }
.kpi-label {
  margin-top: calc(4px * var(--ui-scale));
  font-size: calc(13px * var(--ui-scale));
  color: var(--text-sub);
  letter-spacing: 1px;
}
.kpi-ring {
  position: absolute;
  right: calc(14px * var(--ui-scale));
  top: 50%;
  transform: translateY(-50%);
  width: calc(44px * var(--ui-scale));
  height: calc(44px * var(--ui-scale));
  opacity: .9;
}
.ring-bg { fill: none; stroke: rgba(0, 212, 255, 0.15); stroke-width: 3; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 119.4; /* 2π×19 */
  stroke-dashoffset: 119.4;
  transform: rotate(-90deg);
  transform-origin: center;
  filter: drop-shadow(0 0 4px var(--accent));
}

/* ============================================================
   中部图表区
   ============================================================ */
.main-area {
  position: relative;
  z-index: 3;
  flex: 1;
  display: grid;
  grid-template-columns: 5.2fr 5.2fr 3.4fr;
  gap: calc(14px * var(--ui-scale));
  min-height: 0;
}
.chart-col {
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--ui-scale));
  min-height: 0;
  min-width: 0;
}
.chart-col-narrow { min-width: 0; }

/* ===== 面板通用 ===== */
.panel {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--bg-panel-glass);
  border: 1px solid var(--border-panel);
  border-radius: 6px;
  padding: calc(10px * var(--ui-scale)) calc(12px * var(--ui-scale)) calc(6px * var(--ui-scale));
  display: flex;
  flex-direction: column;
  transition: border-color .3s, box-shadow .3s;
  animation: panel-in .7s cubic-bezier(.2,.7,.3,1) both;
}
.panel:hover {
  border-color: var(--primary);
  box-shadow: 0 0 18px rgba(0,212,255,.12);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel::before, .panel::after,
.panel > .corner {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 5;
}
/* 四角 L 形科技角标 */
.panel::before { top: -1px; left: -1px; border-top: 2px solid var(--border-corner); border-left: 2px solid var(--border-corner); border-top-left-radius: 6px; }
.panel::after  { bottom: -1px; right: -1px; border-bottom: 2px solid var(--border-corner); border-right: 2px solid var(--border-corner); border-bottom-right-radius: 6px; }

.panel-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
  padding-bottom: calc(6px * var(--ui-scale));
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
}
.panel-title {
  font-size: calc(16px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: calc(2px * var(--ui-scale));
  color: var(--text-main);
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0,212,255,.25);
}
.panel-title::before {
  content: "";
  display: inline-block;
  width: calc(4px * var(--ui-scale));
  height: calc(15px * var(--ui-scale));
  margin-right: calc(8px * var(--ui-scale));
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  vertical-align: -2px;
}
.panel-tag {
  font-family: var(--font-display);
  font-size: calc(10px * var(--ui-scale));
  letter-spacing: calc(2px * var(--ui-scale));
  color: var(--text-dim);
  border: 1px solid var(--line-grid);
  padding: calc(2px * var(--ui-scale)) calc(7px * var(--ui-scale));
  border-radius: 3px;
  white-space: nowrap;
}
.panel-link {
  margin-left: auto;
  font-size: calc(11px * var(--ui-scale));
  color: var(--text-dim);
  white-space: nowrap;
}
.panel-link b { color: var(--warn-mid); font-weight: 600; }

.panel-body {
  flex: 1;
  min-height: 0;
  position: relative;
}
.panel-body > div { width: 100%; height: 100%; }

/* 视图切换按钮（H 区块 柱状/地图） */
.view-toggle {
  margin-left: auto;
  display: flex;
  border: 1px solid var(--border-panel);
  border-radius: 4px;
  overflow: hidden;
}
.vt-btn {
  padding: calc(3px * var(--ui-scale)) calc(12px * var(--ui-scale));
  font-size: calc(12px * var(--ui-scale));
  background: transparent;
  color: var(--text-sub);
  border: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, color .2s, background-color .2s, transform .2s, opacity .2s, max-height .2s;
  font-family: var(--font-body);
}
.vt-btn.active {
  background: rgba(0, 212, 255, 0.18);
  color: var(--primary);
}

/* ============================================================
   I 底部 LIVE 滚动条
   ============================================================ */
.ticker {
  position: relative;
  z-index: 3;
  flex: none;
  height: calc(56px * var(--ui-scale));
  display: flex;
  align-items: center;
  background: var(--bg-panel-glass);
  border: 1px solid var(--border-panel);
  border-radius: 6px;
  overflow: hidden;
}
.ticker-live {
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  height: 100%;
  padding: 0 calc(18px * var(--ui-scale));
  font-family: var(--font-display);
  font-size: calc(14px * var(--ui-scale));
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  background: rgba(0, 255, 163, 0.06);
  border-right: 1px solid var(--border-panel);
  white-space: nowrap;
}
.live-dot {
  width: calc(9px * var(--ui-scale));
  height: calc(9px * var(--ui-scale));
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: breathe 1.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 4px var(--accent); transform: scale(1); }
  50%      { box-shadow: 0 0 16px var(--accent); transform: scale(1.35); }
}
.ticker-track {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 0;
  animation: ticker-move linear infinite;
  will-change: transform;
}
.ticker-inner:hover { animation-play-state: paused; }
@keyframes ticker-move {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.ticker-item {
  font-size: calc(14px * var(--ui-scale));
  color: var(--text-sub);
  padding: 0 calc(14px * var(--ui-scale));
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.ticker-item::after {
  content: "│";
  color: var(--text-dim);
  margin-left: 28px;
  font-size: 12px;
}
.ticker-item .tk-date { color: var(--primary); font-family: var(--font-display); font-size: calc(13px * var(--ui-scale)); margin-right: calc(8px * var(--ui-scale)); }
.ticker-item .tk-path { color: var(--warn); font-weight: 600; margin-left: 6px; text-shadow: 0 0 8px var(--warn-glow); }
.ticker-item.no-pos .tk-path { color: var(--text-dim); }

/* ============================================================
   报告模式弹窗
   ============================================================ */
.report-mask {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 16, 0.72);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
}
.report-mask.show { display: flex; }
.report-modal {
  width: 640px;
  max-height: 78%;
  background: var(--bg-panel);
  border: 1px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.report-head {
  padding: 14px 18px;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--primary);
  border-bottom: 1px solid var(--border-panel);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.report-close {
  cursor: pointer;
  font-size: 22px;
  color: var(--text-dim);
  line-height: 1;
}
.report-close:hover { color: var(--warn); }
.report-body {
  flex: 1;
  overflow: auto;
  padding: 16px 18px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-all;
}
.report-actions {
  padding: 12px 18px;
  border-top: 1px solid var(--border-panel);
  display: flex;
  justify-content: flex-end;
}
.report-btn {
  padding: 8px 22px;
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, color .2s, background-color .2s, transform .2s, opacity .2s, max-height .2s;
}
.report-btn:hover { background: rgba(0, 212, 255, 0.3); box-shadow: 0 0 12px var(--primary-glow); }

/* ===== 加载占位 ===== */
.loading-tip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 2px;
}
