/* =========================================
   PLAYER.CSS - FINAL (FIXO, MANUAL E MOBILE VISÍVEL)
   ========================================= */

/* 1. PLAYER BAR (CONTAINER PRINCIPAL) */
#player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px; /* Altura Desktop */
    
    background-color: rgba(12, 12, 12, 0.98); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    
    border-top: 1px solid rgba(198, 162, 74, 0.2); 
    z-index: 999999; /* Z-Index altíssimo para ficar sobre tudo */
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: visible; 
    box-shadow: 0 -10px 40px rgba(0,0,0,0.8);

    /* Animação suave */
    will-change: transform;
    transform: translate3d(0, 0, 0); 
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

#player-bar.hidden { display: none !important; }

/* --- ESTADO MINIMIZADO (PADRÃO) --- */
#player-bar.minimizado {
    transform: translate3d(0, 100%, 0); /* Esconde o corpo para baixo */
    background-color: transparent;
    border-top: none; 
    box-shadow: none; 
    pointer-events: none; /* Permite clicar no site atrás da área transparente */
}

/* ALÇA (HANDLE) - Botão "Abrir" */
#player-bar.minimizado::before {
    content: "▲ PLAYER";
    position: absolute;
    top: -30px; /* Posição da aba Desktop */
    left: 50%;
    transform: translateX(-50%);
    
    background: rgba(12, 12, 12, 0.98);
    color: #C6A24A;
    font-size: 11px;
    font-weight: 800;
    padding: 8px 30px;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    pointer-events: auto; /* Apenas a alça é clicável */
    border: 1px solid #C6A24A;
    border-bottom: none;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.6);
    letter-spacing: 1px;
    animation: pulseHandle 3s infinite;
}

@keyframes pulseHandle {
    0% { color: #C6A24A; }
    50% { color: #fff; text-shadow: 0 0 5px #C6A24A; }
    100% { color: #C6A24A; }
}

/* Botão "Minimizar" (Aparece apenas quando aberto) */
#player-bar:not(.minimizado)::before {
    content: "▼ MINIMIZAR";
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    color: #666;
    font-size: 9px;
    cursor: pointer;
    pointer-events: auto;
    font-weight: bold;
    letter-spacing: 1px;
    transition: 0.2s;
    background: rgba(0,0,0,0.8);
    padding: 2px 10px;
    border-radius: 5px;
}
#player-bar:not(.minimizado):hover::before { color: #C6A24A; }

/* 2. BARRA DE PROGRESSO (Timeline) */
.player-timeline-container {
    position: absolute;
    top: -4px; 
    left: 0;
    width: 100%;        
    height: 4px;        
    z-index: 10000;
    display: block;
    cursor: pointer;
    pointer-events: auto;
    background: rgba(255,255,255,0.1);
}

/* Quando minimizado, timeline visível no rodapé */
#player-bar.minimizado .player-timeline-container {
    top: -4px; 
    height: 4px;
    background: rgba(0,0,0,0.8);
    pointer-events: auto; 
}

.player-timeline-container span, #current-time, #total-time { display: none !important; }

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; cursor: pointer; margin: 0; display: block; height: 100%; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 100%; cursor: pointer; background: transparent; }

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px; width: 12px; border-radius: 50%; background: #C6A24A;
    margin-top: -4px; position: relative; z-index: 2;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.3); }

/* 3. CONTEÚDO PRINCIPAL */
.player-row-bottom {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 30px; height: 100%; width: 100%;
}

.player-info { width: 30%; display: flex; align-items: center; overflow: hidden; }
.player-text-col { display: flex; flex-direction: column; justify-content: center; gap: 2px; width: 100%; }

#player-title {
    font-weight: 800; color: #C6A24A; font-size: 16px; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 1px;
}
#player-credits { font-size: 12px; color: #ccc; font-weight: 400; }

