/*
Theme Name: PapayaBeat Theme
File: assets/css/player.css
Description: Tyylit jatkuvalle (persistent) audiosoittimelle.
Version: 1.1 - Visual and UX Enhancements
*/

:root {
    --papaya-orange: #ff8c42;
    --papaya-orange-glow: rgba(255, 140, 66, 0.4);
    --papaya-dark-bg: #0d0d0d;
    --papaya-text: #e0e0e0;
    --papaya-text-muted: #b3b3b3;
}

/* --- 1. PLAYER CONTAINER --- */

#papaya-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--player-height, 90px);
    background-color: var(--papaya-dark-bg);
    border-top: 1px solid #282828;
    z-index: 9000;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Varmista, että sisältö on z-index 10 ja aaltoefekti alla */
    position: relative;
    overflow: hidden; /* Piilota aaltoefekti reunoilta */
}

#papaya-player-bar.hidden {
    transform: translateY(100%);
}

/* UUSI: TAUSTA AALTO/HEHKU ANIMAATIO */
.player-wave-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 140, 66, 0.05) 0%, rgba(255, 140, 66, 0) 70%);
    opacity: 0.8;
    z-index: 0;
    pointer-events: none;
    animation: pulseGlow 8s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.05; }
    100% { transform: scale(1.05); opacity: 0.15; }
}

.player-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative; /* Nosta wrapper z-indeksiä varten */
    z-index: 10;
}

/* --- 2. LEFT: NOW PLAYING INFO --- */

.player-now-playing {
    display: flex;
    align-items: center;
    width: 30%;
    min-width: 180px;
}

.track-cover {
    width: 56px;
    height: 56px;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #333;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-right: 12px;
    overflow: hidden;
}

.track-title {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.artist-name {
    color: var(--papaya-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artist-name:hover {
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
}

.like-btn {
    background: transparent;
    border: none;
    color: var(--papaya-text-muted);
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.like-btn:hover {
    color: #fff;
}

.like-btn.active {
    color: var(--papaya-orange);
}


/* --- 3. CENTER: CONTROLS --- */

.player-controls-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40%;
    max-width: 722px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.control-btn {
    background: transparent;
    border: none;
    color: var(--papaya-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    color: #fff;
}

.control-btn span {
    font-size: 20px;
}

/* Play/Pause Button - Oranssi hehku */
.play-btn {
    background-color: var(--papaya-orange);
    color: #000;
    width: 38px; /* Isompi nappi */
    height: 38px;
    border-radius: 50%;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 800;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--papaya-orange-glow);
    background-color: var(--papaya-orange);
    color: #000;
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn span {
    font-size: 24px;
    margin-left: 2px;
}
.play-btn.playing span {
    margin-left: 0;
}

.small-btn span {
    font-size: 16px;
}

/* Shuffle/Repeat Active States */
.control-btn.active {
    color: var(--papaya-orange);
    position: relative;
}

.control-btn.active::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    background-color: var(--papaya-orange);
    border-radius: 50%;
    position: absolute;
    bottom: -6px;
}

/* Progress Bar - Paksumpi raita, oranssi täyttö */
.progress-container {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.time-marker {
    color: var(--papaya-text-muted);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    min-width: 35px;
    text-align: center;
}

.progress-bar-wrapper {
    flex-grow: 1;
    height: 6px; /* Paksumpi raita */
    background-color: #535353;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

/* Slider Fill */
.slider-fill {
    height: 100%;
    background-color: var(--papaya-orange); /* Täyttö oranssiksi */
    border-radius: 3px;
    width: 0%;
    z-index: 1;
    pointer-events: none;
}
.progress-bar-wrapper:hover .slider-fill {
    background-color: var(--papaya-orange);
}

/* Slider Thumb (pallukka) */
.papaya-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    z-index: 2;
    cursor: pointer;
}

.papaya-slider:focus {
    outline: none;
}

.papaya-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px; /* Isompi pallukka */
    width: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: none;
    transition: transform 0.1s;
}

.progress-bar-wrapper:hover .papaya-slider::-webkit-slider-thumb {
    display: block;
}


/* --- 4. RIGHT: VOLUME & EXTRAS --- */

.player-extras {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 30%;
    min-width: 180px;
    gap: 15px;
}

/* TIP BUTTON - Korostettu oranssi */
.tip-btn {
    background-color: var(--papaya-orange);
    border: none;
    color: #000;
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(255, 140, 66, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tip-btn:hover {
    background-color: #fff;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.tip-btn .dashicons {
    color: #000;
    font-weight: 800;
}

/* Volume */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100px;
}

.volume-control .dashicons {
    color: var(--papaya-text-muted);
    font-size: 18px;
}

/* --- 5. RESPONSIVE DESIGN (Mobile) --- */

@media (max-width: 768px) {
    #papaya-player-bar {
        bottom: 0;
        height: auto;
        padding-top: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        flex-direction: column;
    }

    .player-wrapper {
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* 1. Kansi vasemmalla */
    .player-now-playing {
        width: 60%;
        order: 1;
        margin-bottom: 8px;
    }

    /* 2. Play-nappi oikealle ylös (pikaohjaus) */
    .player-extras {
        width: 40%;
        order: 2;
        justify-content: flex-end;
        margin-bottom: 8px;
    }

    .tip-btn, .volume-control {
        display: none; /* Piilota vähemmän tärkeät mobiilissa */
    }

    /* 3. Progress bar ja pääkontrollit alle */
    .player-controls-area {
        width: 100%;
        order: 3;
    }

    .time-marker {
        display: none; /* Säästetään tilaa */
    }

    .control-buttons {
        justify-content: space-evenly;
        width: 100%;
    }

    .control-buttons .small-btn {
        display: none; /* Piilota shuffle/repeat mobiilissa tilan säästämiseksi */
    }
}
