/* === Video Mixer - Dark/Light DJ Theme === */

:root {
    --bg: #0d0d0d;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: #333;
    --accent-a: #00ccff;
    --accent-b: #ff4488;
    --accent-mix: #aa44ff;
    --text: #e0e0e0;
    --text-dim: #888;
    --green: #44dd66;
    --orange: #ff9900;
    --red: #ff3333;
    --vu-bg: rgba(0,0,0,0.5);
}

[data-theme="light"] {
    --bg: #e8e8ec;
    --surface: #f2f2f5;
    --surface2: #dcdce2;
    --border: #c0c0c8;
    --text: #1a1a2e;
    --text-dim: #666680;
    --vu-bg: rgba(255,255,255,0.5);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    overflow-x: hidden;
    user-select: none;
    transition: background 0.3s, color 0.3s;
}

/* Compact Toolbar */
#toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 34px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.logo {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(90deg, var(--accent-a), var(--accent-mix), var(--accent-b));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-tag {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-dim);
    -webkit-text-fill-color: var(--text-dim);
    background: none;
    margin-left: 4px;
    opacity: 0.7;
}

#toolbar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

#toolbar-controls select {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
}

#popout-btn, #shortcuts-btn, #fullscreen-btn, #save-session-btn, #load-session-btn, #theme-toggle-btn {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
#popout-btn:hover, #shortcuts-btn:hover, #fullscreen-btn:hover,
#save-session-btn:hover, #load-session-btn:hover, #theme-toggle-btn:hover {
    background: var(--accent-mix);
    color: #fff;
}

#shortcuts-btn, #fullscreen-btn {
    width: 26px;
    padding: 3px;
    text-align: center;
    font-weight: 700;
}

/* Output status indicator */
.output-connected {
    color: var(--green);
    font-size: 10px;
    font-weight: 700;
}
.output-disconnected {
    color: var(--text-dim);
    font-size: 10px;
}

/* Fullscreen decks layout */
body.fullscreen-decks {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Decks Row — fills all remaining space */
#decks-row {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
}

/* Deck Panel */
.deck {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: background 0.3s;
}

#deck-a { border-right: none; }
#deck-b { border-left: none; }

.deck-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

#deck-a .deck-label { color: var(--accent-a); font-weight: 700; letter-spacing: 2px; }
#deck-b .deck-label { color: var(--accent-b); font-weight: 700; letter-spacing: 2px; }

.deck-now-playing {
    color: var(--text-dim);
    font-size: 11px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: right;
    margin-right: 6px;
}

.deck-error {
    color: var(--orange);
    font-size: 14px;
    cursor: help;
    animation: blink 1s ease-in-out 3;
}
.deck-error.hidden { display: none; }

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

/* Deck Preview */
.deck-preview-wrap {
    position: relative;
    background: #000;
    height: 140px;
    flex-shrink: 0;
}

.deck-preview {
    width: 100%;
    height: 100%;
    display: block;
}

.deck video { display: none; }

/* Drag & Drop Overlay — covers full deck */
.deck { position: relative; }
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(170, 68, 255, 0.3);
    border: 3px dashed var(--accent-mix);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    z-index: 20;
    pointer-events: none;
    backdrop-filter: blur(4px);
}
.drop-overlay.hidden { display: none; }

#deck-a .drop-overlay {
    background: rgba(0, 204, 255, 0.2);
    border-color: var(--accent-a);
}
#deck-b .drop-overlay {
    background: rgba(255, 68, 136, 0.2);
    border-color: var(--accent-b);
}

/* VU Meter */
.vu-meter {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    height: 4px;
    z-index: 5;
}
.vu-bar {
    width: 100%;
    height: 100%;
    background: var(--vu-bg);
    border-radius: 2px;
    overflow: hidden;
}
.vu-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.08s linear;
}
#deck-a .vu-fill {
    background: linear-gradient(90deg, var(--accent-a), var(--green));
}
#deck-b .vu-fill {
    background: linear-gradient(90deg, var(--accent-b), var(--green));
}
.vu-fill.hot {
    background: linear-gradient(90deg, var(--orange), var(--red)) !important;
}

