/* --- Redesigned Fixed Audio Player --- */
.fixed-audio-player-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #1a2533;
    padding: 10px 20px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    box-sizing: border-box;
    transition: transform 0.4s ease-in-out; 
}

#audio-player-element {
    display: none;
}

.player-main-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
    transition: opacity 0.3s ease-in-out;
}

.player-controls-left,
.player-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.now-playing-and-progress {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.now-playing-info {
    color: #ecf0f1;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 600px;
    padding-bottom: 5px;
}

.now-playing-info .book-title-part {
    color: #a9d0f5;
}

.now-playing-info .track-title-part {
    color: #bdc3c7;
}

.player-progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 800px;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 6px;
    background-color: #34495e;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: #85c1e9;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.player-time-display {
    color: #bdc3c7;
    font-size: 0.85rem;
    font-family: 'monospace', sans-serif;
    flex-shrink: 0;
}

.player-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 5px;
}

.player-btn:hover {
    color: #85c1e9;
    transform: scale(1.1);
}

.play-btn {
    font-size: 2rem;
    color: #85c1e9;
}
.play-btn:hover {
    color: #ffffff;
}

.volume-control-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider-bg {
    width: 80px;
    height: 5px;
    background-color: #34495e;
    border-radius: 2.5px;
    cursor: pointer;
    position: relative;
}

.volume-slider-level {
    height: 100%;
    width: 100%;
    background-color: #85c1e9;
    border-radius: 2.5px;
    position: relative;
}

.playlist-container {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 400px;
    height: calc(100% - 80px);
    background-color: #1f2c3b;
    z-index: 999;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
}

.playlist-container.visible {
    right: 0;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #2c3e50;
    color: #ecf0f1;
    flex-shrink: 0;
}

.playlist-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

#close-playlist-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 2rem;
    cursor: pointer;
    padding: 0 5px;
}

.playlist-content {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.playlist-item {
    padding: 15px 20px;
    color: #bdc3c7;
    cursor: pointer;
    border-bottom: 1px solid #2c3e50;
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item:hover {
    background-color: #2c3e50;
}

.playlist-item.active {
    background-color: #3498db;
    color: #ffffff;
    font-weight: bold;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .fixed-audio-player-wrapper {
        padding: 10px 15px;
    }
    .player-main-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        position: relative;
    }
    .now-playing-and-progress {
        order: -1;
        width: 100%;
        text-align: center;
    }
    .now-playing-info {
        font-size: 0.8rem;
    }
    .player-time-display {
        font-size: 0.8rem;
    }
    .player-controls-right {
        position: absolute;
        right: 15px;
        bottom: 18px; 
    }
    
    /* --- THIS IS THE CHANGE --- */
    /* Hide the entire volume control container on mobile */
    .volume-control-container {
        display: none;
    }
    /* --- END OF CHANGE --- */

    .player-btn {
        font-size: 1.4rem;
    }
    .play-btn {
        font-size: 1.8rem;
    }
    .playlist-container {
        top: auto;
        bottom: -100%;
        right: 0;
        left: 0;
        width: 100%;
        max-width: none;
        height: 60vh;
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
        transition: bottom 0.4s ease-in-out;
    }
    .playlist-container.visible {
        bottom: 78px;
        right: 0;
    }

     .volume-control-container,
    #playback-mode-btn {
        display: none;
    }

    .volume-control-container,
    #playback-mode-btn,
    .playback-speed-container {
        display: none;
    }

    .volume-control-container,
    #playback-mode-btn,
    .playback-speed-container,
    #player-lock-btn {
        display: none;
    }
}

/* --- SCROLLING / MARQUEE TITLE EFFECT --- */
@keyframes marquee-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.now-playing-info.is-scrolling .marquee-content {
    display: flex;
    animation: marquee-scroll linear infinite;
}

.now-playing-info.is-scrolling .marquee-content > span {
    display: inline-block;
    padding-right: 40px;
    white-space: nowrap;
}

#playback-mode-btn {
    position: relative;
    font-size: 1.2rem;
}

#playback-mode-btn {
    position: relative;
    font-size: 1.2rem;
}

/* All modes are considered active now */
#playback-mode-btn.active {
    color: #85c1e9;
}

/* '1' badge for Repeat One mode */
#playback-mode-btn.repeat-one::after {
    content: '1';
    position: absolute;
    top: 0px;
    right: -2px;
    background-color: #85c1e9;
    color: #1a2533;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    font-size: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.playback-speed-container {
    position: relative; /* For positioning the pop-up menu */
}

#speed-control-btn {
    font-size: 1rem;
    font-weight: bold;
    width: 50px; /* Give it a fixed width */
}

.speed-options-menu {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 120%; /* Position it above the button */
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    width: 80px;
    overflow: hidden;
}

.speed-options-menu.visible {
    display: block;
}

.speed-option {
    padding: 12px 10px;
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.speed-option:hover {
    background-color: #34495e;
}

.speed-option.active {
    background-color: #85c1e9;
    color: #1a2533;
    font-weight: bold;
}

.fixed-audio-player-wrapper.collapsed {
    /* Move the player down, leaving 30px visible */
    transform: translateY(calc(100% - 5px));
}
.fixed-audio-player-wrapper.collapsed:hover {
    /* On hover, bring it back into full view */
    transform: translateY(0);
}

#player-lock-btn {
    position: absolute;
    top: -35%;
    right: 5%;
    font-size: 1rem;
    padding: 8px;
    background-color: #1a2533;
}