/* Modern CSS Variables & Styling Tokens */
:root {
    --bg-dark: #090a0f;
    --bg-surface: #12141c;
    --bg-surface-glass: rgba(18, 20, 28, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --subtitle-highlight: #facc15;
    --stage-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    --card-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    
    /* Walnut physical frame colors */
    --frame-wood-dark: #3a2216;
    --frame-wood-light: #4e3223;
    --frame-border: #27140b;
    
    /* Dynamic ambient glow */
    --ambient-glow: rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Dashboard Container */
.dashboard-container {
    width: 100%;
    max-width: 1440px;
    min-height: 95vh;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--bg-surface-glass);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    border-radius: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

.logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    vertical-align: middle;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.indicator-dot.green {
    background-color: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

/* Main Layout Grid */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    min-height: 0; /* Important for scroll containment */
}

/* Sidebar: Video Library */
.sidebar {
    background: var(--bg-surface-glass);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
}

.video-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-item {
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-item:hover, .video-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.video-item h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.video-item p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Player Section */
.player-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

/* Stage Outer Container & Responsive Aspect Box */
.stage-outer-container {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--stage-shadow);
    background: #000;
    flex-shrink: 0; /* Prevent flex layouts from shrinking the video container vertically */
    position: relative;
    z-index: 1;
}

.stage-aspect-ratio-box {
    position: relative;
    width: 900px; /* Lock standard widescreen desktop width */
    max-width: 100%; /* Fully responsive on smaller viewports */
    aspect-ratio: 16 / 9; /* Modern Native aspect ratio rendering */
}

.video-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at center, var(--ambient-glow) 0%, #000000 100%);
    transition: background 0.8s ease;
}

/* Background Particle Canvas */
#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Asset Compositor Slot */
.asset-slot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.visual-card {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 0 50px var(--ambient-glow), var(--card-shadow);
    border: 8px solid var(--frame-wood-dark);
    outline: 2px solid var(--frame-border);
    background-color: var(--frame-wood-light);
    border-radius: 16px;
    overflow: hidden;
    transform-origin: bottom center;
    will-change: transform, opacity, filter, mask-position;
    /* NO transition here — each preset defines its own entry animation.
       This ensures the old card exits immediately without any lingering fade. */
}

.visual-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Kinetic Motion Preset Classes */
.preset-pop_in {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.6);
}
.preset-pop_in.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.preset-slide_in_left {
    opacity: 0;
    transform: translate3d(-100%, 0, 0) scale(1);
}
.preset-slide_in_left.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.preset-slide_in_right {
    opacity: 0;
    transform: translate3d(100%, 0, 0) scale(1);
}
.preset-slide_in_right.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.preset-slide_in_bottom {
    opacity: 0;
    transform: translate3d(0, 80%, 0) scale(1);
}
.preset-slide_in_bottom.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.preset-slide_in_top {
    opacity: 0;
    transform: translate3d(0, -80%, 0) scale(1);
}
.preset-slide_in_top.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.preset-float {
    opacity: 1;
    animation: floating-sway 6s ease-in-out infinite alternate;
}

/* ============================================================
   Advanced Compositor Presets
   IMPORTANT: The start state (opacity:0, mask at edge, filter on)
   must be committed by the browser BEFORE the transition is set.
   JS uses a double-rAF to guarantee two separate paint frames.
   ============================================================ */

/* 1. Paint brush — canvas animation in player.js (animatePaintBrushTransition)
   No CSS mask or filter needed: JS covers the card with a canvas and paints it away. */
.preset-paint {
    opacity: 1;
}
.preset-paint.active {
    opacity: 1;
}

/* 2. Sketch outline — canvas animation in player.js (animateSketchTransition)
   No CSS mask or filter needed: JS slides in a parchment overlay and erases it
   with directional strokes revealing the grayscale sketch, then bleeds to color. */
.preset-sketch {
    opacity: 1;
}
.preset-sketch.active {
    opacity: 1;
}
.preset-sketch img {
    /* mask removed — JS controls the reveal */
}
.preset-sketch.active img {
    /* mask removed — JS controls the reveal */
}


/* 3. Liquid wave
   Starts fully transparent so the high-displacement image doesn't pop in.
   Fades to opacity:1 over 300ms while JS dampens the displacement from 150→0.
   After displacement reaches 0 the filter is cleared via JS. */
