/* ═══════════════════════════════════════════════════════════════
   VideoMaker — Multi-Track Timeline Editor (v1.0)
   Professional Glassmorphic Editing Suit
   ═══════════════════════════════════════════════════════════════ */

:root {
    --timeline-height: 220px;
    --ruler-height: 30px;
    --track-label-width: 80px;
    --playhead-color: #ef4444;
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --bg-timeline: rgba(15, 23, 42, 0.9);
    --border-timeline: rgba(255, 255, 255, 0.08);
}

#yt-timeline-container {
    position: fixed;
    bottom: 0;
    left: 260px; /* Assume sidebar width, adjust via JS */
    right: 0;
    height: var(--timeline-height);
    background: var(--bg-timeline);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-timeline);
    z-index: 1000;
    display: none; /* Shown only in view-yt-editor */
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#yt-timeline-container.active {
    display: flex;
}

/* ── Timeline Header (Controls) ────────────────────────────────────────── */
.timeline-header {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    border-bottom: 1px solid var(--border-timeline);
}

.timeline-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.timeline-stats {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #94a3b8;
    flex-wrap: wrap;
}

.timeline-btn {
    background: transparent;
    border: 1px solid var(--border-timeline);
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.timeline-btn.is-active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.45);
    color: #dbeafe;
}

/* ── Ruler & Content ───────────────────────────────────────────────────── */
.timeline-viewport {
    flex: 1;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: auto;
}

.timeline-viewport::-webkit-scrollbar {
    height: 6px;
}

.timeline-viewport::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.timeline-content {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.timeline-ruler {
    height: var(--ruler-height);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-timeline);
    position: relative;
    cursor: pointer;
}

.ruler-tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
}

.ruler-label {
    position: absolute;
    bottom: 8px;
    font-size: 9px;
    color: #64748b;
    transform: translateX(-50%);
}

/* ── Tracks ────────────────────────────────────────────────────────────── */
.timeline-track {
    height: 48px;
    display: flex;
    position: relative;
    border-bottom: 1px solid var(--border-timeline);
}

.track-label {
    position: sticky;
    left: 0;
    width: var(--track-label-width);
    background: rgba(15, 23, 42, 0.95);
    z-index: 10;
    display: flex;
    align-items: center;
    padding-left: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    border-right: 1px solid var(--border-timeline);
}

/* ── Blocks ────────────────────────────────────────────────────────────── */
.timeline-block {
    position: absolute;
    top: 5px;
    bottom: 5px;
    appearance: none;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.timeline-block:hover {
    box-shadow: 0 0 0 2px var(--accent-blue);
}

.timeline-block.active {
    box-shadow: 0 0 0 2px #fff;
    z-index: 5;
}

.block-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.block-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.timeline-block-audio {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
}

.timeline-block-overlay {
    background: linear-gradient(135deg, #f472b6, #db2777);
}

/* ── Playhead ─────────────────────────────────────────────────────────── */
#timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--playhead-color);
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 0 10px var(--playhead-color);
}

#timeline-playhead::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: var(--ruler-height);
    background: var(--playhead-color);
    border-radius: 0 0 4px 4px;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.theme-light #yt-timeline-container {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .track-label {
    background: rgba(255, 255, 255, 0.95);
    color: #64748b;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .timeline-stats {
    color: #64748b;
}
