/*

Version 3.4 

*/

.hidden {
    display: none;
}

/* Player container */
.player-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    min-width: 320px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    border: 1px solid;
    border-radius: 8px;
    overflow: hidden; /* Ensure covers don't overflow */
}

.audio-playlist-name{
    position: relative;
    width: fit-content;
    margin: 0px auto;
    z-index: 4;
}

/* Cover images */
.audio-covers-container-1, .audio-covers-container-2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    border: 1px solid; /* Match player container border */
    border-radius: 8px;
    transition: opacity 1s ease-in-out;
}

/* Ensure the active cover is visible initially */
.audio-covers-container-1.active-cover,
.audio-covers-container-2.active-cover {
    opacity: 1;
}

/* Background video */
.background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    border: 1px solid;
    border-radius: 8px;
}

/* Spectrum canvas */
.spectrum-canvas {
    width: 100%;
    height: 200px;
    display: block;
    position: relative;
    z-index: 3;
}

.toggle-visualizer{
    position: absolute;
    z-index: 4;
    cursor: pointer;
    right: 18px;
    top: 10px;   
}

/* Seek bar */
.seek-bar {
    width: 100%;
    height: 8px;
    position: relative;
    margin: 10px 0;
    cursor: pointer;
    touch-action: none; /* Prevents pinch-zoom/scroll during touch */
    z-index: 4;
    border-radius: 4px; /* All corners rounded */
}

.seek-progress {
    height: 100%;
    width: 0;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 4px 0px 0px 4px; /* Left side rounded */
}

.seek-handle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    touch-action: none; /* Ensures smooth touch dragging */
}

.seek-handle:active {
    cursor: grabbing;
}

.audio-time-container {
    display: flex;
    align-items: center; /* Vertically center items */
    width: 100%;
    margin-top: 10px;
    z-index: 4;
}

.track-current-time {
    flex: 0 0 auto; /* Fixed width based on content */
    padding-right: 10px; /* Space between current time and ticker */
    font-family: monospace;
    font-size: 16px;
    position: relative;
    z-index:4;
}

.current-track-container {
    flex: 1; /* Grow to fill available space */
    min-width: 0; /* Allow shrinking below content width to prevent overflow */
    overflow: hidden; /* Clip overflowing ticker content */
    white-space: nowrap;
    position: relative;
    z-index: 4;
}

.current-track {
    display: inline-block;
    white-space: nowrap;
    font-size: 16px;
}

.ticker-item {
    display: inline-block;
}

.track-total-time {
    flex: 0 0 auto; /* Fixed width based on content */
    padding-left: 10px; /* Space between ticker and total time */
    text-align: right;
    font-family: monospace;
    font-size: 16px;
    position: relative;
    z-index: 4;
}

/* Responsive adjustments */
@media screen and (max-width: 600px) {
    .track-current-time,
    .track-total-time {
        font-size: 14px; /* Smaller font on mobile */
    }
    .current-track {
        font-size: 14px;
    }
    .ticker-item {
        margin-right: 10px; /* Less space on smaller screens */
    }
}

/* Controls */
#controls {
    align-items: center;
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 10px auto 10px auto;
    position: relative;
    z-index: 4;
}

#controls button {
    border: 1px solid;
    width: clamp(36px, 6vw, 40px); /* Square button size, scales with viewport */
    height: clamp(36px, 6vw, 40px); /* Equal to width for square shape */
    font-size: clamp(16px, 3vw, 18px); /* Smaller icon size to fit square */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation; /* Prevents double-tap zoom */
    border-radius: 8px;
}

#controls button:hover {
    border: 1px solid;
}

/* Volume control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 5px;
    /*margin-left: 10px;  Space from playlist toggle button */
    position: relative;
    z-index: 4;
}

.volume-slider-container{
    display: flex;
    align-items: center;
    /*padding: 6px 8px 6px 8px;*/
    border-radius: 8px;
    height: 40px;
}

.volume-slider {
    width: 90%; /* Smaller slider on mobile */
    margin: 0px auto;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 4;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: grab;
    position: relative;
    top: -4px;
    border-radius: 10px; /* optional rounded handle */
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: grab;
    position: relative;
    top: -4px;
    border-radius: 10px; /* optional rounded handle */
}

.volume-slider::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
}

.volume-slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
}

