/* Main Container */
#oniversus-web-player {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #ffffff;
    background-color: #061018; /* Dark blue/black from theme */
    display: flex;
    flex-direction: column;
    height: 600px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.player-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.player-sidebar {
    width: 200px;
    background-color: #000000;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #222;
}

.sidebar-header h3 {
    margin: 0 0 20px 10px;
    font-size: 14px;
    font-weight: 700;
    color: #b3b3b3;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#playlist-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

#playlist-list li {
    padding: 10px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #b3b3b3;
    border-radius: 4px;
    transition: color 0.2s;
    margin-bottom: 5px;
}

#playlist-list li:hover {
    color: #fff;
    background-color: #1a1a1a;
}

#playlist-list li.active {
    color: #fff;
    background-color: #282828;
    border-left: 3px solid #926AA6; /* Theme Accent */
}

/* Main Content */
.player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #1e1e1e 0%, #061018 40%);
    overflow: hidden;
}

.track-list-header {
    padding: 20px 30px;
    display: flex;
    align-items: flex-end;
    min-height: 150px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
}

.playlist-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

#current-playlist-title {
    font-size: 48px;
    font-weight: 900;
    margin: 0 0 10px 0;
    line-height: 1;
    color: #fff;
}

#track-count {
    color: #b3b3b3;
    font-size: 14px;
}

/* Track Table */
.track-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 30px 30px;
}

#track-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#track-table th {
    text-align: left;
    color: #b3b3b3;
    border-bottom: 1px solid #282828;
    padding: 10px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 400;
}

#track-table td {
    padding: 10px;
    color: #b3b3b3;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.2s;
}

#track-table tr:hover td {
    background-color: #2a2a2a;
    color: #fff;
    cursor: default;
}

#track-table tr.active-track td {
    color: #fff;
    background-color: #1b1221;
}

#track-table tr.active-track .col-num {
    color: #926AA6; /* Theme Accent */
}

.track-index {
    display: inline-block;
}

.track-playing-indicator {
    display: none;
    margin-left: 4px;
    vertical-align: middle;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background-image: url('../img/oniversus-playing.gif');
    background-size: cover; /* recorte cuadrado desde el centro */
    background-position: center center;
    background-repeat: no-repeat;
}

.track-playing-indicator span {
    display: none;
}

.track-playing-indicator span:nth-child(2) {
    animation-delay: -0.3s;
}

.track-playing-indicator span:nth-child(3) {
    animation-delay: -0.6s;
}

#track-table tr.active-track .track-playing-indicator {
    display: inline-block;
}

#track-table tr.active-track .track-index {
    display: none;
}

@keyframes oniversus-eq {
    0% { transform: scaleY(0.8); opacity: 0.7; }
    50% { transform: scaleY(1.2); opacity: 1; }
    100% { transform: scaleY(0.8); opacity: 0.7; }
}

.col-num { width: 40px; text-align: center; }
.col-action { width: 40px; text-align: right; }

.play-track-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
}

#track-table tr:hover .play-track-btn {
    opacity: 1;
}

/* Controls Bar */
.player-controls-bar {
    height: 90px;
    background-color: #181818;
    border-top: 1px solid #282828;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
}

.now-playing {
    display: flex;
    align-items: center;
    width: 30%;
    min-width: 180px;
}

.np-art-wrapper {
    width: 56px;
    height: 56px;
    margin-right: 14px;
    background: #282828;
    display: flex;
    align-items: center;
    justify-content: center;
}

#np-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.np-placeholder {
    font-size: 24px;
}

.np-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

#np-title {
    color: #fff;
    font-size: 14px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#np-artist {
    color: #b3b3b3;
    font-size: 11px;
}

/* Center Controls */
.controls-center {
    width: 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 722px;
}

.buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    align-items: center;
}

