/* ============================================================================
   三维监控 HUD 样式（demo css/app.css 的平台移植版）
   隔离策略：
     1) 所有规则都挂在 #view3D 作用域下 —— 平台 style.css 的同名类不受影响；
     2) 与平台 style.css 冲突的短类名加 h 前缀改名：
        .card→.hcard .kpi→.hkpi .btn→.hbtn .badge→.hbadge .row→.hrow
        .toolbar→.htoolbar .hint→.hhint .alarm-*→.halarm-* @slideIn→@hslideIn
     3) 未冲突的复合类（hud/panel-kpi/unit-row/dtag/...）沿用 demo 原名，
        保证 dashboard.js 与 demo 视觉逐像素一致。
   ============================================================================ */

/* ---------- 三维视图容器（抵消 main 的 padding，视口铺满） ---------- */
#view3D {
  position: relative;
  margin: -14px -20px 0;
  height: calc(100vh - 128px);   /* 顶栏 ~60 + 底栏 ~40 + 余量 */
  overflow: hidden;
  background: #060a10;
}
#view3D #gl { position: absolute; inset: 0; display: block; }

/* ---------- HUD 根层（不挡画布交互，面板各自恢复 pointer-events） ---------- */
#view3D .hud-root { position: absolute; inset: 0; pointer-events: none; }
#view3D .hud-root > * { pointer-events: auto; }

/* ---------- 通用 HUD 面板 ---------- */
#view3D .hud {
  position: absolute; z-index: 10; border-radius: 12px;
  background: rgba(9, 17, 27, 0.84);
  border: 1px solid rgba(72, 140, 200, 0.26);
  backdrop-filter: blur(8px);
}
#view3D .hud-title {
  font-size: 12px; font-weight: 500; letter-spacing: 1px; color: #7fb6e0;
  padding: 10px 14px 8px; border-bottom: 1px solid rgba(72, 140, 200, 0.16);
  display: flex; align-items: center;
}
#view3D .hud-title .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #35c2ff; margin-right: 7px; box-shadow: 0 0 8px #35c2ff;
}
#view3D .hud-more { margin-left: auto; font-size: 11px; color: #5f87a8; cursor: pointer; font-style: normal; }
#view3D .hud-more:hover { color: #35c2ff; }

/* ---------- 按钮（改名 .hbtn，避免与平台 .btn 冲突） ---------- */
#view3D .hbtn {
  font-family: inherit; font-size: 12px; color: #9ec4e2; cursor: pointer;
  padding: 7px 14px; border-radius: 9px; background: rgba(9, 17, 27, 0.84);
  border: 1px solid rgba(72, 140, 200, 0.28); transition: all .18s; white-space: nowrap;
}
#view3D .hbtn:hover { color: #eaf6ff; border-color: rgba(53, 194, 255, 0.7); }
#view3D .hbtn.on { color: #0a1420; background: #35c2ff; border-color: #35c2ff; }
#view3D .hbtn.primary { color: #06131f; background: #35c2ff; border-color: #35c2ff; }
#view3D .hbtn.primary:hover { filter: brightness(1.12); color: #06131f; }
#view3D .link { color: #5fa8dd; cursor: pointer; font-style: normal; margin-right: 8px; }
#view3D .link:hover { color: #35c2ff; text-decoration: underline; }
#view3D .hbadge { font-size: 11px; padding: 2px 8px; border-radius: 9px; border: 1px solid currentColor; }

/* ---------- KPI 面板（左上） ---------- */
#view3D .panel-kpi { top: 16px; left: 16px; width: 248px; }
#view3D .kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(72, 140, 200, 0.14); }
#view3D .hkpi { background: rgba(9, 17, 27, 0.9); padding: 11px 14px; cursor: pointer; transition: background .16s; }
#view3D .hkpi:hover { background: rgba(53, 194, 255, 0.14); }
#view3D .hkpi .k { font-size: 11px; color: #6b93b2; margin-bottom: 5px; }
#view3D .hkpi .v { font-size: 18px; color: #eaf6ff; font-family: Consolas, Monaco, monospace; }
#view3D .hkpi .v small { font-size: 11px; color: #7fb6e0; margin-left: 3px; font-family: inherit; }
#view3D .unit-list { padding: 6px 12px 12px; }
#view3D .unit-row { display: flex; align-items: center; justify-content: space-between;
  padding: 7px 2px; font-size: 12px; border-bottom: 1px dashed rgba(72, 140, 200, 0.14); cursor: pointer; }