/* Transport Controls */
.deck-transport {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px;
    background: var(--surface2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

.transport-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    width: 36px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.transport-btn:hover {
    background: var(--surface2);
    border-color: var(--text-dim);
}

.transport-btn.active {
    background: var(--accent-mix);
    color: #fff;
    border-color: var(--accent-mix);
}

#deck-a .play-btn.active {
    background: var(--accent-a);
    border-color: var(--accent-a);
    color: #000;
}

#deck-b .play-btn.active {
    background: var(--accent-b);
    border-color: var(--accent-b);
    color: #fff;
}

/* Sliders */
.deck-sliders {
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.deck-sliders label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-dim);
}

.deck-sliders input[type="range"] { flex: 1; height: 4px; }

.speed-val, .slide-dur-val, .vol-val {
    min-width: 30px;
    text-align: right;
    font-size: 10px;
}

/* Progress bar */
.deck-progress-wrap {
    padding: 2px 10px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-slider { flex: 1; height: 6px; }

.time-display {
    font-size: 10px;
    color: var(--text-dim);
    min-width: 80px;
    text-align: right;
}

/* Image slideshow progress */
.time-display .slide-progress {
    display: inline-block;
    width: 40px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    vertical-align: middle;
    margin-left: 4px;
    overflow: hidden;
}
.time-display .slide-progress-fill {
    display: block;
    height: 100%;
    background: var(--accent-mix);
    border-radius: 2px;
    transition: width 0.25s linear;
}

/* Per-Deck FX */
.deck-fx {
    border-top: 1px solid var(--border);
    background: var(--surface2);
    transition: background 0.3s;
}

.deck-fx-toggle {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    cursor: pointer;
    text-align: left;
    letter-spacing: 1px;
}
.deck-fx-toggle:hover { color: var(--text); }

.deck-fx-controls {
    padding: 4px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.deck-fx-controls.hidden { display: none; }

.deck-fx-controls label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
.deck-fx-controls input[type="range"] { flex: 1; height: 4px; }

.deck-fx-reset {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 9px;
    margin-top: 2px;
}
.deck-fx-reset:hover { color: var(--text); border-color: var(--text-dim); }

/* File Browser */
.file-browser {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: 1px solid var(--border);
}

.browser-nav {
    display: flex;
    gap: 4px;
    padding: 4px 6px;
    background: var(--surface2);
    transition: background 0.3s;
}

.nav-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}
.nav-btn:hover { background: var(--border); }

.path-input {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 6px;
    border-radius: 3px;
    font-family: inherit;
    font-size: 11px;
    min-width: 0;
    transition: background 0.3s;
}

.browser-path {
    padding: 2px 8px;
    font-size: 10px;
    color: var(--text-dim);
    background: var(--bg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.3s;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    background: var(--bg);
    transition: background 0.3s;
}

.file-list li {
    padding: 4px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--surface);
    font-size: 11px;
    transition: background 0.1s;
}
.file-list li:hover { background: var(--surface2); }

.file-list li.active {
    background: var(--surface2);
    border-left: 3px solid var(--accent-mix);
}
#deck-a .file-list li.active { border-left-color: var(--accent-a); }
#deck-b .file-list li.active { border-left-color: var(--accent-b); }

/* Drag reorder styling */
.file-list li.dragging {
    opacity: 0.4;
}
.file-list li.drag-over {
    border-top: 2px solid var(--accent-mix);
}

.file-list .icon { font-size: 13px; width: 18px; text-align: center; }
.file-list .dir-icon { color: var(--orange); }
.file-list .vid-icon { color: var(--accent-a); }
.file-list .img-icon { color: var(--green); }

.browser-actions {
    padding: 4px 6px;
    background: var(--surface2);
    transition: background 0.3s;
}

.load-folder-btn {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    transition: all 0.15s;
}
#deck-a .load-folder-btn:hover { background: var(--accent-a); color: #000; border-color: var(--accent-a); }
#deck-b .load-folder-btn:hover { background: var(--accent-b); color: #fff; border-color: var(--accent-b); }

/* Center Panel / Crossfader */
#center-panel {
    width: 210px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px;
    gap: 10px;
    overflow-y: auto;
    transition: background 0.3s;
}

#crossfader-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cf-label { font-weight: 700; font-size: 14px; }
#crossfader-section .cf-label:first-child { color: var(--accent-a); }
#crossfader-section .cf-label:last-child { color: var(--accent-b); }
#crossfader { flex: 1; height: 8px; }