.ctrl-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-btn:hover {
    color: #fff;
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.ctrl-btn.active {
    color: #926AA6; /* Theme Accent for active state */
    background-color: transparent !important;
}

.ctrl-btn:focus,
.ctrl-btn:active,
.ctrl-btn:focus-visible {
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.repeat-one-badge {
    font-family: sans-serif;
    position: absolute;
    top: -5px;
    right: -6px;
    font-size: 9px;
    font-weight: 800;
    background-color: #926AA6; /* Theme Accent */
    color: #ffffff;
    padding: 1px 3px;
    border-radius: 6px;
    line-height: 1;
    z-index: 10;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
}

.play-pause-btn {
    color: #fff;
    background: #fff;
    color: #000;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
}
.play-pause-btn:hover {
    color: #000;
    transform: scale(1.05);
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #b3b3b3;
}

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    display: flex;
    align-items: center;
}

#seek-bar {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    --seek-fill: 0%;
}

#seek-bar::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #926AA6 0%, #926AA6 var(--seek-fill), #4f4f4f var(--seek-fill), #4f4f4f 100%);
}

#seek-bar::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #926AA6 0%, #926AA6 var(--seek-fill), #4f4f4f var(--seek-fill), #4f4f4f 100%);
}

#seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
    margin-top: -4px; /* center thumb on 4px track */
}

#seek-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
}

/* Right Controls */
.controls-right {
    width: 30%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-width: 180px;
}

.volume-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    margin-right: 8px;
}

#volume-bar {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border-radius: 2px;
    outline: none;
    --volume-fill: 100%;
}

#volume-bar::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #926AA6 0%, #926AA6 var(--volume-fill), #4f4f4f var(--volume-fill), #4f4f4f 100%);
}

#volume-bar::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #926AA6 0%, #926AA6 var(--volume-fill), #4f4f4f var(--volume-fill), #4f4f4f 100%);
}

#volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
    margin-top: -4px; /* center thumb on 4px track */
}

#volume-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #061018; 
}
::-webkit-scrollbar-thumb {
    background: #333; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #oniversus-web-player {
        height: 80vh; /* Full viewport height on mobile */
        max-height: 800px; /* Cap it reasonably */
        border-radius: 0;
    }

    .player-container {
        flex-direction: column;
    }

    .player-sidebar {
        width: 100%;
        height: auto;
        max-height: 150px; /* Limit height of playlist list */
        border-right: none;
        border-bottom: 1px solid #222;
        padding: 10px;
    }

    #playlist-list {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }

    #playlist-list li {
        display: inline-block;
        margin-right: 10px;
        margin-bottom: 0;
        background: #1a1a1a;
        padding: 8px 15px;
    }

    #playlist-list li.active {
        border-left: none;
        border-bottom: 3px solid #926AA6;
    }

    /* Hide some table columns on mobile */
    .col-num, .col-action {
        display: none;
    }
    
    #track-table th {
        padding: 8px;
    }
    
    #track-table td {
        padding: 12px 8px; /* Larger touch target vertically */
        font-size: 14px;
    }

    .player-controls-bar {
        height: auto;
        flex-direction: column;
        padding: 15px;
        gap: 15px;
        background-color: #121212; /* Slightly darker for contrast */
        padding-bottom: 25px;
    }

    .now-playing {
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 5px;
    }

    .controls-center {
        width: 100%;
        max-width: none;
        display: flex;
        flex-direction: column-reverse; /* Progress bar on top of buttons */
        gap: 15px;
    }

    .buttons {
        gap: 20px; /* Explicit gap instead of space-between */
        margin-bottom: 0;
        justify-content: center; /* Center buttons to avoid edge cutoff */
        width: 100%;
        padding: 0;
    }

    .ctrl-btn {
        flex-shrink: 0; /* Critical: Prevent buttons from squashing */
        -webkit-tap-highlight-color: transparent;
    }

    .ctrl-btn svg {
        width: 16px; /* 16px icons */
        height: 16px;
    }

    .play-pause-btn {
        width: 36px; /* 36px play button */
        height: 36px;
        flex-shrink: 0;
    }

    .progress-container {
        width: 100%;
        margin-bottom: 5px;
    }
    
    #seek-bar {
        height: 6px;
    }
    #seek-bar::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
        margin-top: -5px; /* Correct vertical centering: -(16/2 - 6/2) */
    }

    /* Restore volume on mobile, stacked below controls */
    .controls-right {
        display: flex;
        width: 100%;
        justify-content: center;
        margin-top: 5px;
    }
    
    .controls-right .volume-btn {
        margin-right: 15px;
    }
    
    #volume-bar {
        width: 60%; /* Wider volume bar on mobile */
    }
}