.preset-liquid {
    opacity: 0;
    filter: url(#liquid-filter);
    transition: none;
}
.preset-liquid.active {
    opacity: 1;
    /* Short fade-in covers the high-displacement start state */
    transition: opacity 0.3s ease-out;
}

/* 4. Aura glow
   The card scales up gently. A separate .aura-halo sibling DIV (injected outside
   the card by JS so it isn't clipped by overflow:hidden) pulses outward and settles,
   creating a cinematic light-bloom around the card frame. */
.preset-aura {
    opacity: 0;
    transform: scale(0.94);
    transition: none;
}
.preset-aura.active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.6s ease, transform 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Aura halo: lives as a sibling behind the card, NOT inside it */
.aura-halo {
    position: absolute;
    border-radius: 20px;
    pointer-events: none;
    z-index: 1;   /* behind the card (card is z-index:2) */
    opacity: 0;
    animation: aura-bloom 2.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes aura-bloom {
    0%   { opacity: 0;   transform: scale(0.88); filter: blur(28px) brightness(1.4); }
    18%  { opacity: 0.9; transform: scale(1.12); filter: blur(35px) brightness(1.8); }
    55%  { opacity: 0.6; transform: scale(1.05); filter: blur(30px) brightness(1.3); }
    100% { opacity: 0.4; transform: scale(1.02); filter: blur(24px) brightness(1.1); }
}

/* Legacy aura-wash inside card kept for backwards compat but hidden */
.aura-wash {
    display: none;
}

@keyframes floating-sway {
    0% {
        transform: translate3d(0, 0px, 0) rotate(0deg);
    }
    50% {
        transform: translate3d(0, -8px, 0) rotate(0.5deg);
    }
    100% {
        transform: translate3d(0, 4px, 0) rotate(-0.5deg);
    }
}

/* Sketch two-phase keyframe removed — replaced by canvas-based animateSketchTransition() in player.js */


/* Subtitle Overlay & Kinetic highlight */
.subtitle-overlay {
    position: absolute;
    bottom: 5%;
    left: 5%;
    width: 90%;
    z-index: 100 !important; /* Force to render in front of card layers and canvas */
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.subtitle-box {
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.82) !important;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    display: inline-flex; /* Use inline-flex to prevent horizontal flex layout collapse */
    min-width: 120px;
    max-width: min(720px, 88%);  /* cap width so long phrases wrap in 1–2 lines, not a wall */
    max-height: 28%;             /* never cover most of the visual */
    overflow: hidden;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 8px;
    backdrop-filter: blur(8px);
}

/* Portrait / vertical: tighter captions so the card stays visible */
.aspect-portrait .subtitle-box,
.stage-outer-container.aspect-portrait .subtitle-box {
    font-size: 16px;
    max-width: 92%;
    min-width: 0;
    padding: 7px 12px;
    gap: 4px 6px;
    line-height: 1.35;
}

.aspect-portrait .subtitle-overlay {
    bottom: 6%;
    left: 4%;
    width: 92%;
}

.subtitle-word {
    display: inline-block; /* Ensure spans behave as solid blocks with dimensions for correct rendering */
    color: var(--text-primary);
    opacity: 0.65;
    transition: color 0.1s ease, transform 0.1s ease, opacity 0.1s ease;
    transform-origin: center;
}

.subtitle-word.highlight {
    opacity: 1 !important;
    color: var(--subtitle-highlight) !important;
    transform: scale(1.12);
}

.aspect-lbl, .transition-lbl {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.aspect-select, .transition-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    outline: none;
    font-weight: 600;
    cursor: pointer;
    margin-right: 16px;
}

/* Stage Overlays */
.stage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(9, 10, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    transition: opacity 0.3s ease;
}

.stage-overlay.hidden {
    display: none !important;
}

.stage-overlay.clickable {
    cursor: pointer;
}

.btn-play-big {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: none;
    color: white;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.btn-play-big:hover {
    transform: scale(1.1);
    background-color: var(--primary-hover);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
}

.play-arrow {
    margin-left: 4px;
}

/* Spinners */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-small {
    width: 24px;
    height: 24px;
    margin: 20px auto;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Control Panel */
.control-panel {
    background: var(--bg-surface-glass);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    padding: 15px 20px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 20;
}

/* Scrub bar */
.scrub-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.time-label {
    font-family: monospace;
    font-size: 13px;
    color: var(--text-secondary);
    width: 45px;
}

.scrub-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    accent-color: var(--primary-color);
    cursor: pointer;
    transition: background 0.1s ease;
}

/* Buttons and Knobs Row */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctrl-btn {
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ctrl-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}

.ctrl-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.vol-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.vol-icon {
    font-size: 14px;
}

.vol-slider {
    width: 80px;
    accent-color: var(--primary-color);
}

.speed-lbl {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.speed-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    outline: none;
    font-weight: 600;
    cursor: pointer;
}

/* Dev Metrics Panel */
.metrics-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metrics-panel h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.metrics-log {
    height: 100px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    color: #34d399; /* Green terminal font */
}

.meta-log {
    color: var(--text-secondary);
}

/* Portrait / Vertical Video Layout overrides */
.stage-outer-container.aspect-portrait {
    max-width: 350px; /* Perfectly wraps a 70vh tall 9:16 mobile stage */
    border: 1px solid var(--border-color);
    box-shadow: var(--stage-shadow);
    border-radius: 24px; /* More rounded to mimic physical mobile screen chassis */
}

.stage-aspect-ratio-box.aspect-portrait {
    padding-top: 0 !important;
    aspect-ratio: 9 / 16 !important;
    height: 70vh !important; /* Viewport locked height for authentic tall mobile scaling */
    width: 100% !important;
    margin: 0 auto;
}

.stage-aspect-ratio-box.aspect-portrait .visual-card,
.stage-aspect-ratio-box.aspect-portrait .aura-halo {
    width: 90% !important;
    left: 5% !important;
    bottom: 45% !important; /* Move higher up in the upper half of screen */
}

.stage-aspect-ratio-box.aspect-portrait .subtitle-overlay {
    bottom: 5% !important;
    width: 90% !important;
    left: 5% !important;
    height: auto !important;
}

.stage-aspect-ratio-box.aspect-portrait .subtitle-box {
    font-size: 16px !important; /* Scale text down to prevent blocking visual cards in vertical column */
    padding: 8px 16px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    max-width: 95%;
}

/* Fullscreen Media Layout API styling */
.stage-outer-container:fullscreen {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.stage-outer-container:fullscreen .stage-aspect-ratio-box {
    width: 100% !important;
    max-width: 1100px !important; /* Cap width to prevent oversized visual card distortion */
    padding-top: 56.25% !important;
}

/* Portrait Fullscreen styling overrides */
.stage-outer-container.aspect-portrait:fullscreen .stage-aspect-ratio-box {
    max-width: none !important;
    height: 90vh !important;
    width: auto !important;
    aspect-ratio: 9 / 16 !important;
    padding-top: 0 !important;
}

/* Floating Exit Fullscreen Button */
.exit-fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 150 !important;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none; /* Hidden by default in normal view */
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.exit-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Show the escape floating button only when actually inside fullscreen */
.stage-outer-container:fullscreen .exit-fullscreen-btn {
    display: block !important;
}

/* Caption Calibrator Panel Styling */
.calibrator-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--stage-shadow);
}

.calibrator-panel h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.calibrator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.calibrator-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calibrator-item label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.cal-val {
    font-family: monospace;
    font-weight: 700;
    color: var(--subtitle-highlight);
}

.cal-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    transition: background 0.2s;
}

.cal-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--subtitle-highlight);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Chapter Navigator Styles */
.chapter-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px; /* Lock list height for compact layout */
    background: rgba(0, 0, 0, 0.05);
}

