:root {
    --bg-main: #121212;
    --bg-sidebar: #000000;
    --bg-player: #181818;
    --text-main: #FFFFFF;
    --text-muted: #B3B3B3;
    --spotify-green: #1DB954;
    --spotify-green-hover: #1ed760;
    --sidebar-width: 240px;
    --player-height: 90px;
    --top-bar-height: 64px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Outfit', sans-serif; background-color: var(--bg-main); color: var(--text-main); overflow: hidden; }
#app { display: grid; grid-template-areas: "sidebar main" "player player"; grid-template-columns: var(--sidebar-width) 1fr; grid-template-rows: 100vh 0px; height: 100vh; transition: grid-template-rows 0.3s ease; }
body.player-active #app { grid-template-rows: calc(100vh - var(--player-height)) var(--player-height); }
#sidebar { grid-area: sidebar; background-color: var(--bg-sidebar); padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.logo { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.logo i { color: var(--spotify-green); }
#sidebar nav { display: flex; flex-direction: column; gap: 16px; }
.nav-link { color: var(--text-muted); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 16px; transition: color 0.3s; }
.nav-link:hover, .nav-link.active { color: var(--text-main); }
.nav-link i { font-size: 20px; }
#sidebar hr { border: none; border-top: 1px solid #282828; }
.playlists h3 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
#main-content { grid-area: main; background: linear-gradient(to bottom, #2c2c2c, var(--bg-main)); overflow-y: auto; position: relative; }
#top-bar { height: var(--top-bar-height); background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: space-between; align-items: center; padding: 0 32px; position: sticky; top: 0; z-index: 100; }
.navigation-controls button { background: rgba(0, 0, 0, 0.7); border: none; color: white; width: 32px; height: 32px; border-radius: 50%; margin-right: 16px; cursor: pointer; }
#admin-btn { background: white; color: black; border: none; padding: 8px 16px; border-radius: 20px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: 14px; transition: transform 0.1s; display: inline-block; }
#admin-btn:hover { transform: scale(1.05); }
#page-content { padding: 32px; }
.albums-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 24px; }
.album-card { background: #181818; padding: 16px; border-radius: 8px; cursor: pointer; transition: background 0.3s; position: relative; }
.album-card:hover { background: #282828; }
.album-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; margin-bottom: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.album-card h4 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.album-card p { color: var(--text-muted); font-size: 14px; }
.play-badge { position: absolute; right: 24px; bottom: 80px; width: 48px; height: 48px; background: var(--spotify-green); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 16px rgba(0,0,0,0.3); opacity: 0; transform: translateY(10px); transition: all 0.3s; }
.album-card:hover .play-badge { opacity: 1; transform: translateY(0); }
    #player-bar { 
        grid-area: player; 
        background-color: var(--bg-player); 
        border-top: 1px solid #282828; 
        display: none; 
        justify-content: space-between; 
        align-items: center; 
        padding: 0 16px; 
    }
    body.player-active #player-bar { display: flex; }
.now-playing { display: flex; align-items: center; gap: 16px; width: 30%; }
.now-playing img { width: 56px; height: 56px; border-radius: 4px; }
.track-info { display: flex; flex-direction: column; overflow: hidden; }
#current-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#current-artist { font-size: 12px; color: var(--text-muted); }
.player-controls { width: 40%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.buttons { display: flex; align-items: center; gap: 24px; }
.buttons button { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; transition: color 0.1s; }
.buttons button:hover { color: var(--text-main); }
#play-pause-btn { font-size: 36px; color: var(--text-main); }
.progress-bar-container { width: 100%; display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--text-muted); }
.progress-bar { flex-grow: 1; height: 4px; background: #4f4f4f; border-radius: 2px; position: relative; cursor: pointer; }
#progress-fill { height: 100%; background: var(--text-main); border-radius: 2px; width: 0%; transition: width 0.1s linear; }
.progress-bar:hover #progress-fill { background: var(--spotify-green); }
.volume-controls { width: 30%; display: flex; justify-content: flex-end; align-items: center; gap: 12px; color: var(--text-muted); }
.volume-bar { width: 100px; height: 4px; background: #4f4f4f; border-radius: 2px; position: relative; cursor: pointer; }
#volume-fill { height: 100%; background: var(--text-main); border-radius: 2px; }
.fade-in { animation: fadeIn 0.5s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #4f4f4f; }
::-webkit-scrollbar-thumb:hover { background: #777; }

/* Album Play Button */
.play-album-btn {
    width: 56px;
    height: 56px;
    background-color: var(--spotify-green);
    border-radius: 50%;
    border: none;
    color: #000;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    transition: transform 0.2s, background-color 0.2s;
    margin-right: 24px;
}
.play-album-btn:hover {
    transform: scale(1.05);
    background-color: var(--spotify-green-hover);
}

/* Queue Panel */
#queue-panel {
    position: fixed;
    right: 32px;
    bottom: calc(var(--player-height) + 16px);
    width: 350px;
    max-height: 500px;
    background-color: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border: 1px solid #333;
    /* Transi\u00E7\u00E3o suave */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#queue-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.queue-header {
    padding: 16px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.queue-header h3 { font-size: 16px; margin: 0; }
.queue-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.queue-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.queue-item:hover { background: rgba(255,255,255,0.1); }
.queue-item.active { color: var(--spotify-green); }
.queue-item .track-index { width: 20px; font-size: 14px; color: var(--text-muted); }
.queue-item.active .track-index { color: var(--spotify-green); }
.queue-item .track-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.close-queue { background: none; border: none; color: #b3b3b3; cursor: pointer; font-size: 18px; }
.close-queue:hover { color: #fff; }

.sidebar-album {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.sidebar-album:hover {
    background-color: #282828;
}

.sidebar-album img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-info {
    overflow: hidden;
    line-height: 1.4;
}

.sidebar-info .album-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-info .album-meta {
    font-size: 12px;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Styles */
@media (max-width: 768px) {
    #app {
        grid-template-areas: "main";
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: 100vh;
    }

    #sidebar {
        display: none;
    }

    #bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 64px;
        background-color: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        display: flex !important;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid #282828;
        padding: 0 10px;
        z-index: 1000;
    }
    
    .nav-item-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10px;
        gap: 6px;
        transition: 0.2s;
        padding: 8px 0;
        flex: 1;
    }
    .nav-item-mobile.active { color: #fff; }
    .nav-item-mobile i { font-size: 20px; }

    #main-content {
        padding-bottom: 160px; /* Espaço para player flutuante + nav */
        background: linear-gradient(to bottom, #1f1f1f, var(--bg-main));
    }

    #page-content {
        padding: 20px 16px !important; /* Padding lateral corrigido para mobile */
    }

    #top-bar {
        padding: 10px 16px;
        background-color: #121212; /* Fundo s\u00F3lido para mobile */
    }

    .albums-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .album-card {
        padding: 8px !important;
    }
    
    .album-card img {
        margin-bottom: 8px;
        border-radius: 6px;
    }

    .album-card h4 {
        font-size: 13px !important;
        margin-bottom: 2px !important;
    }

    .album-card p {
        font-size: 11px !important;
    }

    #player-bar {
        position: fixed;
        bottom: 72px; /* Acima da bottom-nav */
        left: 8px;
        right: 8px;
        width: calc(100% - 16px);
        height: 64px;
        background-color: rgba(40, 40, 40, 0.95);
        backdrop-filter: blur(15px);
        border-radius: 8px;
        padding: 0 12px;
        z-index: 999;
        display: none; /* Oculto por padr\u00E3o no mobile */
        justify-content: space-between;
        align-items: center;
        border: 1px solid #333;
        box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    }
    body.player-active #player-bar { display: flex !important; }

    .now-playing {
        width: 60%;
        gap: 10px;
    }
    .now-playing img {
        width: 44px;
        height: 44px;
        border-radius: 4px;
    }
    #current-title { font-size: 13px; }
    #current-artist { font-size: 11px; }

    .player-controls {
        width: 50%;
        gap: 0;
    }
    .player-controls .buttons {
        gap: 12px;
        width: 100%;
        justify-content: flex-end;
    }
    
    .progress-bar-container, #shuffle-btn, #repeat-btn {
        display: none !important;
    }

    .volume-controls {
        display: flex !important;
        width: auto !important;
        margin-left: 10px;
    }
    
    .volume-bar {
        display: none !important; /* Esconder a barra de volume no mobile para poupar espaço */
    }

    #queue-btn {
        display: block !important;
        font-size: 20px !important;
        margin: 0 !important;
    }

    #prev-btn, #next-btn {
        display: block !important;
        font-size: 22px !important;
        color: #fff !important;
    }

    #play-pause-btn {
        font-size: 38px;
        color: var(--spotify-green);
    }

    /* Album View Mobile */
    .album-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        padding: 30px 10px !important;
        gap: 20px !important;
    }
    .album-header img {
        width: 190px !important;
        height: 190px !important;
    }
    .header-info h1 {
        font-size: 20px !important;
        line-height: 1.2;
        margin-bottom: 8px !important;
    }

    .song-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px; /* Limite para for\u00E7ar as retic\u00EAncias */
    }

    .album-actions {
        justify-content: center !important;
        padding: 10px 0 20px 0 !important;
    }
    
    /* Queue Mobile */
    #queue-panel {
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 145px !important; /* Posicionado acima do player flutuante (72px + 64px + 9px de respiro) */
        border-radius: 12px !important;
        max-height: 65vh !important;
    }

    .queue-header {
        padding: 20px 32px !important; /* Mais respiro no título da fila */
    }

    .song-row td {
        padding: 12px 32px !important; /* Mais respiro na lista de músicas */
    }

    .queue-item {
        padding: 14px 32px !important; /* Mais respiro nos itens da fila */
    }
}

/* Fallback para esconder bottom-nav no desktop */
#bottom-nav { display: none; }