/* timeline.css - After Effects Multi-Track Studio Timeline */

:root {
  --ruler-height: 24px;
  --track-height: 34px;
  --track-label-width: 80px;
  --playhead-color: #A855F7;
  --playhead-glow: rgba(168, 85, 247, 0.6);
}

.timeline-dock {
  height: var(--dock-height);
  width: 100%;
  background: #07080b;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  position: relative;
  z-index: 40;
  user-select: none;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

/* =========================================================
   LEFT TRANSPORT & TIMECODE
   ========================================================= */
.dock-transport-header {
  width: 135px;
  min-width: 135px;
  max-width: 135px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #090a0f;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Green Bebas Neue Timecode Display */
.timecode-box {
  background: rgba(4, 5, 8, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 5px 12px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

.timecode-main {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  font-weight: 400;
  color: #10B981;
  letter-spacing: 2px;
  line-height: 1;
  text-shadow: 0 0 14px rgba(16, 185, 129, 0.65);
}

/* Transport Controls Directly Underneath Timecode */
.transport-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.transport-btn {
  background: 
    conic-gradient(#fefefe, #ebebeb, #989898 25%, 
        #808080 0%, #797979, #b3b3b3 50%, #bdbdbd 0%, 
        #d3d3d3, #989898, #d8d8d8, #fefefe) padding-box, 
    linear-gradient(180deg, #ffffff, #666666) border-box;
  border: 1.5px solid transparent;
  color: #1a1c24;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.75), inset 0 1px 1.5px #ffffff, inset 0 -1px 2px #666666;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, filter 0.15s ease;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
}

.transport-btn svg {
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
}

.transport-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5), 0 4px 10px rgba(0, 0, 0, 0.8), inset 0 1px 2px #ffffff;
  filter: brightness(1.06);
  color: #0f1015;
}

.transport-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.transport-btn.play-btn {
  background: 
    conic-gradient(#fefefe, #f0f0f0, #a0a0a0 25%, 
        #858585 0%, #7d7d7d, #bfbfbf 50%, #c4c4c4 0%, 
        #dedede, #a0a0a0, #dedede, #fefefe) padding-box, 
    linear-gradient(180deg, #ffffff, #888888) border-box;
  border: 1.5px solid transparent;
  color: #8B5CF6;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.45), 0 2px 6px rgba(0, 0, 0, 0.7), inset 0 1px 2px #ffffff, inset 0 -1px 2px #6b7280;
  width: 32px;
  height: 32px;
}

.transport-btn.play-btn svg {
  filter: drop-shadow(0 1px 2px rgba(139, 92, 246, 0.5));
}

.transport-btn.play-btn:hover {
  transform: scale(1.1);
  color: #9D74FF;
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.65), 0 4px 12px rgba(0, 0, 0, 0.85), inset 0 1px 2px #ffffff;
  filter: brightness(1.08);
}

.transport-btn.play-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.dock-meta-tag {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.fps-tag {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 5px;
  border-radius: 4px;
}

.dock-meta-tag .btn-xs {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
}

/* =========================================================
   RIGHT TRACKS AREA & RULER
   ========================================================= */
.dock-tracks-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  background: #07080b;
}

.dock-tracks-container::-webkit-scrollbar {
  height: 5px;
}
.dock-tracks-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

/* Time Ruler */
.timeline-ruler-row {
  height: var(--ruler-height);
  background: #090a0f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  position: relative;
  flex-shrink: 0;
  width: 100%;
}

.ruler-header-offset {
  width: var(--track-label-width);
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  background: #08090d;
  flex-shrink: 0;
}

.ruler-lane {
  position: relative;
  height: 100%;
  flex: 1;
  display: flex;
  cursor: pointer;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  min-width: 0;
  width: 100%;
}

.ruler-slot-segment {
  flex: 1;
  min-width: 0;
  width: 20%;
  height: 100%;
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}

.ruler-slot-time-label {
  position: absolute;
  top: 0;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: var(--ruler-height);
  pointer-events: none;
}

.ruler-subticks {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 15%;
  pointer-events: none;
}

.ruler-subtick {
  width: 1px;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 17px;
}

/* Tracks Body */
.timeline-tracks-body {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 4px 0;
  width: 100%;
}

/* Track Row */
.track-row {
  display: flex;
  height: var(--track-height);
  align-items: center;
  width: 100%;
}

.track-label {
  width: var(--track-label-width);
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  background: #08090d;
  height: 100%;
  box-sizing: border-box;
}

.track-icon {
  font-size: 10px;
}

.track-lane {
  position: relative;
  height: 100%;
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
}

.timeline-slots-lane {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  width: 100%;
  flex: 1;
  min-width: 0;
}

/* Fluid Rubber Slot Blocks */
.slot-segment-block {
  flex: 1;
  min-width: 0;
  max-width: 20%;
  margin: 0;
  height: 28px;
  background: rgba(24, 26, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.slot-segment-block:hover {
  background: rgba(36, 38, 52, 0.95);
  border-color: rgba(255, 255, 255, 0.18);
}

.slot-segment-block.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: #A855F7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.25), inset 0 0 0 1px #A855F7;
}

.slot-segment-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: #7C3AED;
}

.slot-segment-block.active::before {
  background: #A855F7;
  box-shadow: 0 0 6px #A855F7;
}

.slot-block-left {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.slot-block-num {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--accent-color);
  font-family: var(--font-mono);
}

.slot-block-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.slot-block-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slot-block-duration {
  font-size: 8.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.slot-block-delete {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  color: var(--text-muted);
  font-size: 8.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.slot-segment-block:hover .slot-block-delete {
  opacity: 1;
}

.slot-block-delete:hover {
  background: #EF4444;
  color: #ffffff;
}

/* Empty animated "+ Add Slot" segment */
.slot-segment-add {
  height: 28px;
  flex: 1;
  min-width: 80px;
  max-width: 20%;
  position: relative;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #C4B5FD;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 8px;
  background: rgba(129, 66, 255, 0.05);
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(129, 66, 255, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.slot-segment-add .add-slot-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #C4B5FD;
  animation: slot-add-text-pulse 2s infinite ease-in-out;
}

.slot-segment-add .add-slot-plus {
  font-size: 13px;
  font-weight: 800;
  color: #A78BFA;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease;
}

.slot-segment-add .slot-add-border-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  border-radius: var(--radius-xs);
}

.slot-segment-add .slot-add-border-svg rect {
  width: calc(100% - 2px);
  height: calc(100% - 2px);
}

.slot-segment-add .border-base {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-dasharray: 4 3;
  stroke-width: 1.2;
}

/* Traveling ~1/4th sector highlight running around clockwise */
.slot-segment-add .sector-runner {
  stroke-dasharray: 25 75;
  animation: runSectorClockwise 2.6s linear infinite;
}

@keyframes runSectorClockwise {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -100;
  }
}

.slot-segment-add .border-highlight-sector {
  stroke-width: 1.8;
  stroke-dasharray: 4 3;
  filter: drop-shadow(0 0 4px #A78BFA) drop-shadow(0 0 8px #8142FF);
}

@keyframes slot-add-text-pulse {
  0%, 100% {
    color: #C4B5FD;
    text-shadow: 0 0 6px rgba(129, 66, 255, 0.35);
    opacity: 0.85;
  }
  50% {
    color: #FFFFFF;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.95), 0 0 22px rgba(129, 66, 255, 0.7);
    opacity: 1;
  }
}

.slot-segment-add:hover {
  background: rgba(129, 66, 255, 0.16);
  box-shadow: 0 0 18px rgba(129, 66, 255, 0.4);
  transform: translateY(-1px);
}

.slot-segment-add:hover .add-slot-plus {
  transform: scale(1.3) rotate(90deg);
  color: #FFFFFF;
}

.slot-segment-add:hover .sector-runner {
  animation-duration: 1.6s;
}

.slot-segment-add:hover .border-highlight-sector {
  stroke-width: 2.2;
  filter: drop-shadow(0 0 6px #C084FC) drop-shadow(0 0 12px #8142FF);
}

/* Background track ribbon - zero margins, exact slot width */
.bg-track-ribbon {
  height: 26px;
  background: linear-gradient(90deg, #3B0764 0%, #1E1B4B 50%, #312E81 100%);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  padding: 0 10px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(168, 85, 247, 0.15);
  flex-shrink: 0;
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bg-track-ribbon:hover {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.3), inset 0 0 12px rgba(168, 85, 247, 0.25);
}

.bg-track-ribbon.active {
  border-color: #A855F7;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.5), inset 0 0 0 1px #A855F7;
  background: linear-gradient(90deg, #581C87 0%, #2E1065 50%, #4338CA 100%);
}

.bg-track-ribbon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: ribbonShimmer 4s infinite linear;
}

@keyframes ribbonShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.bg-ribbon-label {
  font-size: 10px;
  font-weight: 600;
  color: #E9D5FF;
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

/* =========================================================
   DRAGGABLE NEEDLE PLAYHEAD
   ========================================================= */
.timeline-playhead-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 100;
  left: var(--track-label-width); /* Base starting point at 0s */
  transition: none;
}

.playhead-handle {
  width: 12px;
  height: 14px;
  background: var(--playhead-color);
  clip-path: polygon(0% 0%, 100% 0%, 100% 65%, 50% 100%, 0% 65%);
  margin: 0 auto;
  box-shadow: 0 0 8px var(--playhead-glow);
  cursor: ew-resize;
  pointer-events: auto;
}

.playhead-line {
  width: 1.5px;
  height: calc(100% - 14px);
  background: var(--playhead-color);
  margin: 0 auto;
  box-shadow: 0 0 6px var(--playhead-glow);
}
