/* 实况预览 · 对齐 NVR-NAS /ops/preview 三栏工作台 */

.content.video-ops-bleed {
  padding: 8px 16px 16px;
  min-height: 0;
}

.vms-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - 140px);
}

.vms-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.vms-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 650;
  font-size: 0.86rem;
  cursor: pointer;
}
.vms-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
}

.vms-workbench {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 260px;
  gap: 12px;
  height: calc(100vh - 200px);
  min-height: 520px;
  align-items: stretch;
}
.vms-left,
.vms-right {
  padding: 10px;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.vms-center {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}
.vms-pane-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.vms-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  flex-shrink: 0;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}

.ch-tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1;
}
.ch-tree-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.ch-tree-tools input {
  width: 100%;
}
.ch-tree-list {
  overflow: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ch-tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 0.86rem;
}
.ch-tree-row:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.ch-tree-row.selected {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.ch-tree-row.active {
  outline: 1px solid var(--accent);
}
.ch-tree-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ch-tree-row .dot.on { background: var(--ok, #1a9f6e); }
.ch-tree-row .dot.off { background: #94a3b8; }
.ch-tree-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.ch-tree-row .meta {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.layout-icon-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.layout-icon-btn {
  width: 34px;
  height: 28px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.layout-icon-btn.active,
.layout-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.video-grid,
.vms-grid {
  display: grid;
  gap: 6px;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #070b10;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  overflow: hidden;
}
.video-grid.layout-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.video-grid.layout-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.video-grid.layout-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
}
.video-grid.layout-6 > :nth-child(1) { grid-column: 1 / span 2; grid-row: 1 / span 2; }
.video-grid.layout-8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
}
.video-grid.layout-8 > :nth-child(1) { grid-column: 1 / span 3; grid-row: 1 / span 3; }
.video-grid.layout-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.video-grid.layout-16 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); }

.video-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #0c1218;
  cursor: pointer;
}
.video-tile.active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
}
.video-tile.empty-tile {
  cursor: default;
  opacity: 0.55;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
}
.video-tile .tile-player {
  flex: 1;
  min-height: 0;
  position: relative;
}
.video-tile .tile-player .vplayer,
.video-tile .tile-player .vplayer-stage,
.video-tile .tile-player .player-host {
  height: 100%;
  min-height: 0;
}
.video-tile .tile-player .vplayer-stage {
  aspect-ratio: auto;
  height: 100%;
}
.video-tile .tile-player video,
.video-tile .tile-player canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #070b10;
}
.video-tile .tile-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: #e2e8f0;
  font-size: 0.72rem;
}
.stream-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.ptz-panel { display: flex; flex-direction: column; gap: 12px; }
.ptz-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 168px;
  margin: 0 auto;
}
.ptz-pad button {
  height: 40px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 50%, var(--surface));
  border-radius: 8px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.ptz-pad button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ptz-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ptz-tools button,
.ptz-tools select {
  width: 100%;
}
.preset-box { display: flex; flex-direction: column; gap: 8px; }
.preset-box .row { display: flex; gap: 6px; }
.preset-box select { flex: 1; min-width: 0; }
.vms-active-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.vms-hint {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.vms-playback {
  display: none;
}
.vms-playback.show {
  display: block;
}
.vms-preview-wrap.hide {
  display: none;
}

@media (max-width: 1200px) {
  .vms-workbench {
    grid-template-columns: 220px minmax(0, 1fr);
    height: auto;
  }
  .vms-right { grid-column: 1 / -1; max-height: 280px; }
}
@media (max-width: 860px) {
  .vms-workbench { grid-template-columns: 1fr; }
  .video-grid { min-height: 360px; height: 50vh; }
}
