:root {
    --bg-color: #121212;
    --panel-color: #1e1e1e;
    --card-color: #2a2a2a;
    --text-color: #e0e0e0;
    --accent-color: #007bff;
    --danger-color: #dc3545;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

.left-sidebar, .right-sidebar {
    background-color: var(--panel-color);
    width: 100%;
    height: 240px;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #333;
    overflow: hidden;
}

.library {
    padding: 15px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.library-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar */
.library-items::-webkit-scrollbar, 
.active-stack-container::-webkit-scrollbar {
    width: 4px;
}
.library-items::-webkit-scrollbar-track, 
.active-stack-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}
.library-items::-webkit-scrollbar-thumb, 
.active-stack-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

.library h3, .active-stack-container h3 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
}

.library-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.lib-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
}

.lib-btn.download-btn {
    background: #28a745;
    grid-column: span 2;
    margin-bottom: 5px;
}

.lib-btn.music-btn {
    background: #6f42c1;
    grid-column: span 2;
    margin-bottom: 5px;
}

.active-stack-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.active-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Effect Card Styles */
.effect-card {
    background: var(--card-color);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #444;
}

.effect-header {
    padding: 8px 12px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.effect-title {
    font-weight: bold;
    font-size: 0.85rem;
}

.effect-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
}

.effect-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.effect-card.collapsed .effect-body {
    display: none;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-header label {
    font-size: 0.75rem;
    color: #bbb;
}

.control-header input[type="number"] {
    background: #444;
    border: 1px solid #555;
    color: white;
    width: 50px;
    font-size: 0.75rem;
    padding: 2px;
    border-radius: 3px;
    text-align: right;
}

.presets-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.presets-container label {
    font-size: 0.75rem;
    color: #bbb;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.preset-btn {
    background: #444;
    border: 1px solid #555;
    color: white;
    font-size: 0.65rem;
    padding: 3px 0;
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
}

.preset-btn:hover {
    background: #555;
    border-color: var(--accent-color);
}

input[type="range"] {
    width: 100%;
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #000;
    position: relative;
}

/* Timeline styles */
.video-timeline {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 8px;
    z-index: 1000;
    background: rgba(0,0,0,0.55);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 18px rgba(0,0,0,0.6);
}

.timeline-bar {
    position: relative;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
}

.timeline-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(255,180,0,0.95), rgba(255,80,60,0.95));
    border-radius: 6px;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
    pointer-events: none;
}

canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

@media (min-width: 768px) {
    #app {
        flex-direction: row;
    }
    .left-sidebar {
        width: 320px;
        height: 100%;
        border-bottom: none;
        border-right: 1px solid #333;
    }
    .right-sidebar {
        width: 320px;
        height: 100%;
        border-bottom: none;
        border-left: 1px solid #333;
        order: 2;
    }
    .canvas-container {
        flex: 1;
        order: 1;
    }
    .library-items {
        max-height: 40% ; /* Larger scrollable area on desktop */
    }
}