/* Video Editor Window */
.video-window {
    position: fixed;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--window-bg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 9000;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    contain: layout style paint;
}

.video-header {
    height: 50px;
    background: var(--window-header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.window-control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.window-control-btn.close {
    background: #ff5f56;
}

.window-control-btn.close:hover {
    background: #ff4136;
}

.video-header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.video-header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0070d6;
}

.btn-success {
    background: #27c93f;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #1fb535;
}

.btn-danger {
    background: #ff5f56;
    color: white;
}

.video-content {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr;
    overflow: hidden;
}

/* Clips Sidebar */
.clips-sidebar {
    background: rgba(30, 30, 30, 0.85);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.clip-count {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    color: var(--text-color);
}

.clips-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.clips-list::-webkit-scrollbar {
    width: 6px;
}

.clips-list::-webkit-scrollbar-track {
    background: transparent;
}

.clips-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.clip-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.clip-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.clip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.clip-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.clip-index {
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 8px;
}

.clip-actions {
    display: flex;
    gap: 4px;
}

.clip-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
}

.clip-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.clip-input-group {
    margin-bottom: 10px;
}

.clip-input-label {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
    display: block;
}

.clip-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 8px;
    color: white;
    font-size: 12px;
    outline: none;
}

.clip-input:focus {
    border-color: var(--accent-color);
}

.clip-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.transition-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 8px;
    color: white;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.transition-select:focus {
    border-color: var(--accent-color);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Preview Area */
.preview-area {
    display: flex;
    flex-direction: column;
    background: rgba(20, 20, 20, 0.9);
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

#preview-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.preview-controls {
    height: 80px;
    background: var(--window-header-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 30px;
    gap: 20px;
}

.play-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    transition: all 0.2s;
}

.control-btn.play {
    background: var(--accent-color);
}

.control-btn.play:hover {
    background: #0070d6;
    transform: scale(1.05);
}

.control-btn.loop {
    background: rgba(255, 255, 255, 0.1);
}

.control-btn.loop:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn.loop.active {
    background: var(--accent-color);
}

.time-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), #0070d6);
    border-radius: 6px;
    transition: width 0.1s linear;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-family: monospace;
    color: #888;
}

.time-current {
    color: var(--accent-color);
}

/* Loading */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 11000;
}

#loading-overlay.active {
    display: flex;
}

.loading-content {
    background: var(--window-bg);
    backdrop-filter: var(--glass-blur);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast */
#toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--window-header-bg);
    backdrop-filter: var(--glass-blur);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 12000;
}

#toast.show {
    opacity: 1;
}

/* Hidden video container */
#video-source-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -50;
    overflow: hidden;
}