:root {
    --bg-color: #121212; --panel-bg: #1e1e1e; --text-color: #e0e0e0;
    --border-color: #333; --accent-color: #007bff; --accent-hover: #0056b3;
    --danger-color: #dc3545; --warning-color: #ffc107; --timeline-bg: #0a0a0a;
    --gap-color: #222; --playing-color: #28a745;
}

html[data-theme="dark"] { background-color: var(--bg-color); color: var(--text-color); font-family: system-ui, sans-serif; }
body { margin: 0; padding: 20px; box-sizing: border-box; }

button { background-color: #444; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: 0.2s; }
button:hover { background-color: #555; }
button.primary-btn { background-color: var(--accent-color); font-weight: bold; }
button.danger-btn { background-color: var(--danger-color); }
button.warning-btn { background-color: #d39e00; color: #fff; }
button.export-btn { width: 100%; margin-bottom: 10px; padding: 12px; font-weight: bold; background-color: var(--accent-color); }
button.is-playing { background-color: var(--playing-color); box-shadow: inset 0 0 10px rgba(0,0,0,0.5); font-weight: bold; }

.app-container { display: grid; grid-template-columns: 3fr 1fr; grid-template-rows: auto 300px; gap: 20px; height: calc(100vh - 40px); }
section { background-color: var(--panel-bg); border: 1px solid var(--border-color); padding: 15px; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }

.monitor-container { display: flex; gap: 20px; flex: 1; min-height: 200px; }
.resource-list { width: 250px; border-right: 1px solid var(--border-color); padding-right: 10px; list-style: none; margin: 0; padding-left: 0; overflow-y: auto; }
.resource-list li { padding: 10px; background: #2a2a2a; margin-bottom: 5px; cursor: pointer; border-radius: 4px; font-size: 14px; word-break: break-all; border-left: 6px solid #444; }
.resource-list li:hover { background: #3a3a3a; }
.resource-list li.active { background: #333; font-weight: bold; }

.source-player { flex: 1; display: flex; flex-direction: column; }
.waveform-wrapper { position: relative; flex: 1; margin-bottom: 10px; background: #000; border-radius: 4px; overflow: hidden; }
.waveform-container { width: 100%; height: 100%; }

/* Laddningsindikator */
.loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 10; display: flex; justify-content: center; align-items: center; color: white; font-weight: bold; }
.in-out-region { position: absolute; top: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.25); border-left: 2px solid white; border-right: 2px solid white; z-index: 5; pointer-events: none; display: none; }

.controls { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.in-out-display { font-family: monospace; font-size: 14px; margin-right: 10px; }
.time-display { font-family: monospace; font-size: 16px; background: #000; padding: 5px 10px; border-radius: 4px; color: #a1c4fd; }

.timeline-section { grid-column: 1 / -1; }
.timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.timeline-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zoom-control { display: flex; align-items: center; gap: 5px; font-size: 14px; margin-left: 10px; margin-right: 10px; }

.timeline-track { flex: 1; background-color: var(--timeline-bg); border: 1px solid #444; overflow-x: auto; overflow-y: hidden; position: relative; display: flex; flex-direction: column; }
.timeline-ruler { height: 20px; background: #1a1a1a; border-bottom: 1px solid #333; cursor: pointer; min-width: 100%; }
.timeline-content { display: flex; position: relative; flex: 1; min-width: 100%; align-items: center; padding: 5px 0; box-sizing: border-box; }

.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background-color: red; z-index: 20; left: 0px; pointer-events: none; }

/* Klipp med fixerad canvas (Premiere Pro style) */
.clip { height: 90%; margin-right: 2px; border-radius: 4px; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; border: 2px solid transparent; position: relative; cursor: grab; background-color: #444; }
.clip:active { cursor: grabbing; }
.clip-waveform-container { position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow: hidden; pointer-events: none; }
.clip canvas { position: absolute; top: 0; bottom: 0; height: 100%; opacity: 0.8; pointer-events: none; }
.clip .clip-label { position: absolute; top: 2px; left: 8px; font-size: 11px; color: white; white-space: nowrap; text-shadow: 1px 1px 2px black; pointer-events: none; z-index: 2; }

/* Trimming Handles */
.trim-handle { position: absolute; top: 0; bottom: 0; width: 8px; background: rgba(255,255,255,0.2); z-index: 10; cursor: ew-resize; }
.trim-handle:hover { background: rgba(255,255,255,0.6); }
.trim-handle.left { left: 0; border-right: 1px solid rgba(0,0,0,0.5); }
.trim-handle.right { right: 0; border-left: 1px solid rgba(0,0,0,0.5); }

.clip.selected { border-color: white; box-shadow: 0 0 10px rgba(255,255,255,0.5); z-index: 5; }
.clip.gap { background-color: var(--gap-color); border: 1px dashed #555; color: #888; justify-content: center; align-items: center; font-size: 12px; }
.clip.gap.selected { border: 1px solid white; }
.clip.drag-over { border: 2px dashed #ffc107; opacity: 0.7; }

/* Nya stilar för EDL export och Timeline label */
.timeline-duration-label {
    font-size: 14px;
    font-weight: normal;
    color: #888;
    margin-left: 10px;
}

.edl-ui-container {
    background: #111;
    border: 1px solid #444;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 13px;
    overflow-y: auto;
    max-height: 400px;
}

.edl-ui-container h3 { margin: 0 0 10px 0; font-size: 14px; color: var(--accent-color); }
.edl-ui-container h4 { margin: 15px 0 5px 0; font-size: 13px; color: #ccc; }

.edl-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.edl-field label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #aaa; }
.edl-field input { flex: 1; background: #222; color: #fff; border: 1px solid #555; padding: 4px; border-radius: 3px; }

#confirmEdlBtn { width: 100%; margin-top: 10px; padding: 10px; }
#cancelEdlBtn { width: 100%; margin-top: 5px; background: #333; }