/* Video Editor — extends ../shared/editor-core.css */
/* Inherits all base tokens. Aliases for backward compatibility: */
:root {
    --bg-primary: var(--bg);
    --bg-secondary: var(--surface);
    --bg-tertiary: var(--surface-hover);
    --bg-quaternary: var(--surface-active);
    --bg-hover: var(--surface-hover);
    --bg-active: var(--surface-active);

    --accent: var(--brand);
    --accent-hover: var(--brand-dark);
    --accent-light: var(--brand-light);
    --accent-dim: var(--brand-dark);
    --accent-glow: var(--brand-glow);

    --text-primary: var(--text);
    --text-secondary: var(--text-secondary);
    --text-muted: var(--text-muted);
    --text-accent: var(--brand-light);

    --border-light: var(--border-light);
    --border-accent: #9333ea;

    --clip-video: #7c3aed;
    --clip-video-bg: rgba(124, 58, 237, 0.3);
    --clip-audio: #3b82f6;
    --clip-audio-bg: rgba(59, 130, 246, 0.3);
    --clip-image: #10b981;
    --clip-image-bg: rgba(16, 185, 129, 0.3);
    --clip-text: #f59e0b;
    --clip-text-bg: rgba(245, 158, 11, 0.3);

    --playhead: #a855f7;
    --snap-line: #f59e0b;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);

    --header-height: 42px;
    --timeline-height: 300px;
    --media-panel-width: 260px;
    --properties-panel-height: 280px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* =========== Scrollbar =========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-quaternary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* =========== HEADER =========== */
#header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    flex-shrink: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

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

.menu-btn {
    padding: 5px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-family: var(--font);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-btn.active {
    background: var(--accent);
    color: white;
}

.brand-logo {
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-light);
    letter-spacing: -0.3px;
}

.brand-logo span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12px;
    margin-left: 4px;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-secondary);
    transition: all 0.12s;
}

.dropdown-item:hover {
    background: var(--accent);
    color: white;
}

.dropdown-item .shortcut {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 24px;
}

.dropdown-item:hover .shortcut {
    color: rgba(255,255,255,0.7);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.menu-wrapper {
    position: relative;
}

/* =========== WORKSPACE =========== */
#workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* =========== MEDIA PANEL =========== */
#media-panel {
    width: var(--media-panel-width);
    min-width: 200px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-title {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.panel-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn.active {
    color: var(--accent-light);
}

/* Media Drop Zone */
.media-drop-zone {
    padding: 20px;
    margin: 10px;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.media-drop-zone:hover,
.media-drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.media-drop-zone .drop-icon {
    font-size: 28px;
    margin-bottom: 6px;
    opacity: 0.6;
}

.media-drop-zone .drop-text {
    font-size: 12px;
    color: var(--text-muted);
}

.media-drop-zone .drop-text strong {
    color: var(--accent-light);
}

/* Media List */
.media-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.media-list.grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.media-list.list-view {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Media Item */
.media-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all 0.15s;
    border: 1px solid transparent;
    overflow: hidden;
}

.media-item:hover {
    border-color: var(--border-light);
    background: var(--bg-quaternary);
}

.media-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.media-item:active {
    cursor: grabbing;
}

/* Grid view media item */
.grid-view .media-item {
    display: flex;
    flex-direction: column;
}

.grid-view .media-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.grid-view .media-thumb img,
.grid-view .media-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-view .media-thumb .type-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(0,0,0,0.6);
    color: white;
    text-transform: uppercase;
    font-weight: 600;
}

.grid-view .media-info {
    padding: 5px 7px;
}

.grid-view .media-name {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-view .media-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* List view media item */
.list-view .media-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
}

.list-view .media-thumb {
    width: 50px;
    height: 32px;
    border-radius: 3px;
    background: var(--bg-primary);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-view .media-thumb img,
.list-view .media-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-view .media-info {
    flex: 1;
    min-width: 0;
}

.list-view .media-name {
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-view .media-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.media-thumb-placeholder {
    font-size: 18px;
    opacity: 0.3;
}

/* =========== CENTER AREA =========== */
#center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* =========== PLAYER =========== */
#player-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    min-height: 0;
}

.player-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: #000;
}

.player-canvas {
    max-width: 100%;
    max-height: 100%;
    background: #000;
}

.player-empty-state {
    position: absolute;
    text-align: center;
    color: var(--text-muted);
}

.player-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.3;
}

.player-empty-state p {
    font-size: 13px;
}

/* Player Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.player-controls .ctrl-btn {
    width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.12s;
}

.player-controls .ctrl-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.player-controls .ctrl-btn.playing {
    color: var(--accent-light);
}

.player-time {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    min-width: 140px;
    text-align: center;
}

.player-time .current {
    color: var(--text-primary);
    font-weight: 500;
}

.player-progress {
    flex: 1;
    height: 4px;
    background: var(--bg-quaternary);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.player-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.05s linear;
}

.player-progress:hover {
    height: 6px;
}

/* =========== PROPERTIES PANEL =========== */
#properties-panel {
    height: var(--properties-panel-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.properties-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 12px;
}

/* Property Sections */
.prop-section {
    margin-bottom: 10px;
}

.prop-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
}

