:root {
    --bg: #0f1115; --sidebar: #16191f; --card: #1c2027;
    --accent: #6366f1; --text: #f8fafc; --text-dim: #94a3b8;
    --glass: rgba(22, 25, 31, 0.7);
    --header-h: 70px;
    --player-h: 100px;
}

[data-theme='light'] {
    --bg: #f1f5f9; --sidebar: #ffffff; --card: #ffffff;
    --text: #0f172a; --text-dim: #64748b;
    --glass: rgba(255, 255, 255, 0.8);
}

* { box-sizing: border-box; }
/* Transition nur auf Farben/Hintergrund, um Layout-Ruckeln beim Resizing zu vermeiden */
body { 
    margin: 0; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    overflow: hidden; 
    transition: background 0.3s ease, color 0.3s ease;
}

/* --- Layout-Struktur --- */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 1fr var(--player-h);
    height: 100vh;
    width: 100vw;
}

/* --- Sidebar & Navigation --- */
.sidebar { 
    background: var(--sidebar); 
    padding: 2rem; 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid rgba(255,255,255,0.05); 
    z-index: 1000;
}

.brand { 
    font-size: 1.2rem; 
    font-weight: 800; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 3rem; 
}

.logo-icon { width: 30px; height: 30px; background: var(--accent); border-radius: 8px; flex-shrink: 0; }

.nav-item { 
    display: block; 
    padding: 12px 15px; 
    color: var(--text-dim); 
    text-decoration: none; 
    border-radius: 12px; 
    margin-bottom: 5px; 
    font-weight: 600; 
    transition: 0.2s ease;
}

.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active { background: var(--accent); color: white; }

