:root {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --highlight: #ff0055;
    --header-height: 50px;
    --footer-height: 90px;
}

* { box-sizing: border-box; }
body, html { 
    margin: 0; padding: 0; 
    height: 100dvh; /* Korrektur für mobile Browser */
    width: 100vw; 
    overflow: hidden; 
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg-color); color: var(--text-color);
}

#app { 
    display: flex; 
    flex-direction: column; 
    height: 100dvh; /* Korrektur für mobile Browser */
}

/* Tabs */
nav.tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    border-bottom: 1px solid #333;
    padding: 0 10px;
}
.visible-tabs {
    display: flex;
    flex: 1;
    height: 100%;
}

.visible-tabs button {
    flex: 1;
    height: 100%;
    border: none;
    background: none;
    color: #888;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
}

.visible-tabs button.active {
    color: #fff;
    border-bottom: 3px solid var(--highlight);
}

#burger-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 15px;
}

/* Side Menu Styles */
.side-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Startet außerhalb des Bildschirms */
    width: 250px;
    height: 100%;
    background: #111;
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.side-menu.open {
    right: 0;
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
}

.side-menu-header h3 { margin: 0; }
.side-menu-header button { background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; }

.side-nav {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.side-nav button {
    text-align: left;
    padding: 15px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 5px;
}

.side-nav button:hover, .side-nav button.active {
    background: #222;
    color: white;
}

.logout-link {
    color: #e74c3c !important;
    margin-top: 10px;
}

main { flex: 1; position: relative; overflow: hidden; }
.tab-content { display: none; height: 100%; width: 100%; position: absolute; }
.tab-content.active { display: block; }

/* Teleprompter */
#tab-prompter { background: #000; }
#bg-video-preview { 
    position: absolute; width: 100%; height: 100%; object-fit: cover; z-index: 1;
}
#prompter-scroll-area {
    position: relative; z-index: 2; height: 100%; overflow-y: auto;
    padding: 45vh 15% 45vh 15%; text-align: center; font-size: 2.5rem; line-height: 1.6;
}
.word { display: inline-block; margin-right: 8px; transition: all 0.2s; cursor: pointer; opacity: 1.0; }
.word.active { color: var(--highlight); opacity: 1; transform: scale(1.1); font-weight: bold; }

/* Live Bild / Canvas */
#recorder-canvas { width: 100%; height: 100%; object-fit: contain; background: #000; }

/* Settings & Table */
.scroll-container { height: 100%; overflow-y: auto; padding: 20px; }
input, textarea, select { 
    width: 100%; padding: 10px; margin: 10px 0; background: #333; border: 1px solid #555; color: #fff; 
}
table { width: 100%; border-collapse: collapse; }
table td, table th { padding: 12px; border-bottom: 1px solid #333; text-align: left; }

/* Footer */
footer { 
    height: var(--footer-height); background: #000; 
    display: flex; align-items: center; justify-content: center; gap: 15px; 
}
button.ctrl { 
    padding: 10px 20px; border-radius: 20px; border: none; cursor: pointer; font-weight: bold; 
}
.btn-rec { background: #e74c3c; color: white; }
.btn-stop { background: #95a5a6; }
.btn-play { background: #2ecc71; }

.settings-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.settings-group {
    background: #252525;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #333;
}

.settings-group h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #ffffff;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.row {
    display: flex;
    gap: 10px;
}

.row label { flex: 1; font-size: 12px; }

/* Word Highlight Variable */
.word.active {
    color: var(--highlight) !important;
    opacity: 1;
}

/* Sicherstellen, dass der Textbereich das Video nicht komplett verdeckt */
#prompter-scroll-area {
    position: relative; 
    z-index: 2; 
    height: 100%; 
    overflow-y: auto;
    padding: 45vh 15% 45vh 15%; 
    text-align: center; 
    font-size: 2.5rem; 
    line-height: 1.6;
    /* WICHTIG: Hintergrund muss semi-transparent sein */
    background: rgba(0, 0, 0, 0.4); 
}

/* Audio Meter Styles */
.audio-meter-container {
    position: absolute;
    bottom: 100px;
    width: 12px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 10;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.audio-meter-container.left { left: 30px; }
.audio-meter-container.right { right: 30px; }

.meter-bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%; /* Wird via JS gesteuert */
    background: linear-gradient(to top, #2ecc71 60%, #f1c40f 80%, #e74c3c 100%);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
    transition: height 0.05s ease-out;
}

#scripts-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

#scripts-table span:hover {
    filter: brightness(1.5);
    transform: scale(1.2);
    display: inline-block;
}

#rec-timer {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    background: rgba(255, 0, 0, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.mirrored {
    transform: scaleX(-1);
}

/* Optional: Damit der Mirror-Button aktiv visualisiert wird */
button.active-mode {
    background-color: var(--highlight) !important;
}

@media (max-width: 600px) {
    :root {
        --footer-height: auto; /* Erlaubt dem Footer zu wachsen, falls Buttons umbrechen */
    }

    footer {
        padding: 10px;
        flex-wrap: wrap; /* Erlaubt Buttons in zwei Zeilen zu rutschen, falls es zu eng wird */
        gap: 10px;
        min-height: 80px;
    }

    button.ctrl {
        padding: 8px 15px; /* Etwas kleinere Buttons */
        font-size: 0.9rem;
    }

    #rec-timer {
        font-size: 1rem;
        min-width: 100px;
    }
    
   
}