/**
 * Rekaptr Medal Clip Studio - Clean Filmstrip & Precision Trim Timeline
 * Includes In/Out Timecode Pill Buttons, Multi-Type Markers & Event Filter Bar
 */

.medal-timeline-container {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  gap: 10px;
}

/* Upper Controls Bar */
.timeline-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Circular Harmonious Transport Cluster */
.playback-controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Circular Ghost Step Buttons */
.btn-circular-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  outline: none;
  user-select: none;
}

.btn-circular-step:hover {
  background: var(--bg-surface-raised);
  border-color: var(--border-default);
  color: #ffffff;
}

.btn-circular-step:active {
  background: var(--bg-surface);
}

.btn-circular-step svg {
  width: 14px;
  height: 14px;
  transform-origin: 50% 50%;
  display: block;
  pointer-events: none;
  transition: transform 0.52s cubic-bezier(0.2, 0.9, 0.3, 1), color var(--transition-fast);
  will-change: transform;
}

/* Custom Uiverse.io Animated Play Toggle */
.uiverse-play-toggle {
  --toggle-size: 28px;
  width: var(--toggle-size);
  height: var(--toggle-size);
  position: relative;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.uiverse-play-toggle .uiverse-toggle-label {
  width: 100%;
  height: 100%;
  position: relative;
  display: block;
  cursor: pointer;
}

.uiverse-play-toggle .play-btn {
  position: absolute;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--accent-iris), var(--accent-iris));
  cursor: pointer;
  outline: none;
  margin: 0;
  top: 0;
  left: 0;
  transition: transform var(--transition-fast);
}

.uiverse-play-toggle .play-btn:hover {
  transform: scale(1.05);
}

.uiverse-play-toggle .play-btn::before {
  content: "";
  position: absolute;
  width: 86%;
  height: 86%;
  background-color: var(--bg-surface-raised);
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.uiverse-play-toggle .play-btn:checked {
  animation: borderAnimate 600ms ease-in-out 1;
  animation-fill-mode: forwards;
}

@keyframes borderAnimate {
  0% { transform: rotate(0); background: conic-gradient(var(--accent-iris), transparent 20%); }
  100% { transform: rotate(360deg); background: conic-gradient(var(--accent-iris), var(--accent-iris)); }
}

.uiverse-play-toggle .play-icon {
  position: absolute;
  width: calc(var(--toggle-size) * 0.36);
  height: calc(var(--toggle-size) * 0.36);
  left: 58%;
  top: 50%;
  background-color: var(--accent-iris);
  transform: translate(-50%, -50%) rotate(90deg);
  clip-path: polygon(50% 15%, 0% 100%, 100% 100%);
  transition: all 250ms ease;
  pointer-events: none;
}

.uiverse-play-toggle .play-btn:checked + .play-icon {
  clip-path: polygon(0 100%, 0% 100%, 100% 100%);
}

.uiverse-play-toggle .pause-icon {
  position: absolute;
  width: calc(var(--toggle-size) * 0.34);
  height: calc(var(--toggle-size) * 0.34);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.uiverse-play-toggle .pause-icon::before,
.uiverse-play-toggle .pause-icon::after {
  content: "";
  position: absolute;
  width: 0;
  height: 100%;
  background-color: var(--accent-iris);
  border-radius: 1px;
}

.uiverse-play-toggle .pause-icon::before { left: 0; }
.uiverse-play-toggle .pause-icon::after { right: 0; }

.uiverse-play-toggle .play-btn:checked ~ .pause-icon::before,
.uiverse-play-toggle .play-btn:checked ~ .pause-icon::after {
  width: 35%;
}

.timecode-display-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  margin-left: 2px;
}

.timecode-current {
  color: #ffffff;
}

.timecode-total {
  color: var(--text-muted);
  font-size: 11px;
}

/* Center Cluster: Clean Marker Trigger */
.timeline-center-cluster {
  display: flex;
  align-items: center;
}

/* Add Marker Button Pill */
.btn-open-marker-palette {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-open-marker-palette:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-iris);
  color: #c4b5fd;
}

.btn-open-marker-palette svg {
  width: 12px;
  height: 12px;
  color: var(--accent-iris);
}

/* -------------------------------------------------------------
 * In / Out Timecode Pill Buttons (Matching Screenshot Theme)
 * ------------------------------------------------------------- */
.trim-points-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trim-point-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px 0 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.trim-point-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.trim-point-pill.active-set {
  border-color: var(--accent-iris);
}