.chapter-item {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.chapter-item:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-color);
}

.chapter-item .chapter-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.chapter-item .chapter-time {
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-light);
    font-family: 'Inter', monospace;
}

/* Interactive Transcript Panel */
.transcript-panel {
    background: var(--bg-surface-glass);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 250px;
}

.transcript-panel h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
}

.transcript-content {
    position: relative;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    padding-right: 8px;
    text-align: left;
}

.transcript-scene-block {
    display: inline;
}

.transcript-token {
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    transition: all 0.15s ease;
    display: inline;
}

.transcript-token:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.transcript-token.active-token {
    color: var(--subtitle-highlight);
    background: rgba(250, 204, 21, 0.18);
    font-weight: 600;
}

/* Custom Progress Bar Hover Preview */
.scrub-preview {
    position: absolute;
    bottom: 30px;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.scrub-preview.hidden {
    opacity: 0;
    pointer-events: none;
}

.scrub-preview img {
    width: 100px;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    background: #000;
    object-fit: cover;
    display: block;
}

.scrub-preview span {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: 'Inter', monospace;
}

/* Search Container & Dropdown Input */
.search-container {
    position: relative;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

#video-search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

#video-search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 5px;
    padding: 8px 0;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.search-results.hidden {
    display: none !important;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: rgba(99, 102, 241, 0.15);
}

.search-result-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    width: 100%;
}

.search-result-thumb {
    width: 48px;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    object-fit: cover;
    background: #000;
    flex-shrink: 0;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-result-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