.prop-section-title {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.prop-section-icon {
    font-size: 13px;
    opacity: 0.7;
}

.prop-section-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.prop-section-toggle.collapsed {
    transform: rotate(-90deg);
}

.prop-section-body {
    padding: 4px 0;
}

.prop-section-body.collapsed {
    display: none;
}

/* Property Row */
.prop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.prop-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 70px;
    flex-shrink: 0;
}

.prop-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Inputs */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-quaternary);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
}

input[type="number"],
input[type="text"],
select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 11.5px;
    padding: 4px 6px;
    outline: none;
    transition: border-color 0.15s;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    border-color: var(--accent);
}

input[type="number"] {
    width: 55px;
}

select {
    cursor: pointer;
}

input[type="color"] {
    width: 28px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    padding: 1px;
}

.prop-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.prop-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
}

/* Buttons */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========== TIMELINE =========== */
#timeline-container {
    height: var(--timeline-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.timeline-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.timeline-toolbar .ctrl-btn {
    width: 28px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all 0.12s;
}

.timeline-toolbar .ctrl-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.timeline-toolbar .ctrl-btn.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}

.toolbar-separator {
    width: 1px;
    height: 18px;
    background: var(--border);
}

.timeline-time-display {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    margin-left: 6px;
}

.timeline-time-display .current-time {
    color: var(--accent-light);
    font-weight: 600;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.zoom-control label {
    font-size: 11px;
    color: var(--text-muted);
}

.zoom-slider {
    width: 80px;
}

/* Timeline Canvas Area */
.timeline-scroll-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.timeline-track-labels {
    width: 100px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.track-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.track-label .track-name {
    font-weight: 500;
}

.track-label .track-actions {
    display: flex;
    gap: 2px;
}

.track-label .track-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    border-radius: 2px;
}

.track-label .track-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.track-label .track-btn.muted {
    color: var(--error);
}

.timeline-canvas-wrap {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
}

.timeline-canvas {
    display: block;
}

/* Ruler */
.timeline-ruler-area {
    height: 28px;
    flex-shrink: 0;
}

/* Track heights */
.track-label.video-track { height: 50px; }
.track-label.audio-track { height: 44px; }

/* =========== EXPORT DIALOG =========== */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.dialog-overlay.hidden {
    display: none;
}

.dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.dialog-title {
    font-size: 15px;
    font-weight: 600;
}

.dialog-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.dialog-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dialog-body {
    padding: 18px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}

/* Export form */
.export-form .form-group {
    margin-bottom: 14px;
}

.export-form .form-label {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.export-form select,
.export-form input {
    width: 100%;
}

.export-form .radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-form .radio-option {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.export-form .radio-option input {
    width: auto;
    accent-color: var(--accent);
}

/* Export Progress */
.export-progress {
    margin-top: 12px;
}

.export-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-quaternary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.export-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.export-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* =========== TOAST =========== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 5000;
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: white;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toast-in 0.3s ease;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); color: #1a1a1a; }
.toast.info { background: var(--info); }

.toast.removing {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* =========== CONTEXT MENU =========== */
.context-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    min-width: 160px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.context-menu-item:hover {
    background: var(--accent);
    color: white;
}

/* =========== UTILITY =========== */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }

/* Resizer handles */
.resizer {
    background: var(--border);
    cursor: col-resize;
    width: 3px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.resizer:hover {
    background: var(--accent);
}

.resizer-h {
    cursor: row-resize;
    height: 3px;
    width: 100%;
}

/* Drag ghost */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 4000;
    opacity: 0.7;
    transform: scale(0.8);
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-primary);
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-quaternary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Text overlay preview */
.text-overlay-preview {
    position: absolute;
    cursor: move;
    user-select: none;
    pointer-events: auto;
}

/* =========== AUDIO MIXER PANEL =========== */
.audio-mixer-panel {
    position: fixed;
    bottom: var(--timeline-height);
    right: 0;
    width: 420px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.audio-mixer-panel.hidden {
    display: none;
}

.mixer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.mixer-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.mixer-close-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.mixer-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mixer-channels {
    display: flex;
    gap: 1px;
    padding: 10px 8px;
    overflow-x: auto;
    background: var(--bg-primary);
}

.mixer-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 68px;
    padding: 6px 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.mixer-channel-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--border);
    width: 100%;
}

.mixer-master .mixer-channel-label {
    color: var(--accent-light);
}

.mixer-vu-meter {
    display: flex;
    gap: 3px;
    height: 80px;
    align-items: flex-end;
}

.vu-bar-bg {
    width: 10px;
    height: 100%;
    background: var(--bg-primary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.vu-bar-fill {
    width: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: height 0.06s linear;
    min-height: 1px;
}

.vu-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    font-size: 7px;
    color: var(--text-muted);
}

.mixer-fader-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.mixer-fader {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 20px;
    height: 70px;
    -webkit-appearance: slider-vertical;
}

.mixer-fader-val {
    font-size: 9px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.mixer-pan-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
}

.mixer-pan-label {
    font-size: 8px;
    color: var(--text-muted);
}

.mixer-pan {
    width: 50px;
    height: 3px;
}

.mixer-buttons {
    display: flex;
    gap: 3px;
}

.mixer-btn {
    width: 22px;
    height: 18px;
    font-size: 9px;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    font-family: var(--font);
}

.mixer-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mixer-btn.active-red {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.mixer-btn.active-green {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.mixer-btn.active-yellow {
    background: var(--warning);
    color: #1a1a1a;
    border-color: var(--warning);
}

/* =========== KEYFRAME STYLES =========== */
.keyframe-row .kf-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kf-diamond {
    color: var(--text-muted);
    font-size: 10px;
    transition: color 0.15s;
}

.kf-diamond.active {
    color: #f59e0b;
}

.kf-label:hover .kf-diamond {
    color: #f59e0b;
}

.kf-value {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 40px;
}

.kf-add-btn {
    font-size: 9px !important;
    padding: 2px 6px !important;
    background: var(--bg-quaternary) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
}

.kf-add-btn:hover {
    background: var(--accent) !important;
    color: white !important;
}

.kf-list {
    margin-left: 16px;
    margin-bottom: 6px;
    padding-left: 8px;
    border-left: 2px solid var(--border);
}

.kf-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    font-size: 10px;
    color: var(--text-muted);
}

.kf-diamond-sm {
    color: #f59e0b;
    font-size: 8px;
}

.kf-time {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 38px;
}

.kf-val {
    color: var(--text-muted);
    min-width: 30px;
}

.kf-easing {
    font-size: 9px;
    padding: 1px 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 2px;
    max-width: 65px;
}

.kf-remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    padding: 0 3px;
    border-radius: 2px;
}

.kf-remove-btn:hover {
    background: var(--error);
    color: white;
}

/* =========== COLOR GRADING =========== */
.cg-wheels-row {
    display: flex;
    justify-content: space-around;
    gap: 6px;
    margin: 8px 0;
}

.cg-wheel-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cg-wheel {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: crosshair;
}

.cg-wheel-canvas {
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: crosshair;
}

.cg-wheel-canvas:hover {
    border-color: var(--accent);
}

.cg-wheel-label {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 3px;
    text-align: center;
}

/* =========== STICKER PANEL =========== */
.sticker-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 280px;
    max-height: calc(100vh - var(--header-height) - var(--timeline-height));
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 400;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 0 0 0 var(--radius-lg);
}

.sticker-panel.hidden {
    display: none;
}

.sticker-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.sticker-item {
    aspect-ratio: 1;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-item:hover {
    border-color: var(--accent);
    background: var(--bg-quaternary);
    transform: scale(1.08);
}

.sticker-item svg {
    width: 100%;
    height: 100%;
}

/* =========== GREEN SCREEN =========== */
.gs-color-label {
    font-family: monospace;
}

/* =========== MARKER STYLES (timeline context menu additions) =========== */
/* Markers are rendered on the canvas, but these are for any DOM elements */
.marker-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 1px;
    transform: rotate(45deg);
    margin-right: 4px;
}

/* =========== SIDEBAR TABS (ClipChamp-style) =========== */
.sidebar-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    gap: 0;
}