.mute-toggle {
    width: clamp(36px, 6vw, 40px); /* Match control buttons */
    height: clamp(36px, 6vw, 40px);
    font-size: clamp(16px, 3vw, 18px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    border: 1px solid;
    border-radius: 8px;
}

.mute-toggle:hover {
    border: 1px solid;
}

/* Responsive adjustments for smaller screens */

@media (max-width: 601px) {
    .volume-slider-container {
        display: flex;
        align-items: center;
        border-radius: 8px;
        height: 38px;
    }

    .volume-slider {
        width: 90%;
        margin: 0px auto;
    }

    .mute-toggle {
        width: clamp(32px, 8vw, 36px);
        height: clamp(32px, 8vw, 36px);
        font-size: clamp(14px, 4vw, 16px);
    }
}

@media (max-width: 400px) {
    .volume-slider-container {
        display: flex;
        align-items: center;
        border-radius: 8px;
        height: 38px;
    }
    
    .volume-slider {
        width: 90%;
        margin: 0px auto;
    }

    .mute-toggle {
        padding: 10px;
        width: 40px;
        height: 40px;
        font-size: 12px;
    }
}

@media (max-width: 350px) {
    .volume-control{
      gap: 2px;  
    }
    
    .volume-slider-container {
        display: flex;
        align-items: center;
        border-radius: 8px;
        height: 30px;
    }
    
    .volume-slider {
        width: 90%;
        margin: 0px auto;
    }

    .mute-toggle {
        padding: 8px;
        width: 30px;
        height: 30px;
        font-size: 10px;
    }
}

/* Playlist container */
.playlist-container {
    margin-top: 20px;
    position: relative;
    z-index: 4;
}

.playlist {
    list-style: none !important;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

.playlist li {
    list-style-type: none !important;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 2px;
}

.audio-playlist-duration{
    float: right;
}

/* scrollbar width */
.playlist::-webkit-scrollbar {
  width: 15px;
}

/* scrollbar track */
.playlist::-webkit-scrollbar-track {
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
 
/* scrollbar handle */
.playlist::-webkit-scrollbar-thumb {
  border-radius: 10px; /* optional rounded handle */
}

/* scrollbar handle on hover */
.playlist::-webkit-scrollbar-thumb:hover {
    cursor: grab;
}

/* Responsive adjustments */
@media (max-width: 601px) {
    .player-container {
        padding: 10px;
    }

    .spectrum-canvas {
        height: 170px;
    }

    .seek-bar {
        height: 6px;
    }

    .seek-handle {
        width: 14px;
        height: 14px;
    }

    #controls button {
        width: clamp(32px, 8vw, 36px); /* Smaller square buttons for mobile */
        height: clamp(32px, 8vw, 36px);
        font-size: clamp(14px, 4vw, 16px);
    }

    .current-track {
        font-size: 14px;
    }
    
    #controls {
        margin-bottom: 15px;
    }
}

@media (max-width: 450px) {
    
    .spectrum-canvas {
        height: 150px;
    }
    
    #controls {
        gap: 3px;
        margin-bottom: 15px;
    }

    #controls button {
        padding: 12px;
        width: 45px;
        height: 45px;
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    
    .spectrum-canvas {
        height: 120px;
    }
    
    #controls {
        gap: 2px;
        margin-bottom: 15px;
    }

    #controls button {
        padding: 10px;
        width: 40px;
        height: 40px;
        font-size: 12px;
    }
}

@media (max-width: 350px) {
    .player-container {
        padding: 8px;
    }

    .spectrum-canvas {
        height: 100px;
    }

    .seek-bar {
        height: 5px;
    }

    .seek-handle {
        width: 12px;
        height: 12px;
    }
    
    #controls {
        gap: 2px;
        margin-bottom: 18px;
    }

    #controls button {
        padding: 8px;
        width: 30px;
        height: 30px;
        font-size: 10px;
    }

    .current-track {
        font-size: 13px;
    }
}

.audio-credits {
    font-size: 8pt;
    right: 10px;
    position: absolute;
    bottom: 4px;
    z-index: 4;
    text-decoration: none !important;
}

.audio-credits a{
    text-decoration: none !important;
}

.audio-credits a:hover{
    text-decoration: none !important;
}

.audio-shuffle{
    font-size: 8pt;
    left: 10px;
    position: absolute;
    bottom: 4px;
    z-index: 4;
    text-decoration: none !important;
} 