/* ---------------------------------------------------------------------------
   Timeline Editor — visual marker editor for overlays, hotspots, snaps
   --------------------------------------------------------------------------- */

.timeline-editor {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
  user-select: none;
  overflow: hidden;
}

/* Filmstrip row */
.timeline-filmstrip {
  display: flex;
  gap: 2px;
  height: 48px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: var(--space-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.timeline-filmstrip img {
  height: 48px;
  width: auto;
  border-radius: 2px;
  opacity: 0.8;
  flex-shrink: 0;
}

.timeline-filmstrip img:hover {
  opacity: 1;
}

/* Marker lanes */
.timeline-lane {
  position: relative;
  height: 24px;
  margin-bottom: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}

.timeline-lane-label {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 2px 4px;
  pointer-events: none;
  z-index: 1;
}

/* Range markers (overlays, hotspots, transitions) */
.timeline-marker {
  position: absolute;
  top: 2px;
  height: 20px;
  border-radius: 3px;
  cursor: grab;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  min-width: 8px;
}

.timeline-marker:hover {
  opacity: 0.9;
  z-index: 10;
}

.timeline-marker.selected {
  outline: 2px solid #fff;
  outline-offset: 1px;
  z-index: 20;
}

.timeline-marker.dragging {
  cursor: grabbing;
  opacity: 1;
  z-index: 30;
}

/* Marker colors by type */
.timeline-marker[data-type="overlay"] {
  background: rgba(59, 130, 246, 0.7);
}

.timeline-marker[data-type="hotspot"] {
  background: rgba(239, 68, 68, 0.7);
}

.timeline-marker[data-type="snap"] {
  background: rgba(234, 179, 8, 0.9);
  width: 8px !important;
  border-radius: 2px;
}

.timeline-marker[data-type="transition"] {
  background: rgba(168, 85, 247, 0.5);
  background-image: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.3), transparent);
}

/* Drag handles on range markers */
.timeline-handle {
  position: absolute;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  z-index: 5;
}

.timeline-handle-left {
  left: -2px;
}

.timeline-handle-right {
  right: -2px;
}

.timeline-handle:hover::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 1px;
}

.timeline-handle-left:hover::after {
  left: 2px;
}

.timeline-handle-right:hover::after {
  right: 2px;
}

/* Ruler */
.timeline-ruler {
  position: relative;
  height: 20px;
  margin-top: var(--space-1);
  border-top: 1px solid var(--border);
}

.timeline-ruler-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 6px;
  background: var(--border);
}

.timeline-ruler-label {
  position: absolute;
  top: 8px;
  font-size: 9px;
  color: var(--text-secondary);
  transform: translateX(-50%);
}

/* Position tooltip */
.timeline-tooltip {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
}

/* Playhead */
.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--primary);
  pointer-events: none;
  z-index: 50;
  transition: left 0.1s;
}

.timeline-playhead::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
}