#view3D .unit-row:last-child { border-bottom: none; }
#view3D .unit-row:hover .nm { color: #35c2ff; }
#view3D .unit-row .nm { color: #a9c8df; }

/* ---------- 告警面板（右上，改名 .halarm-*） ---------- */
#view3D .panel-alarm { top: 16px; right: 16px; width: 276px; max-height: 44vh; display: flex; flex-direction: column; }
#view3D .halarm-list { overflow-y: auto; padding: 6px 10px 10px; }
#view3D .halarm-list::-webkit-scrollbar { width: 4px; }
#view3D .halarm-list::-webkit-scrollbar-thumb { background: rgba(72, 140, 200, 0.35); border-radius: 2px; }
#view3D .halarm-item { display: flex; gap: 9px; padding: 8px 4px; font-size: 12px; cursor: pointer;
  border-bottom: 1px dashed rgba(72, 140, 200, 0.14); animation: hslideIn .3s ease; }
#view3D .halarm-item:hover { background: rgba(53, 194, 255, 0.08); }
#view3D .halarm-item:last-child { border-bottom: none; }
@keyframes hslideIn { from { transform: translateY(-6px); } to { transform: none; } }
#view3D .halarm-item .lv { width: 3px; border-radius: 2px; flex: none; }
#view3D .halarm-item .lv.critical { background: #ff5a5a; }
#view3D .halarm-item .lv.warning { background: #ffb347; }
#view3D .halarm-item .lv.info { background: #35c2ff; }
#view3D .halarm-item .txt { color: #c3dbf0; line-height: 1.5; }
#view3D .halarm-item .txt b { font-weight: 500; color: #e6f3ff; }
#view3D .halarm-item .tm { font-size: 11px; color: #5f87a8; font-family: Consolas, monospace; margin-top: 2px; }
#view3D .halarm-empty { padding: 18px 14px; font-size: 12px; color: #5f87a8; text-align: center; }

/* ---------- 图例（左下） ---------- */
#view3D .panel-legend { bottom: 158px; left: 16px; width: 186px; padding-bottom: 11px; }
#view3D .lg-row { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: #9ab6cd;
  margin: 7px 14px 0; }
#view3D .lg-row i { width: 16px; height: 4px; border-radius: 2px; flex: none; }
#view3D .lg-row .st { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- 机组卡片（底部居中，改名 .hcard / .hrow） ---------- */
#view3D .cards { bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px;
  background: none; border: none; backdrop-filter: none; }
#view3D .hcard { width: 218px; border-radius: 12px; background: rgba(9, 17, 27, 0.86);
  border: 1px solid rgba(72, 140, 200, 0.26); backdrop-filter: blur(8px); padding: 11px 14px 13px;
  cursor: pointer; transition: border-color .2s, transform .2s; }
#view3D .hcard:hover { border-color: rgba(53, 194, 255, 0.65); transform: translateY(-2px); }
#view3D .hcard.active { border-color: #35c2ff; }
#view3D .hcard .hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
#view3D .hcard .hd .nm { font-size: 13px; color: #e4f2ff; }
#view3D .hcard .hrow { display: flex; justify-content: space-between; font-size: 11.5px; color: #7fa4c2;
  margin-top: 5px; font-family: Consolas, Monaco, monospace; }
#view3D .hcard .hrow b { color: #d5e9fa; font-weight: 400; }
#view3D .hcard .bar { height: 4px; border-radius: 2px; background: rgba(72, 140, 200, 0.2); margin-top: 8px; overflow: hidden; }
#view3D .hcard .bar i { display: block; height: 100%; border-radius: 2px; transition: width .6s ease; }
#view3D .hcard .link { margin-right: 6px; }

/* ---------- 工具条（顶部居中，改名 .htoolbar） ---------- */
#view3D .htoolbar { top: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px;
  background: none; border: none; backdrop-filter: none; }