.trim-pill-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.trim-pill-time {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.trim-pill-clear {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: 2px;
}

.trim-pill-clear:hover {
  background: rgba(225, 29, 72, 0.2);
  color: var(--color-alert);
}

/* Primary Action CTA */
.btn-save-clip-primary {
  padding: 6px 16px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-iris);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-save-clip-primary:hover {
  background: var(--accent-iris-hover);
}

/* -------------------------------------------------------------
 * Filmstrip Video Track & Precision Trim Handles
 * ------------------------------------------------------------- */
.filmstrip-track-wrapper {
  position: relative;
  width: 100%;
  height: 52px;
  background: #06070a;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
  user-select: none;
  cursor: pointer;
}

/* Filmstrip Frames Simulation */
.filmstrip-thumbnails-row {
  display: flex;
  width: 100%;
  height: 100%;
  opacity: 0.7;
}

.filmstrip-frame {
  flex: 1;
  height: 100%;
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  background-size: cover;
  background-position: center;
}

.frame-1 { background: #1a1e2e; }
.frame-2 { background: #262c42; }
.frame-3 { background: #2e3550; }
.frame-4 { background: #262c42; }
.frame-5 { background: #1e2235; }
.frame-6 { background: #141724; }

/* Highlighted Active Trim Selection Box */
.trim-selection-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 12%;
  width: 72%;
  border-top: 2px solid var(--accent-iris);
  border-bottom: 2px solid var(--accent-iris);
  background: rgba(124, 58, 237, 0.12);
  pointer-events: none;
  z-index: 10;
}

/* Dimmed Non-Selected Ends */
.dim-mask-left {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 12%;
  background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
  z-index: 5;
}

.dim-mask-right {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 16%;
  background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
  z-index: 5;
}

/* Trim Handles (In and Out Points) */
.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  background: var(--accent-iris);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 25;
  pointer-events: auto;
}

.trim-handle::before {
  content: "";
  width: 2px;
  height: 14px;
  background: #ffffff;
  border-radius: 1px;
}

.trim-handle-in {
  left: 12%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.trim-handle-out {
  left: calc(12% + 72% - 12px);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* -------------------------------------------------------------
 * Clean Balanced 16px Vector Marker Pins
 * ------------------------------------------------------------- */
.filmstrip-marker-pin {
  position: absolute;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
  transition: transform 120ms ease, box-shadow 120ms ease;
  backdrop-filter: blur(2px);
}

.filmstrip-marker-pin::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 32px;
  background: currentColor;
  opacity: 0.5;
  pointer-events: none;
}

.filmstrip-marker-pin svg {
  width: 9.5px;
  height: 9.5px;
  color: #ffffff;
  pointer-events: none;
}

.filmstrip-marker-pin:hover {
  transform: translateX(-50%) scale(1.25);
  z-index: 45;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

/* Marker Types Color Schemes */
.pin-kill { background-color: #ef4444; color: #ef4444; border-color: rgba(255, 255, 255, 0.4); }
.pin-headshot { background-color: #f59e0b; color: #f59e0b; border-color: rgba(255, 255, 255, 0.4); }
.pin-clutch { background-color: #8b5cf6; color: #8b5cf6; border-color: rgba(255, 255, 255, 0.4); }
.pin-knock { background-color: #f97316; color: #f97316; border-color: rgba(255, 255, 255, 0.4); }
.pin-death { background-color: #64748b; color: #94a3b8; border-color: rgba(255, 255, 255, 0.4); }
.pin-bookmark { background-color: #10b981; color: #10b981; border-color: rgba(255, 255, 255, 0.4); }

/* Moving Playhead Scrubber Line */
.filmstrip-playhead-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 2px;
  background: #ffffff;
  pointer-events: none;
  z-index: 35;
}

.playhead-needle-top {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 6px;
  background: #ffffff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* Time Ruler Ticks */
.timeline-ruler-row {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* -------------------------------------------------------------
 * Event Filter & Jump Bar
 * ------------------------------------------------------------- */
.timeline-marker-filter-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.filter-bar-title {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 2px;
}

.marker-event-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.marker-event-pill svg {
  width: 10px;
  height: 10px;
}

.marker-event-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.marker-event-pill.active {
  border-color: var(--accent-iris);
  color: #ffffff;
  background: rgba(124, 58, 237, 0.15);
}

/* -------------------------------------------------------------
 * Marker Palette Popover
 * ------------------------------------------------------------- */
.marker-palette-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px) scale(0.96);
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.7);
  padding: 8px 10px;
  z-index: 100;
  width: 245px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.marker-palette-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.popover-title {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.popover-grid-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.marker-type-option-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.marker-type-option-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.marker-option-icon {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.marker-option-icon svg {
  width: 10px;
  height: 10px;
  color: #ffffff;
}

.marker-option-icon.icon-kill { background: #ef4444; }
.marker-option-icon.icon-headshot { background: #f59e0b; }
.marker-option-icon.icon-clutch { background: #8b5cf6; }
.marker-option-icon.icon-knock { background: #f97316; }
.marker-option-icon.icon-death { background: #64748b; }
.marker-option-icon.icon-bookmark { background: #10b981; }

/* Marker Detail Card (Jump & Auto-Trim Modal) */
.marker-detail-card {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.75);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 95;
  min-width: 205px;
  pointer-events: auto;
  animation: fadeInPop 120ms ease;
}

@keyframes fadeInPop {
  from { opacity: 0; transform: translateX(-50%) translateY(3px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.marker-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 5px;
}

.marker-detail-title-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.marker-detail-title-left svg {
  width: 12px;
  height: 12px;
}

.btn-marker-trim-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: var(--accent-iris);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-marker-trim-hero:hover {
  background: var(--accent-iris-hover);
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
}

.marker-detail-secondary-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-marker-secondary {
  flex: 1;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-marker-secondary:hover {
  background: var(--bg-surface-hover);
  color: #ffffff;
  border-color: var(--border-default);
}

.btn-marker-delete {
  padding: 4px 7px;
  border-radius: var(--radius-xs);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-marker-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}