/* Mini mix preview */
#mini-preview-wrap { text-align: center; }
#mini-preview {
    width: 100%;
    height: 100px;
    background: #000;
    border-radius: 4px;
    display: block;
    border: 1px solid var(--border);
}
.mini-label {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-top: 2px;
    display: block;
}

/* Transition Picker */
#transition-picker {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    transition: background 0.3s;
}

.trans-category { border-bottom: 1px solid var(--border); }
.trans-category:last-child { border-bottom: none; }

.trans-cat-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 6px 2px;
    background: var(--surface2);
    transition: background 0.3s;
}

.trans-cat-items { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; }

.trans-btn {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid transparent;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 9px;
    transition: all 0.1s;
    white-space: nowrap;
}
.trans-btn:hover { color: var(--text); border-color: var(--border); }
.trans-btn.active { background: var(--accent-mix); color: #fff; border-color: var(--accent-mix); }

#transition-current { text-align: center; padding: 3px 0; }
#transition-current-name { font-size: 11px; font-weight: 700; color: var(--accent-mix); }

#auto-mix-section { margin-top: 8px; }

#auto-mix-btn {
    width: 100%;
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
    transition: opacity 0.15s;
}
#auto-mix-btn:hover { opacity: 0.85; }
#auto-mix-btn.mixing { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#auto-mix-section label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
#auto-mix-section input[type="range"] { flex: 1; height: 4px; }
#auto-mix-dur-val { min-width: 28px; text-align: right; }

/* BPM Section */
#bpm-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#bpm-display {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-mix);
    letter-spacing: 1px;
    padding: 4px 0;
}

#tap-tempo-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    transition: all 0.1s;
}
#tap-tempo-btn:hover { border-color: var(--accent-mix); color: var(--accent-mix); }
#tap-tempo-btn:active, #tap-tempo-btn.flash {
    background: var(--accent-mix);
    color: #fff;
    border-color: var(--accent-mix);
}

#beat-sync-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.2s;
}
#beat-sync-btn:hover { border-color: var(--green); color: var(--green); }
#beat-sync-btn.active {
    background: var(--green);
    color: #000;
    border-color: var(--green);
}

/* FX Section */
#fx-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-mix);
    letter-spacing: 2px;
    margin-bottom: 2px;
}

#fx-section label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
#fx-section input[type="range"] { flex: 1; height: 4px; }

#fx-reset {
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    margin-top: 4px;
    transition: color 0.15s;
}
#fx-reset:hover { color: var(--text); border-color: var(--text-dim); }

/* Slider Theming */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

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

#crossfader::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    border: 2px solid #fff;
}

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

.progress-slider { height: 6px !important; }
.progress-slider::-webkit-slider-thumb { width: 10px; height: 16px; border-radius: 2px; }

/* Shortcuts overlay */
#shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
#shortcuts-overlay.hidden { display: none; }

#shortcuts-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    max-width: 420px;
    transition: background 0.3s;
}
#shortcuts-box h3 { margin-bottom: 12px; color: var(--accent-mix); letter-spacing: 1px; }
#shortcuts-box table { width: 100%; margin-bottom: 12px; }
#shortcuts-box td { padding: 4px 8px; }
#shortcuts-box kbd {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 11px;
}
#close-shortcuts {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Autopilot section */
#autopilot-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#autopilot-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.2s;
}
#autopilot-btn:hover { border-color: var(--green); color: var(--green); }
#autopilot-btn.active {
    background: var(--green);
    color: #000;
    border-color: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

#autopilot-section label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
#autopilot-section input[type="range"] { flex: 1; height: 4px; }
#autopilot-hold-val, #autopilot-trans-val { min-width: 24px; text-align: right; font-size: 10px; }

/* Custom transitions section */
#custom-transitions-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#load-custom-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
}
#load-custom-btn:hover { color: var(--text); border-color: var(--text-dim); }

#custom-list { display: flex; flex-wrap: wrap; gap: 3px; }
.custom-tag {
    background: var(--surface2);
    color: var(--green);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
}
.no-custom { font-size: 9px; color: var(--text-dim); font-style: italic; }
