/* A8h: read-only vehicle passage clips browser. */

/* Top controls bar */
.vclips-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.vclips-controls .btn--primary { flex-shrink: 0; }

/* Filter chips row */
.vclips-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.vclips-filter {
  cursor: pointer;
  border: none;
  padding: 0;
  background: none;
}
.vclips-filter .chip--active {
  box-shadow: 0 0 0 2px var(--accent);
}

/* Writer status hint */
.vclips-writer-hint {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.vclips-writer-hint--on {
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.vclips-writer-hint--off {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* Summary metrics grid */
.vclips-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* Clip card list */
.vclips-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Single clip card */
.vclip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.vclip-card__video {
  width: 100%;
  max-height: 360px;
  background: #000;
  display: block;
}
.vclip-card__video-wrap {
  position: relative;
  background: #000;
}
.vclip-card__video-wrap .vclip-card__video {
  position: relative;
  z-index: 1;
}
.vclip-card__video--unavailable {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
}
.vclip-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.vclip-card__overlay-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.vclip-card__overlay-message {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(3, 9, 22, 0.72);
  color: #c8d2e4;
  font-size: 12px;
}
.vclip-card__overlay-message:empty {
  display: none;
}
.vclip-overlay__zone {
  fill: rgba(70, 145, 255, 0.15);
  stroke: rgba(70, 145, 255, 0.9);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.vclip-overlay__zone--vehicle {
  fill: rgba(34, 197, 94, 0.12);
  stroke: rgba(34, 197, 94, 0.95);
}
.vclip-overlay__zone--exclusion {
  fill: rgba(245, 158, 11, 0.10);
  stroke: rgba(156, 163, 175, 0.95);
  stroke-dasharray: 10 7;
}
.vclip-geometry-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
  font-size: 11px;
  font-weight: 700;
}
.vclip-geometry-legend[hidden] { display: none; }
.vclip-geometry-legend__vehicle { color: #4ade80; }
.vclip-geometry-legend__exclusion { color: #fbbf24; }
.vclip-overlay__line {
  stroke: rgba(28, 211, 114, 0.95);
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.vclip-overlay__bbox {
  fill: none;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.vclip-overlay__bbox--vehicle {
  stroke: #22c55e;
}
.vclip-overlay__bbox--plate {
  stroke: #4f8cff;
}
.vclip-overlay__trajectory {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.vclip-overlay__point {
  fill: #f59e0b;
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.vclip-overlay__marker {
  fill: #4f8cff;
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.vclip-overlay__marker--active {
  fill: #22c55e;
}
.vclip-overlay__text {
  font: 600 26px system-ui, sans-serif;
  fill: #fff;
  stroke: rgba(0, 0, 0, 0.82);
  stroke-width: 4px;
  paint-order: stroke;
}

.vclip-card__body {
  padding: 14px 16px;
}

/* Meta row: plate + direction + status */
.vclip-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* Detail fields grid */
.vclip-card__details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 16px;
  font-size: 13px;
}
.vclip-card__detail {
  color: var(--text-2);
}
.vclip-card__detail b {
  color: var(--muted);
  font-weight: 500;
}

/* Analytics overlay controls */
.vclip-card__analytics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-2);
}
.vclip-card__analytics-layers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.vclip-overlay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.vclip-overlay-toggle input {
  accent-color: var(--accent);
}
.vclip-card__analytics-status {
  font-size: 12px;
}

/* A8i.4: target summary */
.vclip-card__target {
  flex-basis: 100%;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.vclip-target__rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
}
.vclip-target__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.vclip-target__row span {
  color: var(--muted);
}
.vclip-target__row b {
  color: var(--text-2);
  text-align: right;
}
.vclip-target__warnings {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vclip-target__warning {
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 8px;
  padding: 5px 8px;
}

/* A8i.4: clip timeline ("События клипа") */
.vclip-card__timeline {
  flex-basis: 100%;
  width: 100%;
}
.vclip-card__timeline-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.vclip-card__timeline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.vclip-timeline__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font: inherit;
}
.vclip-timeline__item[disabled] {
  cursor: default;
  opacity: 0.7;
}
.vclip-timeline__item:not([disabled]):hover {
  background: var(--surface-2);
}
.vclip-timeline__item--active {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--surface-2);
}
.vclip-timeline__dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.vclip-timeline__item--info .vclip-timeline__dot { background: var(--accent); }
.vclip-timeline__item--success .vclip-timeline__dot { background: var(--green); }
.vclip-timeline__item--warning .vclip-timeline__dot { background: var(--amber); }
.vclip-timeline__item--muted .vclip-timeline__dot { background: var(--muted); }
.vclip-timeline__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.vclip-timeline__label {
  font-size: 12.5px;
  font-weight: 500;
}
.vclip-timeline__meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.vclip-timeline__empty {
  font-size: 12px;
  padding: 8px 4px;
}

/* Reasons list */
.vclip-card__reasons {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-2);
}
.vclip-card__reason {
  font-size: 12px;
  color: var(--amber);
  margin-bottom: 2px;
}

/* Empty state */
.vclips-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 760px) {
  .vclips-summary {
    grid-template-columns: repeat(3, 1fr);
  }
  .vclip-card__details {
    grid-template-columns: 1fr 1fr;
  }
  .vclip-card__analytics {
    align-items: flex-start;
    flex-direction: column;
  }
  .vclip-target__rows {
    grid-template-columns: 1fr;
  }
}

/* ── A9-R2.1 Stage 4: live tracker comparison ── */
.vclips-modes { display: flex; gap: 6px; margin: 8px 0 4px; }
.vclips-mode {
  padding: 6px 14px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 8px; cursor: pointer; font-size: 13px;
}
.vclips-mode--active { background: var(--accent); color: #fff; border-color: var(--accent); }
.vclips-toast {
  margin: 6px 0; padding: 8px 12px; border-radius: 8px;
  background: var(--green-soft, rgba(40,180,100,0.15)); color: var(--text); font-size: 13px;
}
.tlab-shadow-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--amber, #c78);
  border: 1px solid var(--amber, #c78); border-radius: 6px; padding: 2px 8px;
}
.tlab-shadow-badge--sm { font-size: 9px; padding: 1px 5px; }
.tlab-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 16px; margin-top: 12px; }
.tlab-main { min-width: 0; }
.tlab-video {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000;
  border-radius: 10px; overflow: hidden;
}
.tlab-video__img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tlab-video__player { position: absolute; inset: 0; }
.tlab-video__player iframe { width: 100%; height: 100%; border: 0; display: block; }
.tlab-video__shield { position: absolute; inset: 0; z-index: 1; }
.tlab-overlay { position: absolute; inset: 0; pointer-events: none; }
.tlab-overlay__svg { width: 100%; height: 100%; }
.tlab-video__message {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 12px;
}
.tlab-bbox { stroke-width: 2; }
.tlab-bbox--legacy { stroke: var(--accent, #4a9); }
.tlab-bbox--bytetrack { stroke: var(--amber, #e0a020); }
.tlab-bbox--lost { opacity: .45; }
.tlab-traj { stroke-width: 2; }
.tlab-traj--bytetrack { stroke: var(--amber, #e0a020); stroke-dasharray: 8 6; opacity: .8; }
.tlab-text { font-size: 14px; font-weight: 700; paint-order: stroke; stroke: #000; stroke-width: 3px; }
.tlab-text--legacy { fill: var(--accent, #4a9); }
.tlab-text--bytetrack { fill: var(--amber, #e0a020); }
.tlab-text--lost { opacity: .55; }
.tlab-text--plate { fill: #60a5fa; font-size: 15px; }
.tlab-text--plate-meta { fill: #dbeafe; font-size: 12px; font-weight: 600; }
.tlab-layers { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.tlab-stream-mode { display: inline-flex; gap: 6px; }
.tlab-layer { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; }
.tlab-side { display: flex; flex-direction: column; gap: 12px; }
.tlab-panel, .tlab-toggle, .tlab-plates, .tlab-cmp, .tlab-writer {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.tlab-panel__title, .tlab-cmp__title, .tlab-plates__title, .tlab-toggle__title {
  font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; align-items: center;
}
.tlab-panel__row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 2px 0; }
.tlab-cmp { margin-top: 12px; }
.tlab-cmp__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tlab-cmp__table th, .tlab-cmp__table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.tlab-frag { margin-top: 8px; font-size: 13px; color: var(--amber, #c78); }
.tlab-plate { padding: 6px 0; border-bottom: 1px solid var(--border); }
.tlab-plate--invalid { opacity: .6; }
.tlab-plate__text { font-family: var(--font-mono); font-weight: 600; }
.tlab-plate__meta { font-size: 12px; }
.tlab-plates__title--recent { margin-top: 12px; }
.tlab-switch {
  padding: 6px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600;
}
.tlab-switch--on { background: var(--green, #2b9); color: #fff; border-color: var(--green, #2b9); }
.tlab-switch:disabled { opacity: .6; cursor: default; }
.tlab-toggle__hint, .tlab-writer__hint { font-size: 12px; margin-top: 6px; }
.tlab-writer__head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tlab-writer__status { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface); }
.tlab-writer__status--writing { background: var(--amber-soft, rgba(224,160,32,.2)); }
.tlab-writer__status--error, .tlab-writer__status--waiting_for_storage { background: var(--red-soft, rgba(220,60,60,.2)); }
.tlab-writer__grid { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; }
.tlab-writer__manual { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 12px; }
.tlab-writer__preview { display: grid; gap: 4px; width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
.tlab-writer__preview .btn { justify-self: start; margin-top: 5px; }
.tlab-writer__action { width: 100%; padding: 8px 10px; border-radius: 8px; background: var(--surface); font-size: 12px; }
.tlab-writer__action--failed { color: var(--red, #ef4444); }
.tlab-writer__action--completed { color: var(--green, #22c55e); }
@media (max-width: 900px) { .tlab-grid { grid-template-columns: 1fr; } }