.player-controls { display: flex; gap: 20px; align-items: center; justify-content: center; flex-grow: 1; }
.player-controls button {
    background: none; border: none; color: #fff; cursor: pointer;
    font-size: 18px; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.player-controls button:hover { color: #C6A24A; transform: scale(1.1); }

/* ESTADOS ATIVOS */
.player-controls button.active {
    color: #C6A24A !important;
    text-shadow: 0 0 10px rgba(198, 162, 74, 0.6);
    transform: scale(1.1);
}
.player-controls button.repeat-one { color: #C6A24A !important; position: relative; }
.player-controls button.repeat-one i::after {
    content: "1"; position: absolute; top: -6px; right: -8px; font-size: 9px;
    background-color: #C6A24A; color: #000; width: 12px; height: 12px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: bold; border: 1px solid #000;
}

.player-controls .main-btn { 
    font-size: 24px; width: 45px; height: 45px; 
    background: rgba(255,255,255,0.05); border-radius: 50%; border: 1px solid #333;
    display: flex; align-items: center; justify-content: center; padding: 0;
}
.player-controls .main-btn i.fa-play { margin-left: 3px; } 
.player-controls .main-btn:hover { border-color: #C6A24A; background: rgba(198, 162, 74, 0.1); }

.player-volume { width: 30%; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.player-volume i { font-size: 14px; color: #888; }
.player-volume input[type=range] { width: 80px; height: 4px; }

/* 4. JANELA DA PLAYLIST */
.playlist-container {
    position: fixed; bottom: 100px; right: 20px; width: 300px; max-height: 400px;
    background-color: rgba(15, 15, 15, 0.98); border: 1px solid #C6A24A; border-radius: 12px; z-index: 9998;
    display: flex; flex-direction: column; color: white; box-shadow: 0 5px 30px rgba(0,0,0,0.9);
    transition: opacity 0.3s, transform 0.3s;
}
.playlist-container.hidden { opacity: 0; pointer-events: none; transform: translateY(20px); }
.playlist-header { padding: 12px 15px; background: rgba(198, 162, 74, 0.1); border-bottom: 1px solid rgba(198, 162, 74, 0.2); display: flex; justify-content: space-between; align-items: center; }
.playlist-header h3 { margin: 0; font-size: 14px; color: #C6A24A; text-transform: uppercase; }
.playlist-header button { background: none; border: none; color: #fff; cursor: pointer; }
#playlist-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#playlist-list li { padding: 10px 15px; border-bottom: 1px solid #222; font-size: 12px; cursor: pointer; display: flex; justify-content: space-between; color: #aaa; }
#playlist-list li:hover { background: rgba(255,255,255,0.05); color: #fff; }
#playlist-list li.playing { color: #C6A24A; font-weight: bold; border-left: 3px solid #C6A24A; background: rgba(198, 162, 74, 0.05); }

/* =========================================
   MEDIA QUERIES (MOBILE OTIMIZADO)
   ========================================= */
@media (max-width: 768px) {
    #player-bar {
        height: 130px; /* Mais alto no mobile para caber texto e botões */
        padding-bottom: 20px; /* Espaço para "queixo" de iPhones */
        justify-content: center;
        background-color: rgba(12, 12, 12, 1); /* Fundo sólido para performance */
    }

    /* Estado Minimizando no Mobile */
    #player-bar.minimizado {
        transform: translate3d(0, 100%, 0); 
    }
    
    /* ALÇA DO PLAYER - CORREÇÃO DE ALTURA */
    /* Sobe mais (45px) para não ser coberta por barras de navegação do celular */
    #player-bar.minimizado::before {
        content: "▲ PLAYER";
        top: -45px; 
        padding: 10px 40px; /* Área de toque maior */
        font-size: 12px;
        background: rgba(12, 12, 12, 0.98);
        border: 1px solid #C6A24A;
        border-bottom: none;
    }

    .player-row-bottom {
        flex-direction: column; 
        padding: 5px 15px;
        gap: 10px;
        align-items: center; /* Centraliza tudo no mobile */
    }

    /* Ajuste de Texto no Mobile (Lateral Esquerda) */
    .player-info {
        width: 100%;
        justify-content: flex-start; /* Força esquerda */
        text-align: left;
        margin-top: 10px;
        padding-left: 5px;
    }
    .player-text-col span { text-align: left; display: block; }
    #player-title { font-size: 15px; margin-bottom: 2px; } 
    #player-credits { font-size: 11px; color: #888; }

    /* Controles */
    .player-controls {
        width: 100%;
        justify-content: space-between !important; 
        padding: 0 10px;
        margin-top: 5px;
    }
    .player-controls button { font-size: 20px; padding: 10px; }
    .player-controls .main-btn { width: 50px; height: 50px; font-size: 22px; }

    .player-volume { display: none !important; }
    .playlist-container { width: 90%; left: 5%; bottom: 160px; }
    .player-timeline-container { top: 0; height: 5px; }
}