/* ---------- 设备详情面板（右下） ---------- */
#view3D .panel-detail { bottom: 158px; right: 16px; width: 288px; display: none; }
#view3D .panel-detail.show { display: block; animation: hslideIn .25s ease; }
#view3D .panel-detail .close { margin-left: auto; font-size: 14px; color: #5f87a8; cursor: pointer; font-style: normal; }
#view3D .panel-detail .close:hover { color: #eaf6ff; }
#view3D .dbody { padding: 10px 14px 14px; max-height: 52vh; overflow-y: auto; }
#view3D .dbody::-webkit-scrollbar { width: 4px; }
#view3D .dbody::-webkit-scrollbar-thumb { background: rgba(72, 140, 200, 0.35); border-radius: 2px; }
#view3D .dr { display: flex; justify-content: space-between; font-size: 12px; padding: 6px 0;
  border-bottom: 1px dashed rgba(72, 140, 200, 0.14); }
#view3D .dr:last-child { border-bottom: none; }
#view3D .dr span { color: #7fa4c2; }
#view3D .dr b { color: #e2f1fd; font-weight: 400; font-family: Consolas, Monaco, monospace; }
#view3D .dacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
#view3D .vbtn { flex: 1 1 30%; font-family: inherit; font-size: 12px; color: #cfe9ff; cursor: pointer;
  padding: 7px 0; border-radius: 8px; background: rgba(53, 194, 255, 0.12);
  border: 1px solid rgba(53, 194, 255, 0.45); transition: all .18s; }
#view3D .vbtn:hover { background: #35c2ff; color: #06131f; }
#view3D .vbtn.danger { color: #ffc9c9; background: rgba(255, 90, 90, 0.12); border-color: rgba(255, 90, 90, 0.5); }
#view3D .vbtn.danger:hover { background: #ff5a5a; color: #1b0707; }
#view3D .vbtn:disabled { opacity: 0.55; cursor: wait; }

/* ---------- 操作提示（左下角） ---------- */
#view3D .hhint { position: absolute; bottom: 10px; left: 16px; font-size: 11px; color: #4a6b86;
  z-index: 10; line-height: 1.7; }

/* ---------- 设备详情里的绑点实时值 ---------- */
#view3D .dsec { font-size: 11.5px; color: #7fb6e0; margin: 10px 0 6px; }
#view3D .dtags { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
#view3D .dtag { display: flex; align-items: baseline; gap: 5px; font-size: 11px; padding: 4px 6px;
  border-radius: 6px; background: rgba(6, 12, 20, 0.66); border: 1px solid rgba(72, 140, 200, 0.16); }
#view3D .dtag span { color: #8fb4cf; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view3D .dtag b { font-family: Consolas, monospace; font-weight: 400; }
#view3D .dtag em { font-style: normal; color: #5f87a8; font-size: 10px; }
#view3D .dtag.bad { border-color: rgba(255, 90, 90, 0.5); }
#view3D .dtag.set { border-color: rgba(255, 179, 71, 0.42); background: rgba(255, 179, 71, 0.07); }
#view3D .dtag .wr { font-style: normal; font-size: 9px; color: #ffb347; border: 1px solid rgba(255, 179, 71, 0.6);
  border-radius: 3px; padding: 0 2px; vertical-align: 1px; }
#view3D .dtag-more { font-size: 11px; color: #5f87a8; margin-top: 7px; line-height: 1.6; }

/* ---------- 远程设定（写点位下发） ---------- */
#view3D .dset { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
#view3D .dset span { font-size: 11.5px; color: #9ec4e2; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view3D .dset input { width: 74px; font-family: Consolas, monospace; font-size: 12px; color: #eaf6ff;
  background: rgba(6, 12, 20, 0.9); border: 1px solid rgba(72, 140, 200, 0.36); border-radius: 7px;
  padding: 5px 7px; outline: none; }
#view3D .dset input:focus { border-color: #35c2ff; box-shadow: 0 0 0 2px rgba(53, 194, 255, 0.18); }
#view3D .dset input.err { border-color: #ff5a5a; color: #ffc9c9; }
#view3D .dset em { font-style: normal; font-size: 11px; color: #7fb6e0; width: 32px; }
#view3D .mini { font-family: inherit; font-size: 11.5px; color: #9ec4e2; cursor: pointer; padding: 5px 10px;
  border-radius: 7px; background: rgba(9, 17, 27, 0.8); border: 1px solid rgba(72, 140, 200, 0.3); }
#view3D .mini:hover { color: #eaf6ff; border-color: #35c2ff; }
#view3D .mini.primary { color: #06131f; background: #35c2ff; border-color: #35c2ff; }
#view3D .mini:disabled { opacity: 0.55; cursor: wait; }