/* --- Hauptinhalt & Header --- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.top-bar { 
    height: var(--header-h); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 2rem; 
    flex-shrink: 0;
}

.content-scroll { 
    flex: 1; 
    padding: 1rem 2rem; 
    overflow-y: auto; 
    background: var(--bg);
}

/* --- Status Hub (Live Info) --- */
.status-hub { display: flex; gap: 0.8rem; align-items: center; }
.live-indicator { 
    background: rgba(0,0,0,0.15); 
    padding: 6px 15px; 
    border-radius: 30px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    border: 1px solid rgba(255,255,255,0.05); 
}
.pulse { width: 8px; height: 8px; background: #ef4444; border-radius: 50%; animation: blink 1.5s infinite; }
.live-details small { display: block; font-size: 0.6rem; color: #ef4444; font-weight: 800; line-height: 1; text-transform: uppercase; }
.live-details { font-size: 0.85rem; font-weight: 600; }
.listener-pill { background: var(--accent); color: white; padding: 6px 15px; border-radius: 30px; font-size: 0.85rem; font-weight: 700; }

/* --- PLAYER HUB --- */
.player-hub { 
    grid-column: 1 / -1; 
    background: var(--sidebar); 
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 2rem; 
    z-index: 1001;
}

.current-track { display: flex; align-items: center; gap: 15px; width: 30%; min-width: 200px; }
.album-art { width: 50px; height: 50px; background: var(--card); border-radius: 10px; flex-shrink: 0; object-fit: cover; }
.track-meta .title { display: block; font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-meta .artist { font-size: 0.75rem; color: var(--text-dim); }

.player-controls { display: flex; align-items: center; gap: 20px; flex: 1; justify-content: center; }
.play-trigger { 
    width: 45px; height: 45px; border-radius: 50%; background: var(--accent); 
    border: none; color: white; cursor: pointer; font-size: 1rem; 
    display: flex; align-items: center; justify-content: center;
}

/* --- VISUALIZER (Balken-EQ) --- */
.visual-eq { display: flex; align-items: flex-end; gap: 4px; height: 30px; }
.eq-bar { width: 6px; background: var(--accent); border-radius: 2px; height: 4px; transition: height 0.1s ease; }
.eq-bar.bass { background: #ff4757; } 
.eq-bar.mid  { background: #2ed573; } 
.eq-bar.high { background: #1e90ff; }

.volume-zone { display: flex; align-items: center; gap: 10px; width: 30%; justify-content: flex-end; }
.slider { cursor: pointer; accent-color: var(--accent); width: 100px; }

/* --- Animationen --- */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* --- RESPONSIVE BREAKPOINT --- */
.mobile-only { display: none; }

/* --- MOBILE FIX (iPhone & Co) --- */
@media (max-width: 768px) {
    .app-layout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
    }

    /* Sidebar als Overlay - absolut wichtig! */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -100%; /* Versteckt */
        width: 80% !important;
        height: 100% !important;
        background: #16191f !important; /* Deine Variablenfarbe */
        z-index: 9999 !important;
        transition: left 0.3s ease;
        padding: 20px !important;
        border-right: 1px solid rgba(255,255,255,0.1);
    }

    /* Wenn aktiv, dann reinschieben */
    .sidebar.active {
        left: 0 !important;
    }

    /* Header fixieren */
    .top-bar {
        height: 60px !important;
        width: 100%;
        display: flex !important;
        align-items: center;
        padding: 0 15px !important;
        background: var(--bg);
        flex-shrink: 0;
    }

    /* Content muss den Rest füllen und scrollbar sein */
    .main-wrapper {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .content-scroll {
        flex: 1 !important;
        overflow-y: auto !important;
        height: auto !important;
        padding: 20px !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Player-Leiste unten fixieren */
    .player-hub {
        height: 90px !important;
        width: 100%;
        background: var(--sidebar) !important;
        flex-shrink: 0;
        padding: 0 15px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* Elemente im Player für Mobile schrumpfen */
    .current-track { width: auto !important; flex: 1; }
    .volume-zone, .visual-eq, .visualizer { display: none !important; }
    .play-trigger { transform: scale(0.9); }

    .mobile-only {
        display: flex !important; /* oder block */
        align-items: center;
        justify-content: center;
        background: var(--sidebar);
        border: 1px solid rgba(255,255,255,0.1);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        font-size: 1.2rem;
    }

    /* Der Button bekommt eine Ebene, die "unten" bleibt */
    #menu-toggle {
        display: flex !important;
        position: relative;
        z-index: 100; /* Viel niedriger als die Sidebar */
    }

    /* Die Sidebar bekommt die Chef-Ebene */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -100%; /* Versteckt */
        width: 280px;
        height: 100vh;
        background: #16191f; /* Sicherstellen, dass sie nicht transparent ist */
        
        /* WICHTIG: Höher als 100! */
        z-index: 9999 !important; 
        
        transition: left 0.3s ease-in-out;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }

    /* Wenn das Menü offen ist, überdeckt es jetzt den Button bei 100 */
    .sidebar.active {
        left: 0 !important;
    }

    /* Der Titel in der Top-Bar (damit er nicht unter den Button rutscht) */
    .breadcrumb {
        margin-left: 10px;
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.artist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.license-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.license-badge hide { display: none; }

.license-badge a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

/* Die Lizenz etwas hervorheben */
.license-badge .cc-link {
    font-weight: bold;
    color: #8888ff; /* Ein dezentes Blau/Lila */
}

.license-badge a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

/* Trennstrich Styling */
.license-badge {
    color: rgba(255, 255, 255, 0.4);
}

/* Mobil-Anpassung: Wenn der Platz zu eng wird */
@media (max-width: 480px) {
    #album-art { display: none; } /* Cover ausblenden für mehr Textplatz */
    .license-badge { font-size: 0.6rem; }
}

/* Der Lade-Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Verstecken per Standard */
.hidden {
    display: none !important;
}

.badge-live {
    background-color: #ff0000;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.7rem;
    letter-spacing: 1px;
    animation: pulse-red 2s infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

.hidden { display: none; }