/* Dataset tab — public, video-only browser over the 453-word sheet.
   Tokens (--panel, --line, --accent, …) come from library.css, which this page
   loads first; only the list + video grid live here. */

body.dataset-page {
  height: auto !important;
  min-height: 100vh;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  display: block !important;
}

.dataset-shell {
  display: grid;
  /* Narrow sidebar on purpose: the page shows one take (3 clips) at a time, so
     the width it gives back goes straight into the video size. */
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - 94px);
  width: 100%;
  background: var(--bg);
}

.dataset-sidebar {
  padding: 18px 12px 24px 18px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dataset-list-card {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dataset-list-card .section-head { align-items: flex-start; }
.dataset-list-card .section-head h2 { margin: 0 0 3px; }

.dataset-filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dataset-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.dataset-select {
  flex: 1;
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.dataset-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dataset-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: inherit;
}
.dataset-item:hover { background: var(--accent-soft); border-color: var(--line); }
.dataset-item.active { background: var(--accent-soft); border-color: var(--accent); }

.dataset-item-title { font-weight: 600; line-height: 1.25; }
.dataset-item-meta { font-size: 12px; color: var(--muted); }
.dataset-item-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.dataset-source-hint {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  margin: 0;
}

.dataset-content {
  padding: 18px 20px 40px;
  min-width: 0;
}

.dataset-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--muted);
}
.dataset-empty h2 { margin: 12px 0 6px; color: var(--text); }
.dataset-empty p { margin: 0; max-width: 460px; }
.dataset-empty-icon { font-size: 42px; }

.dataset-workspace { display: flex; flex-direction: column; gap: 16px; }

.dataset-head-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}
.dataset-title-block h2 { margin: 0 0 4px; font-size: 26px; }
.dataset-title-block .meta-line { word-break: break-word; }
.dataset-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.dataset-takes { display: flex; flex-direction: column; gap: 14px; }

.dataset-take-card { padding: 12px 14px 14px; }

.dataset-take-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.dataset-take-head h3 { margin: 0; font-size: 17px; }
.dataset-take-actions { display: flex; align-items: center; gap: 10px; }

/* One take on screen means the three clips can be big: the center angle takes
   the full top row, left and right split the row under it. Three across would
   cap every clip at a third of the content width. */
.dataset-view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "center center"
    "left right";
  gap: 12px;
}

.dataset-view-center { grid-area: center; }
.dataset-view-left { grid-area: left; }
.dataset-view-right { grid-area: right; }

/* Keep 16:9 without letterboxing: the center clip grows until it would run past
   the viewport height, then stops and stays centered. */
.dataset-view-center .dataset-video,
.dataset-view-center .dataset-view-missing {
  max-width: calc(40vh * 16 / 9);
  margin: 0 auto;
}

.dataset-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.dataset-view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dataset-view-head strong { font-size: 14px; }
.dataset-view-sub { font-size: 11px; color: var(--muted); }

.dataset-angle-chips { display: flex; gap: 4px; margin-left: auto; }
.dataset-angle-chips .status-chip {
  padding: 2px 8px;
  font-size: 11px;
  min-height: 0;
  height: auto;
}

.dataset-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  object-fit: contain;
}

.dataset-view-missing {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dataset-view-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.dataset-view-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dataset-view-size { flex: none; }

.dataset-loading { margin: 0; }

@media (max-width: 900px) {
  /* Side by side would leave each clip narrower than a phone screen here. */
  .dataset-view-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "center" "left" "right";
  }
  .dataset-shell { grid-template-columns: minmax(0, 1fr); }
  .dataset-sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .dataset-list { max-height: 320px; }
}
