/*
 * Player Lab layout: video stage, simulated content timeline, ad overlay,
 * and the live event timeline that sits beside it.
 */

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1150px) {
  .player-layout { grid-template-columns: 1fr; }
}

.video-stage {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  aspect-ratio: 16 / 9;
}
.video-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.content-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-1);
  background: radial-gradient(circle at 50% 40%, #16202f, #05070b);
}
.content-placeholder .big-time {
  font-family: var(--mono);
  font-size: 36px;
  color: var(--text-0);
  letter-spacing: 0.03em;
}
.content-placeholder .label {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

.ad-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.ad-overlay > * { pointer-events: auto; }
.ad-badge {
  background: rgba(10, 14, 20, 0.82);
  color: var(--text-0);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.ad-progress-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}
.ad-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.15s linear;
}
.skip-btn {
  background: rgba(10, 14, 20, 0.88);
  border: 1px solid var(--text-1);
  color: var(--text-0);
  font-weight: 600;
}
.skip-btn:disabled {
  opacity: 0.5;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.player-controls .stretch { flex: 1; min-width: 160px; }

.timeline-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 82vh;
}
.timeline-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
  min-height: 200px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 62px 20px 1fr;
  gap: 8px;
  align-items: start;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  background: var(--bg-2);
}
.timeline-item .t {
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12.5px;
}
.timeline-item .marker {
  text-align: center;
}
.timeline-item .body .ev {
  font-weight: 600;
  color: var(--text-0);
}
.timeline-item .body .meta {
  color: var(--text-2);
  font-size: 12.5px;
}
.timeline-item.pending { opacity: 0.55; }
.timeline-item.landed { border-color: var(--good); background: var(--good-soft); }
.timeline-item.actual-only { border-color: var(--accent); }
.timeline-item.unexpected { border-color: var(--warn); background: var(--warn-soft); }
.timeline-item.server { border-color: var(--accent); }
/* In-band timed metadata read out of the media itself. Deliberately a
   different colour from every beacon state: it is not a beacon, and reading it
   as one is the specific mistake this row exists to prevent. */
.timeline-item.inband {
  border-color: var(--warn);
  border-style: dashed;
  background: transparent;
}
.timeline-item.inband .marker { color: var(--warn); }

.timeline-sources {
  gap: 14px;
  margin-top: -2px;
}
.timeline-sources .src-swatch {
  display: inline-block;
  width: 16px;
  text-align: center;
}
.timeline-sources .src-swatch.landed { color: var(--good); }
.timeline-sources .src-swatch.inband { color: var(--warn); }

.expected-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.creative-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.creative-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  font-size: 13px;
}
.creative-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.creative-chip .idx {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  flex: none;
}

/* ---------------------------------------------------------------------------
   Ad-break timeline: where breaks sit on the content, and when beacons fired.
   Marker width is proportional to the break's real duration, so a 20s pod
   visibly occupies more of the bar than a 10s one.
   --------------------------------------------------------------------------- */

.ad-timeline {
  margin-top: 10px;
}

.ad-timeline-track {
  position: relative;
  height: 26px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ad-timeline-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 3px;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

.ad-timeline-marker.pending {
  background: color-mix(in srgb, var(--warn) 55%, transparent);
}
.ad-timeline-marker.active {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.ad-timeline-marker.played {
  background: color-mix(in srgb, var(--good) 45%, transparent);
}

/* Beacons, plotted at the playhead position they fired at. */
.ad-timeline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--text-0);
  opacity: 0.75;
}
.ad-timeline-tick.bad {
  background: var(--bad);
  opacity: 1;
}

.ad-timeline-playhead {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text-0);
  box-shadow: 0 0 6px var(--text-0);
  transition: left 0.25s linear;
  z-index: 2;
}

.ad-timeline-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  flex-wrap: wrap;
}

.ad-timeline-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px;
}
.ad-timeline-legend .swatch.pending { background: color-mix(in srgb, var(--warn) 55%, transparent); }
.ad-timeline-legend .swatch.active  { background: var(--accent); }
.ad-timeline-legend .swatch.played  { background: color-mix(in srgb, var(--good) 45%, transparent); }

/* Playback-relative offset beside the wallclock in the event list. */
.timeline-item .t .rel {
  display: block;
  font-size: 11.5px;
  color: var(--accent);
}
