/* ============================================================================
 * SYLLOVO VIDEO EDITOR v27.0 — MINIMALIST PROGRESSIVE-DISCLOSURE CHROME
 * Spec: SYL-SPEC-012 (VE-RULE-001..014)
 * Brand Theme: Preserves #FFFFFF Studio shell; scoped strictly to Video Editor
 * ============================================================================ */

/* 1. Single-Row Calm Timeline Toolbar (5 Progressive-Disclosure Groups) */
#studio-timeline-editor-wrapper.is-drawer-expanded,
.camtasia-timeline-dock {
  overflow: visible !important;
}

.camtasia-timeline-dock .timeline-top-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  padding: 6px 10px !important;
  min-height: 40px !important;
  background: #0f172a !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
  overflow: visible !important;
  position: relative !important;
  z-index: 420 !important;
}

/* Keep VT#k vM + AT#k vM completely unclipped inside desktop transport bar */
@media (min-width: 821px) {
  .yt-control-bar.yt-transport-bar {
    gap: 4px !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
  .yt-control-bar .yt-ctrl-left,
  .yt-control-bar .yt-ctrl-right {
    gap: 4px !important;
  }
  .yt-control-bar .yt-ctrl-left {
    min-width: 0 !important;
  }
  .yt-control-bar .yt-nudge-btn {
    padding: 3px 5px !important;
    font-size: 10.5px !important;
  }
  .yt-control-bar #camtasia-timecode-readout {
    font-size: 10.5px !important;
    padding: 0 2px !important;
  }
  .yt-control-bar .yt-inline-caption {
    font-size: 10px !important;
    padding: 2px 5px !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  .yt-control-bar .yt-live-clip-id,
  .yt-control-bar .yt-live-beat-counter {
    display: none !important;
  }
}

.ve-min-toolbar-left,
.ve-min-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ve-min-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans, Inter, system-ui, sans-serif);
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}

.ve-min-btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.96);
  border-color: rgba(148, 163, 184, 0.5);
}

.ve-min-btn:disabled,
.camtasia-timeline-dock button:disabled {
  opacity: 0.44 !important;
  cursor: not-allowed !important;
  filter: saturate(0.55);
}

.ve-min-btn.is-icon-only {
  padding: 0 7px;
  min-width: 30px;
}

.ve-min-btn.is-locks-trigger {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
}

.ve-min-btn.is-locks-trigger.is-sealed {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}

.ve-min-btn.is-solo-fix {
  border-color: rgba(99, 102, 241, 0.55);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.28), rgba(16, 185, 129, 0.18));
  color: #e0e7ff;
  font-weight: 800;
}

.ve-min-btn.is-solo-fix:hover:not(:disabled) {
  border-color: #818cf8;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.42), rgba(16, 185, 129, 0.28));
}

.ve-hover-readout-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.34);
  color: #bae6fd;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.ve-sealed-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.48);
  color: #fcd34d;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

/* 2. Progressive-Disclosure Popovers: Locks Matrix & More Tools */
.ve-popover-anchor {
  position: relative;
  display: inline-flex;
}

.ve-popover-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(440px, calc(100vw - 32px));
  max-height: 74vh;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 11px;
  padding: 11px 12px;
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.68);
  z-index: 260;
  color: #f1f5f9;
}

.ve-popover-panel.align-right {
  left: auto;
  right: 0;
  width: min(350px, calc(100vw - 32px));
}

.ve-popover-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 6px 0 5px;
}

.ve-popover-section-title:first-child {
  margin-top: 0;
}

.ve-lock-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.ve-chunk-matrix-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.ve-chunk-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(30, 41, 59, 0.9);
  color: #cbd5e1;
  cursor: pointer;
}

.ve-chunk-chip-btn.is-locked {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

.ve-chunk-chip-btn.is-active-beat {
  box-shadow: 0 0 0 1.5px #38bdf8;
}

.ve-tools-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.ve-tools-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.24);
  cursor: pointer;
  text-align: left;
}

