/* SMAU FILE
 * Path: css/smau-studio-timeline.css
 * Owns: Styling for the horizontal Studio timeline (js/creator/creator.timeline.js)
 * Namespace: all classes prefixed `stl-`
 */

.stl-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
  min-width: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  background: transparent;
}

/* ── Empty state ───────────────────────────────────────────────── */
.stl-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Toolbar ───────────────────────────────────────────────────── */
.stl-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 14, 24, 0.6);
}

.stl-count {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.stl-zoom {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stl-zoom-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.stl-zoom-btn:hover {
  background: var(--creator-accent-dim, rgba(255, 204, 102, 0.15));
  border-color: var(--creator-accent, #ffcc66);
  color: var(--creator-accent, #ffcc66);
}

.stl-zoom-btn:focus-visible {
  outline: 2px solid var(--creator-accent, #ffcc66);
  outline-offset: 1px;
}

/* ── Scroll canvas ─────────────────────────────────────────────── */
.stl-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  position: relative;
  background: rgba(5, 6, 14, 0.35);
}

.stl-content {
  position: relative;
}

/* ── Ruler ─────────────────────────────────────────────────────── */
.stl-ruler {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: stretch;
  background: rgba(9, 9, 18, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stl-ruler-corner {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: 0 0 auto;
  background: rgba(9, 9, 18, 0.98);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.stl-ruler-ticks {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
}

.stl-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.stl-tick-label {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

/* ── Lanes ─────────────────────────────────────────────────────── */
.stl-lanes {
  display: flex;
  flex-direction: column;
}

.stl-lane {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stl-lane:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.stl-lane-label {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(13, 14, 24, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stl-lane-track {
  position: relative;
  flex: 0 0 auto;
}

/* Lane accent hues (left edge tint on the label chip) */
.stl-lane-thread .stl-lane-label { border-left: 3px solid #66c2ff; }
.stl-lane-calls .stl-lane-label { border-left: 3px solid #58d68d; }
.stl-lane-alerts .stl-lane-label { border-left: 3px solid #ff9f5c; }
.stl-lane-social .stl-lane-label { border-left: 3px solid #ff6ec7; }
.stl-lane-evidence .stl-lane-label { border-left: 3px solid #ffd166; }
.stl-lane-money .stl-lane-label { border-left: 3px solid #3ecf8e; }
.stl-lane-sound .stl-lane-label { border-left: 3px solid #7fd0d6; }
.stl-lane-system .stl-lane-label { border-left: 3px solid #b48cff; }
.stl-lane-pacing .stl-lane-label { border-left: 3px solid rgba(255, 255, 255, 0.4); }

/* ── Chips ─────────────────────────────────────────────────────── */
.stl-chip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  min-width: 28px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(30, 28, 46, 0.92);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.stl-chip:hover,
.stl-chip:focus-visible {
  border-color: var(--creator-accent, #ffcc66);
  outline: none;
}

.stl-chip.stl-chip-dragging {
  cursor: grabbing;
  z-index: 4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.stl-chip.stl-chip-selected {
  border-color: var(--creator-accent, #ffcc66);
  box-shadow: 0 0 0 2px rgba(255, 204, 102, 0.35);
}

.stl-chip.stl-chip-filler {
  border-style: dashed;
  opacity: 0.82;
}

.stl-chip-icon {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
}

.stl-chip-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.88);
}

/* Lane-hue left bar on the chip itself, matching its lane */
.stl-lane-thread .stl-chip { border-left: 3px solid #66c2ff; }
.stl-lane-calls .stl-chip { border-left: 3px solid #58d68d; }
.stl-lane-alerts .stl-chip { border-left: 3px solid #ff9f5c; }
.stl-lane-social .stl-chip { border-left: 3px solid #ff6ec7; }
.stl-lane-evidence .stl-chip { border-left: 3px solid #ffd166; }
.stl-lane-money .stl-chip { border-left: 3px solid #3ecf8e; }
.stl-lane-sound .stl-chip { border-left: 3px solid #7fd0d6; }
.stl-lane-system .stl-chip { border-left: 3px solid #b48cff; }

/* "Delay" gap chips: hatched pacing block, not a message-like pill */
.stl-chip-gap {
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.07),
    rgba(255, 255, 255, 0.07) 6px,
    rgba(255, 255, 255, 0.02) 6px,
    rgba(255, 255, 255, 0.02) 12px
  );
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  justify-content: center;
  cursor: grab;
}

.stl-chip-gap-label {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.stl-chip-close {
  flex: 0 0 auto;
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  width: 16px;
  height: 16px;
  line-height: 1;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.stl-chip:hover .stl-chip-close,
.stl-chip:focus-within .stl-chip-close,
.stl-chip.stl-chip-dragging .stl-chip-close {
  opacity: 1;
}

.stl-chip-close:hover {
  background: rgba(255, 92, 92, 0.2);
  color: #ff5c5c;
}

/* Touch: only always-show the × on chips wide enough to host it comfortably */
@media (hover: none) {
  .stl-chip-wide .stl-chip-close {
    opacity: 0.85;
  }
}

/* ── Scrub preview: toolbar cluster, playhead, fired chips ─────── */
.stl-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stl-preview-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11.5px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease;
}

.stl-preview-btn:hover,
.stl-preview-btn:focus-visible {
  border-color: var(--creator-preview-accent, #6ecbff);
  outline: none;
}

.stl-toolbar[data-preview="on"] .stl-preview-btn {
  border-color: var(--creator-preview-accent, #6ecbff);
  background: rgba(110, 203, 255, 0.14);
  color: #cfeaff;
}

.stl-preview-time {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--creator-preview-accent, #6ecbff);
  white-space: nowrap;
}

.stl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--creator-preview-accent, #6ecbff);
  box-shadow: 0 0 8px rgba(110, 203, 255, 0.55);
  z-index: 5;
  pointer-events: none;
}

.stl-playhead[data-active="false"] {
  display: none;
}

.stl-playhead-time {
  position: sticky;
  top: 2px;
  display: inline-block;
  transform: translateX(4px);
  background: rgba(9, 9, 18, 0.96);
  border: 1px solid var(--creator-preview-accent, #6ecbff);
  color: #cfeaff;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.stl-playhead-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -6px;
  width: 14px;
  cursor: ew-resize;
  pointer-events: auto;
}

/* The ruler doubles as a scrub strip once you know it's there. */
.stl-ruler-ticks {
  cursor: ew-resize;
}

.stl-chip.stl-chip-fired {
  border-color: rgba(110, 203, 255, 0.55);
  background: rgba(24, 42, 58, 0.92);
}

.stl-chip.stl-chip-current {
  border-color: var(--creator-preview-accent, #6ecbff);
  box-shadow: 0 0 0 2px rgba(110, 203, 255, 0.35);
}

/* ── Drag tooltip (appended to <body>, positioned via inline left/top) ── */
.stl-drag-tooltip {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  background: rgba(9, 9, 18, 0.96);
  border: 1px solid var(--creator-accent, #ffcc66);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* ── Motion preference ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .stl-zoom-btn,
  .stl-chip,
  .stl-chip-close {
    transition: none !important;
  }
}
