/* Video blockset (renderers/videoRenderer.js): panels split FancyZones style
   inside the NaviBlockSet frame. Interface colors are design tokens only. */

.video-renderer-host {
  position: fixed !important;
  inset: var(--nbs-frame, 30px);
  overflow: hidden;
  background: var(--bgf-bg);
  font-family: var(--bgf-font);
}

.video-workspace {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.video-tools {
  display: flex;
  gap: var(--bgf-space-1);
  padding: var(--bgf-space-1) var(--bgf-space-2);
  border-bottom: 1px solid var(--bgf-border);
  background: var(--bgf-surface);
}

.video-tools[hidden] {
  display: none;
}

.video-view {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.video-view > .video-split,
.video-view > .video-panel {
  flex: 1 1 auto;
}

/* ---- Splits and dividers ---- */

.video-split {
  display: flex;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.video-split--row {
  flex-direction: row;
}

.video-split--column {
  flex-direction: column;
}

.video-split__cell {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.video-split__cell > .video-split,
.video-split__cell > .video-panel {
  flex: 1 1 auto;
}

.video-divider {
  flex: 0 0 6px;
  background: var(--bgf-border);
  touch-action: none;
  transition: background var(--bgf-duration);
}

.video-split--row > .video-divider {
  cursor: col-resize;
}

.video-split--column > .video-divider {
  cursor: row-resize;
}

.video-divider:hover,
.video-divider:focus-visible,
.is-resizing .video-divider:active {
  background: var(--bgf-accent);
}

.video-divider:focus-visible {
  outline: var(--bgf-focus-ring);
  outline-offset: var(--bgf-focus-offset);
}

/* While a divider is dragged, players must not take the pointer. */
.is-resizing,
.is-resizing * {
  user-select: none;
}

.is-resizing .video-panel__media {
  pointer-events: none;
}

/* ---- Panels ---- */

.video-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bgf-surface-2);
}

.video-view.is-editing .video-panel {
  outline: 1px dashed var(--bgf-border-strong);
  outline-offset: -1px;
}

.video-panel__media {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bgf-bg);
}

.video-panel__media--image {
  object-fit: contain;
}

video.video-panel__media {
  object-fit: contain;
}

.video-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--bgf-space-2);
  padding: var(--bgf-space-3);
  text-align: center;
}

.video-panel__notice {
  margin: 0;
  color: var(--bgf-text-muted);
  font-size: var(--bgf-text-sm);
}

.video-panel__progress {
  width: min(220px, 80%);
  accent-color: var(--bgf-accent);
}

.video-panel__tools {
  position: absolute;
  top: var(--bgf-space-1);
  right: var(--bgf-space-1);
  display: flex;
  gap: var(--bgf-space-1);
  padding: 2px;
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius-sm);
  background: var(--bgf-surface);
  box-shadow: var(--bgf-shadow);
}

.video-panel__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--bgf-control-h);
  height: var(--bgf-control-h);
  padding: 0 var(--bgf-space-1);
  border: 0;
  border-radius: var(--bgf-radius-sm);
  background: transparent;
  color: var(--bgf-text);
  font-size: var(--bgf-text-sm);
  cursor: pointer;
}

.video-panel__tool:hover {
  background: var(--bgf-accent-soft);
  color: var(--bgf-accent-text);
}

.video-panel__tool:focus-visible {
  outline: var(--bgf-focus-ring);
  outline-offset: var(--bgf-focus-offset);
}

/* ---- Template previews (layout in miniature) ---- */

.video-template {
  display: grid;
  width: 22px;
  height: 16px;
  gap: 2px;
}

.video-template > span {
  border-radius: 1px;
  background: currentColor;
  opacity: 0.75;
}

.video-template--two { grid-template-columns: 1fr 1fr; }
.video-template--three { grid-template-columns: 1fr 1fr 1fr; }
.video-template--grid { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-template--focus { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.video-template--focus > span:first-child { grid-row: span 2; }

/* ---- Add-a-video dialog ---- */

.video-picker {
  display: flex;
  flex-direction: column;
  gap: var(--bgf-space-3);
}

.video-picker__field {
  display: flex;
  flex-direction: column;
  gap: var(--bgf-space-1);
}

.video-picker__label {
  color: var(--bgf-text);
  font-size: var(--bgf-text-sm);
}

.video-picker__checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bgf-space-3);
  font-size: var(--bgf-text-sm);
}

.video-picker__check {
  display: inline-flex;
  align-items: center;
  gap: var(--bgf-space-1);
  min-height: var(--bgf-control-h);
}

.video-picker__check input {
  accent-color: var(--bgf-accent);
}

.video-picker__error {
  margin: 0;
  color: var(--bgf-danger);
  font-size: var(--bgf-text-sm);
}

.video-picker__error:empty {
  display: none;
}

/* ---- Touch and phones ---- */

@media (pointer: coarse) {
  .video-panel__tool {
    min-width: var(--bgf-control-h-touch);
    height: var(--bgf-control-h-touch);
  }
}

/* Phones: every panel in one column, in reading order, at video proportions.
   The saved layout does not change; dividers come back on wider screens. */
@media (max-width: 700px) {
  .video-view {
    overflow-y: auto;
    display: block;
  }

  .video-split,
  .video-split--row,
  .video-split--column {
    display: block;
    height: auto;
  }

  .video-split__cell {
    display: block;
  }

  .video-divider {
    display: none;
  }

  .video-panel {
    aspect-ratio: 16 / 9;
    width: 100%;
  }
}