.ve-tools-menu-item:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(148, 163, 184, 0.48);
}

.ve-tools-menu-item.is-costly-rebuild {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
}

.ve-tools-menu-item.is-costly-audio {
  grid-column: 1 / -1;
  border-color: rgba(244, 63, 94, 0.42);
  background: rgba(244, 63, 94, 0.11);
  color: #fecdd3;
}

/* 3. 60fps Hover Ghost Timecode Cursor & Unclipped 00:00 Ruler Tick (VE-RULE-010) */
#tl-hover-time-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(56, 189, 248, 0.88);
  pointer-events: none !important;
  z-index: 38;
  display: none;
}

#tl-hover-time-pill {
  position: absolute;
  top: 2px;
  left: 0;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none !important;
  box-shadow: 0 3px 10px rgba(2, 6, 23, 0.55);
}

.ruler-tick[data-sec="0"],
.timeline-ruler > .ruler-tick:first-child {
  transform: none !important;
  padding-left: 24px !important;
}

/* Hide duplicate technical metadata prefix in spoken CC bars — badges live cleanly in Transport / Live Track Bar (VE-RULE-002 / BUG-VE-005) */
#stage-caption-badge,
#mobile-cc-chunk-badge {
  display: none !important;
}

/* Mobile sleek custom scrub bar & single-row unclipped action strip (BUG-VE-005) */
.mobile-stage-scrub-bar.stage-video-scrub-wrap {
  height: 12px !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 !important;
  background: #090d16 !important;
  cursor: pointer !important;
}

#mobile-yt-action-strip {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 5px !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

#mobile-yt-action-strip .mobile-editor-ctrl-btn {
  min-width: 30px !important;
  min-height: 30px !important;
  flex-shrink: 0 !important;
}

#mobile-yt-action-strip .mobile-editor-clip-select {
  flex: 1 1 auto !important;
  min-width: 76px !important;
  max-width: 158px !important;
}

/* 4. Per-Chunk Lock Badge, Locked Stripe & Shift+Click Multi-Select */
.tl-chunk {
  pointer-events: auto !important;
}

.tl-chunk.is-chunk-locked {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(15, 23, 42, 0.16),
    rgba(15, 23, 42, 0.16) 6px,
    rgba(16, 185, 129, 0.07) 6px,
    rgba(16, 185, 129, 0.07) 12px
  ) !important;
}

.tl-chunk.is-multi-selected-chunk {
  outline: 2px solid #38bdf8 !important;
  outline-offset: -1px;
}

.tl-chunk-lock-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 9.5px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.tl-chunk-lock-chip.is-locked {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

/* 5. Mandatory Pre-Rebuild Cost & Scope Alert Modal (VE-RULE-008) */
.ve-cost-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9850;
}

.ve-cost-modal-card {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(245, 158, 11, 0.48);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.78);
}

.ve-cost-scope-box {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12px;
}

