/* RESET & BASIS */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #121212; color: #e0e0e0; line-height: 1.6;
    display: flex; justify-content: center; align-items: flex-start; 
    min-height: 100vh; padding: 40px 20px; overflow-x: hidden; 
}
.app-layout { 
    position: relative; width: 100%; max-width: 1000px; 
}

/* --- PRO-MODE STEUERUNG --- */

/* Standard: Erweiterte Elemente ausblenden */
.advanced-only { display: none !important; }

/* Wenn Advanced-Mode aktiv ist: Elemente einblenden */
body.mode-advanced .advanced-only { display: flex !important; }
body.mode-advanced .sidebar-left, 
body.mode-advanced .sidebar-right { display: flex !important; }

/* --- SIDEBARS --- */
.sidebar-left, .sidebar-right {
    position: absolute; top: 0; bottom: 0; width: 220px; 
    background-color: #1e1e1e; border-radius: 12px; padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); border: 1px solid #333;
    overflow-y: auto; flex-direction: column;
}
.sidebar-left { right: 100%; margin-right: 60px; } 
.sidebar-right { left: 100%; margin-left: 60px; }
.sidebar-right .sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid #333; }
.sidebar-left::-webkit-scrollbar, .sidebar-right::-webkit-scrollbar { width: 8px; }
.sidebar-left::-webkit-scrollbar-track, .sidebar-right::-webkit-scrollbar-track { background: #1e1e1e; border-radius: 4px; }
.sidebar-left::-webkit-scrollbar-thumb, .sidebar-right::-webkit-scrollbar-thumb { background-color: #333; border-radius: 4px; border: 2px solid #1e1e1e; }
.sidebar-left, .sidebar-right { scrollbar-width: thin; scrollbar-color: #333 #1e1e1e; }

h3 { font-size: 1rem; color: #888; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #333; padding-bottom: 10px; margin-top: 0; }
.sidebar-header { border-bottom: 1px solid #333; padding-bottom: 15px; margin-bottom: 15px; }
.sidebar-header h3 { border-bottom: none; margin-bottom: 5px; padding-bottom: 0; }
.sidebar-meta { font-size: 0.85rem; color: #888; }
#total-duration { color: #e0e0e0; font-weight: bold; font-family: monospace; margin-left: 5px; }

/* LISTEN CONTAINER */
.history-list, .clip-list { display: flex; flex-direction: column; gap: 15px; flex: 1; }
.empty-state { font-size: 0.85rem; color: #555; font-style: italic; text-align: center; padding: 20px 0; }

/* ITEMS (HISTORY & CLIPS) */
.history-item { background-color: #2c2c2c; border-radius: 8px; overflow: hidden; cursor: pointer; transition: transform 0.2s, border-color 0.2s; border: 1px solid transparent; }
.history-item:hover { transform: translateY(-2px); border-color: #555; }
.history-item.active { border-color: #3d5afe; box-shadow: 0 0 8px rgba(61, 90, 254, 0.4); }
.history-thumb { width: 100%; height: 100px; object-fit: cover; background-color: #000; display: block; }
.history-info { padding: 10px; }
.history-name { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ddd; font-weight: 500; }
.history-time { font-size: 0.7rem; color: #777; margin-top: 4px; }
.history-add-item { background-color: transparent; border: 2px dashed #444; border-radius: 8px; height: 80px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; color: #666; margin-top: 5px; }
.history-add-item:hover { border-color: #666; color: #fff; background-color: rgba(255,255,255, 0.05); }
.history-add-item span { font-size: 2rem; font-weight: bold; line-height: 1; }

.clip-item { background-color: #2c2c2c; border-radius: 8px; overflow: hidden; position: relative; border: 1px solid #444; transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.clip-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.5); border-color: #666; }
.clip-item[draggable="true"] { cursor: grab; }
.clip-item:active { cursor: grabbing; }
.clip-item.dragging { opacity: 0.4; background: #222; border: 1px dashed #555; }
.clip-thumb { width: 100%; height: 80px; object-fit: cover; background-color: #000; display: block; }
.clip-info { padding: 8px 10px; background: #333; }
.clip-range { font-family: monospace; font-size: 0.85rem; color: #fff; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
.clip-duration { font-size: 0.7rem; color: #888; font-weight: normal; }
.clip-delete { position: absolute; top: 5px; right: 5px; background-color: rgba(0, 0, 0, 0.6); color: white; border: none; width: 24px; height: 24px; border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s, background 0.2s; }
.clip-item:hover .clip-delete { opacity: 1; }
.clip-delete:hover { background-color: #f44336; }
@media (max-width: 1600px) { .sidebar-left, .sidebar-right { display: none !important; } }

/* MAIN CONTAINER */
.container { background-color: #1e1e1e; padding: 30px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); width: 100%; text-align: center; position: relative; z-index: 10; }
.video-placeholder { width: 100%; height: 400px; background-color: #252525; border: 3px dashed #444; border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; margin-bottom: 20px; }
.video-placeholder:hover { background-color: #2a2a2a; border-color: #666; transform: scale(1.01); }
.video-placeholder.drag-over { background-color: #2979ff; border-color: #fff; border-style: solid; box-shadow: 0 0 20px rgba(41, 121, 255, 0.4); }

.header-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; padding-bottom: 20px; margin-bottom: 25px; }
h1 { font-size: 1.5rem; color: #fff; margin: 0; padding: 0; text-align: left; }
.header-right { display: flex; align-items: center; gap: 20px; }
.view-controls { display: flex; gap: 10px; align-items: center; }

/* TOGGLE BTNS */
.toggle-btn { background-color: transparent; border: 1px solid #666; color: #888; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 1.2rem; transition: all 0.2s; line-height: 1; filter: grayscale(100%) opacity(0.7); display: flex; align-items: center; justify-content: center; }
.toggle-btn:hover { background-color: rgba(255, 255, 255, 0.1); border-color: #888; color: #fff; filter: grayscale(0%) opacity(1); }
.toggle-btn.active { background-color: #3d5afe; border-color: #3d5afe; color: white; filter: grayscale(0%) opacity(1); }

#btn-mode-toggle { display: none; }

/* STATUS DOT (Auto-AI) */
.status-dot {
    position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%;
    background-color: transparent; transition: background-color 0.3s;
}
.status-dot.working { background-color: #2979ff; box-shadow: 0 0 8px #2979ff; animation: pulse 1s infinite; }
.status-dot.ready { background-color: #00e676; box-shadow: 0 0 5px #00e676; }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

#uploader { display: none; }
.custom-file-upload { display: inline-block; padding: 10px 20px; cursor: pointer; background-color: #3d5afe; color: white; border-radius: 6px; transition: background 0.3s, transform 0.2s; font-weight: 600; font-size: 0.9rem; border: 2px solid transparent; }
.custom-file-upload:hover { background-color: #536dfe; transform: translateY(-2px); }

#video-preview { width: 100%; max-height: 500px; border-radius: 8px; background: #000; margin-bottom: 20px; border: 1px solid #333; }
.video-toolbar { display: flex; justify-content: center; gap: 10px; margin-bottom: 25px; background: #252525; padding: 10px; border-radius: 8px; border: 1px solid #333; }
.tool-btn { background-color: #444; border: 1px solid #555; color: #ddd; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; min-width: 80px; font-family: monospace; }
.tool-btn:hover { background-color: #555; border-color: #777; color: #fff; transform: translateY(-1px); }
.tool-btn:active { transform: translateY(1px); }
.speed-btn { background-color: #2e7d32; border-color: #388e3c; color: white; font-weight: bold; }
.speed-btn:hover { background-color: #388e3c; }

/* SLIDER */
.range-slider-container { position: relative; width: 100%; height: 60px; margin-bottom: 30px; background: #2c2c2c; border-radius: 8px; padding: 0; display: flex; align-items: center; }
.slider-thumbnails { position: absolute; top: 0; left: 10px; width: calc(100% - 20px); height: 100%; display: flex; justify-content: space-between; z-index: 0; overflow: hidden; border-radius: 8px; opacity: 0.5; pointer-events: none; }
.slider-thumbnails img { height: 100%; flex: 1; object-fit: cover; display: block; min-width: 0; }
.slider-mask { position: absolute; top: 0; height: 100%; background-color: rgba(0, 0, 0, 0.6); z-index: 3; pointer-events: none; }
#mask-left { left: 0; border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
#mask-right { right: 0; border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.slider-track { position: absolute; height: 6px; background: rgba(68, 68, 68, 0.5); border-radius: 3px; left: 10px; width: calc(100% - 20px); z-index: 2; }
.slider-waveform { position: absolute; top: 0; left: 10px; width: calc(100% - 20px); height: 100%; z-index: 1; pointer-events: none; opacity: 0.9; filter: drop-shadow(0px 1px 1px rgba(0,0,0,0.8)); }
.slider-highlight { position: absolute; height: 6px; background-color: rgba(61, 90, 254, 0.5); border-radius: 3px; z-index: 3; pointer-events: none; overflow: hidden; }
.slider-progress-overlay { position: absolute; left: 0; top: 0; height: 100%; width: 0%; background-color: rgba(255, 255, 255, 0.9); box-shadow: 0 0 10px rgba(255,255,255, 0.5); transition: width 0.2s linear; }
.range-slider-container input[type="range"] { position: absolute; width: 100%; pointer-events: none; -webkit-appearance: none; appearance: none; background: none; z-index: 4; outline: none; margin: 0; }
.range-slider-container input[type="range"]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #3d5afe; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 5px rgba(0,0,0,0.5); transition: transform 0.1s; }
.range-slider-container input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
#range-start { z-index: 5; }
#range-end { z-index: 4; }

.time-inputs { display: flex; gap: 15px; justify-content: center; margin-bottom: 25px; }
.input-group { display: flex; flex-direction: column; align-items: flex-start; flex: 1; }
.input-group label { font-size: 0.85rem; color: #888; margin-bottom: 5px; }
.input-with-button { display: flex; width: 100%; gap: 5px; }
.input-with-button input { flex: 1; background-color: #2c2c2c; border: 1px solid #444; color: white; padding: 10px; border-radius: 6px; text-align: center; font-family: monospace; font-size: 1rem; }
.input-with-button button { background-color: #444; border: none; color: white; padding: 0 12px; border-radius: 6px; cursor: pointer; transition: background 0.2s; }
.input-with-button button:hover { background-color: #555; }

/* ACTION BUTTONS */
.action-group { display: flex; gap: 15px; width: 100%; flex-wrap: wrap; }
.action-btn { padding: 15px; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: background 0.3s, opacity 0.3s, transform 0.1s; color: white; }
.action-btn:active { transform: translateY(2px); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; background-color: #555 !important; }

#trim-btn { background-color: #f44336; flex: 3; }
#trim-btn:hover:not(:disabled) { background-color: #ff5252; }
#add-clip-btn { background-color: #3d5afe; display: none; }
#add-clip-btn:hover:not(:disabled) { background-color: #536dfe; }
#export-mp3-btn { background-color: #ff9800; flex: 1; }
#export-mp3-btn:hover:not(:disabled) { background-color: #ffb74d; }

body.mode-advanced #trim-btn { flex: 2; }       
body.mode-advanced #add-clip-btn { flex: 1; display: block; } 
body.mode-advanced #export-mp3-btn { flex: 1; } 

/* MAGIC BTN (OLLAMA) */
.magic-btn { background-color: #7c4dff !important; color: white !important; }
.magic-btn:hover:not(:disabled) { background-color: #9069ff !important; box-shadow: 0 0 15px rgba(124, 77, 255, 0.4); }

/* TRANSCRIPT MODAL */
.transcript-modal-content {
    background-color: #1a1a1a; padding: 0 !important; overflow: hidden; display: flex; flex-direction: column;
    width: 80% !important; max-width: 900px !important; height: 80vh;
}
.transcript-tabs { display: flex; background-color: #222; border-bottom: 1px solid #444; padding: 0 20px; margin-top: 10px; }
.tab-btn { flex: 1; background: none; border: none; padding: 15px; color: #888; cursor: pointer; font-weight: bold; font-size: 0.95rem; border-bottom: 3px solid transparent; transition: all 0.2s; }
.tab-btn:hover { color: #ddd; background-color: #2c2c2c; }
.tab-btn.active { color: #7c4dff; border-bottom: 3px solid #7c4dff; background-color: #252525; }
.transcript-content { padding: 25px; font-family: 'Courier New', Courier, monospace; font-size: 1rem; line-height: 1.6; color: #ddd; flex: 1; overflow-y: auto; white-space: pre-wrap; outline: none; text-align: left; background: #151515; }
.transcript-actions { display: flex; gap: 10px; padding: 20px; border-top: 1px solid #333; background: #222; margin-top: auto; }
.transcript-loader { display: flex; align-items: center; justify-content: center; gap: 15px; padding: 50px; color: #7c4dff; font-weight: bold; flex: 1; }
.spinner { border: 4px solid rgba(124, 77, 255, 0.1); width: 30px; height: 30px; border-radius: 50%; border-left-color: #7c4dff; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.copy-btn { background-color: #333; color: white; border: none; padding: 10px; cursor: pointer; font-size: 0.9rem; transition: background 0.2s; border-radius: 6px; }
.copy-btn:hover { background-color: #444; }

/* MODALS */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-content { background-color: #1e1e1e; padding: 30px; border: 1px solid #333; width: 90%; max-width: 800px; border-radius: 12px; text-align: center; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.close-modal { position: absolute; right: 20px; top: 15px; font-size: 30px; cursor: pointer; color: #888; z-index: 10; }
.close-modal:hover { color: white; }

/* PROGRESS & TOAST */
.progress-container { display: none; position: relative; width: 100%; height: 10px; background-color: #333; border-radius: 5px; margin-top: 15px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background-color: #3d5afe; border-radius: 5px; transition: width 0.3s ease; }
#debug-console { margin-top: 25px; background-color: #000; color: #69f0ae; font-family: 'Courier New', Courier, monospace; font-size: 0.85rem; padding: 15px; border-radius: 8px; text-align: left; max-height: 150px; overflow-y: auto; border: 1px solid #333; white-space: pre-wrap; opacity: 0.8; }
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 250px; padding: 15px 20px; border-radius: 8px; color: white; font-size: 0.95rem; box-shadow: 0 4px 12px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: space-between; animation: slideIn 0.3s ease-out forwards; opacity: 0; cursor: pointer; border-left: 5px solid rgba(0,0,0,0.2); }
.toast.hide { animation: fadeOut 0.3s ease-in forwards; }
.toast-success { background-color: #2e7d32; }
.toast-error    { background-color: #d32f2f; }
.toast-warning { background-color: #ff9800; color: white; }
.toast-info    { background-color: #2979ff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* --- SPEZIFISCHE FIXES --- */
#render-btn { 
    background-color: #2e7d32 !important; 
    color: white !important;
}
#render-btn:hover:not(:disabled) { 
    background-color: #388e3c !important; 
}
#render-btn:disabled { 
    background-color: #444 !important; 
    opacity: 0.5;
}