.sidebar-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font);
    font-size: 9px;
    transition: all 0.15s;
    min-width: 0;
}

.sidebar-tab:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.sidebar-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
    background: var(--bg-secondary);
}

.sidebar-tab-icon {
    font-size: 15px;
    line-height: 1;
}

.sidebar-tab-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sidebar-tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-header-title {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.tab-body-scroll {
    flex: 1;
    overflow-y: auto;
}

/* =========== TEXT TEMPLATE CARDS =========== */
.text-template-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
}

.text-template-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
}

.text-template-card:hover {
    border-color: var(--accent);
    background: var(--bg-quaternary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.text-template-preview {
    padding: 14px 12px;
    background: rgba(0, 0, 0, 0.4);
    text-align: center;
    font-size: 14px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    border-bottom: 1px solid var(--border);
}

.text-template-info {
    padding: 8px 10px;
}

.text-template-name {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.text-template-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =========== TRANSITION CARDS =========== */
.transition-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px 12px;
}

.transition-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.transition-card:hover {
    border-color: var(--accent);
    background: var(--bg-quaternary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.transition-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.transition-label {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.transition-info-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

/* =========== STICKER GRID (in sidebar) =========== */
.sticker-grid-sidebar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px;
}

.sticker-item-sidebar {
    aspect-ratio: 1;
    padding: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-item-sidebar:hover {
    border-color: var(--accent);
    background: var(--bg-quaternary);
    transform: scale(1.06);
}

.sticker-item-sidebar svg {
    width: 100%;
    height: 100%;
}

/* =========== RECORD TAB =========== */
.record-section {
    display: flex;
    flex-direction: column;
}

.record-preview-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.record-timer {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 6px;
}

.record-timer::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* =========== ENHANCED TIMELINE TOOLBAR =========== */
.tl-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tl-tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 11px;
    transition: all 0.12s;
    white-space: nowrap;
}

.tl-tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tl-tool-btn.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}

.tl-tool-icon {
    font-size: 13px;
    line-height: 1;
}

.tl-tool-label {
    font-size: 10.5px;
    font-weight: 500;
}

.tl-speed-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tl-speed-label {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.tl-speed-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 11px;
    padding: 2px 4px;
    cursor: pointer;
}

/* Text track label */
.track-label.text-track {
    height: 38px;
    background: rgba(245, 158, 11, 0.05);
}

.track-label.text-track .track-name {
    color: var(--clip-text);
}