/* 6. Mobile Zero-Collision & Fixed Popover Sheet Rules (BUG-VE-002 / BUG-VE-003) */
@media (max-width: 820px) {
  .camtasia-timeline-dock .timeline-top-toolbar {
    padding: 5px 6px !important;
    gap: 4px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .camtasia-timeline-dock .timeline-top-toolbar > div,
  .ve-min-toolbar-left,
  .ve-min-toolbar-right {
    gap: 4px !important;
    flex-wrap: wrap !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .camtasia-timeline-dock .ve-min-btn {
    padding: 0 7px !important;
    font-size: 10.5px !important;
    max-width: 100% !important;
  }

  .ve-popover-panel,
  .ve-popover-panel.align-right {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: 84px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    max-height: 76vh !important;
    z-index: 9600 !important;
  }

  .ve-lock-quick-grid,
  .ve-tools-menu-grid {
    grid-template-columns: 1fr !important;
  }
}

body.force-mobile-preview .camtasia-timeline-dock .timeline-top-toolbar {
  padding: 5px 6px !important;
  gap: 4px !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body.force-mobile-preview .ve-min-toolbar-left,
body.force-mobile-preview .ve-min-toolbar-right {
  gap: 4px !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

body.force-mobile-preview .ve-popover-panel,
body.force-mobile-preview .ve-popover-panel.align-right {
  position: fixed !important;
  left: 12px !important;
  right: 12px !important;
  top: 84px !important;
  width: auto !important;
  max-width: 390px !important;
  max-height: 74vh !important;
  z-index: 9600 !important;
}

/* ============================================================================
 * 7. DESKTOP 100dvh WORKBENCH FIT & ABOVE-THE-FOLD 3-TRACK TIMELINE VISIBILITY
 *    (BUG-VE-006: EDITOR-DESKTOP-TIMELINE-VISIBLE-BY-DEFAULT-AND-ABOVE-FOLD-100DVH-FIT-01)
 *    - Guarantees both the 16:9 Video Stage (0px pillarbox, BUG-024) AND all 3
 *      Timeline Tracks (Callouts, Audio · AT, Video · VT) fit cleanly above the
 *      fold on Desktop & Widescreen viewports (1440x900, 1512x820, 1728x903+).
 *    - Applies unconditionally to .studio-player-shell regardless of drawer
 *      toggle state so #camtasia-play-btn Δy === 0.00px (BUG-049 / VE-RULE-003).
 * ============================================================================ */
@media (min-width: 901px) {
  body:not(.force-mobile-preview):not(.mobile-preview-active) #app-layout-root.studio-tab-active .workspace-scroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent !important;
    padding: 6px 12px 10px 12px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) #app-layout-root.studio-tab-active .workspace-scroll::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
    display: block !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) #app-layout-root.studio-tab-active .workspace-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42) !important;
    border-radius: 999px !important;
  }

  /* Proportionally cap 16:9 player shell width by viewport height so wide monitors never push the 3 timeline tracks below the fold */
  body:not(.force-mobile-preview):not(.mobile-preview-active) .studio-player-shell:not(.stage-fullscreen-active) {
    width: 100% !important;
    max-width: min(100%, max(620px, calc((100dvh - 478px) * 16 / 9))) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) .studio-player-shell:not(.stage-fullscreen-active) #stage-subtitle-overlay.stage-below-cc-bar {
    padding: 5px 14px !important;
    min-height: 36px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) .studio-player-shell:not(.stage-fullscreen-active) .yt-control-bar.yt-transport-bar {
    min-height: 36px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) #studio-timeline-editor-wrapper.is-drawer-expanded {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) #studio-timeline-editor-wrapper.is-drawer-expanded .camtasia-timeline-dock {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 4px !important;
  }

  /* Compact, high-clarity 3-track lane heights so Callouts + Audio AT + Video VT fit simultaneously above the fold */
  body:not(.force-mobile-preview):not(.mobile-preview-active) .camtasia-timeline-dock .th-ruler-spacer,
  body:not(.force-mobile-preview):not(.mobile-preview-active) .camtasia-timeline-dock .timeline-ruler {
    height: 26px !important;
    min-height: 26px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="sm"] #callout-track-lane,
  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="sm"] #tl-callout-track-header,
  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="md"] #callout-track-lane,
  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="md"] #tl-callout-track-header {
    height: 50px !important;
    min-height: 50px !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    gap: 1px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) #tl-callout-track-header .ve-track-icon-del-btn {
    height: 18px !important;
    min-height: 18px !important;
    width: 18px !important;
    min-width: 18px !important;
    padding: 0 !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="sm"] #callout-track-lane .tl-chunk,
  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="md"] #callout-track-lane .tl-chunk {
    height: 34px !important;
    top: 5px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="md"] .timeline-track-lane:not(#callout-track-lane),
  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="md"] .track-label-row {
    height: 64px !important;
    min-height: 64px !important;
  }

  body:not(.force-mobile-preview):not(.mobile-preview-active) .timeline-workbench[data-track-height="md"] .timeline-track-lane:not(#callout-track-lane) .tl-chunk {
    height: 52px !important;
    top: 5px !important;
  }
}
