/* ═══════════════════════════════════════════════════
   AUDIO PLAYER 1.0.0
   Panggil CSS + JS sekali per halaman, lalu cukup tulis
   tag <audio> biasa:

   <audio src="lagu.mp3" data-title="Judul" data-artist="Artis"></audio>

   Beberapa <audio> yang berada dalam satu wadah (atau satu
   [data-audio-group]) otomatis digabung menjadi playlist.
   ═══════════════════════════════════════════════════ */

.audio-player-wrap {
    position: relative;
    margin: 12px 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 9000;
}

/* Tag <audio> sumber dan elemen audio internal player tidak ditampilkan. */
.audio-player-wrap > audio,
.audio-player audio {
    display: none;
}

.audio-player {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    color: #e0e0e0;
    font-size: 11px;
    font-family: inherit;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 1;
}

.ap-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    box-sizing: border-box;
}

.ap-btn {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: background 0.12s;
}

.ap-btn:hover {
    background: #1e1e1e;
}

.ap-btn:active {
    background: #2a2a2a;
}

.ap-btn svg {
    display: block;
}

.ap-progress {
    flex: 1 1 auto;
    min-width: 0;
    height: 4px;
    background: #2a2a2a;
    position: relative;
    cursor: pointer;
    border-radius: 0;
    overflow: visible;
}

.ap-progress:focus-visible {
    outline: 1px solid #e0e0e0;
    outline-offset: 3px;
}

.ap-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #4a4a4a;
    border-radius: 0;
    transition: width 0.15s linear;
}

.ap-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #e0e0e0;
    border-radius: 0;
    z-index: 2;
}

.ap-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 9px;
    height: 9px;
    background: #e0e0e0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border-radius: 0;
    z-index: 3;
}

.ap-time {
    flex: 0 0 auto;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: #a0a0a0;
    white-space: nowrap;
    padding: 0 3px;
    min-width: 62px;
    text-align: center;
}

.ap-toggle {
    width: 100%;
    padding: 7px 10px;
    background: #0a0a0a;
    border: none;
    border-top: 1px solid #2a2a2a;
    color: #e0e0e0;
    font-size: 10px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0;
    transition: background 0.12s;
}

.ap-toggle:hover {
    background: #1a1a1a;
}

.ap-toggle__chevron {
    transition: transform 0.2s ease;
    display: block;
}

.ap-toggle.open .ap-toggle__chevron {
    transform: rotate(180deg);
}

.ap-list {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    max-height: 240px;
    overflow-y: auto;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-bottom: none;
    border-radius: 0;
    z-index: 2147483647;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.6);
}

.ap-list.open {
    display: block;
}

.ap-list::-webkit-scrollbar {
    width: 6px;
}

.ap-list::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.ap-list::-webkit-scrollbar-thumb {
    background: #333;
}

.ap-track {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    border-left: 2px solid transparent;
    border-radius: 0;
    transition: background 0.12s;
}

.ap-track:hover {
    background: #1a1a1a;
}

.ap-track.active {
    background: #1a1a1a;
    border-left-color: #e0e0e0;
}

.ap-track__num {
    flex: 0 0 auto;
    width: 16px;
    text-align: right;
    font-size: 10px;
    color: #666;
    font-variant-numeric: tabular-nums;
}

.ap-track.active .ap-track__num {
    color: #e0e0e0;
}

.ap-track__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ap-track__title {
    font-size: 11px;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ap-track.active .ap-track__title {
    font-weight: 600;
}

.ap-track__artist {
    font-size: 9.5px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ap-volume-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 6px;
    width: 40px;
    padding: 12px 0 10px;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-bottom: none;
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2147483647;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.6);
}

.ap-volume-panel.open {
    display: flex;
}

.ap-volume-slider {
    position: relative;
    width: 8px;
    height: 140px;
    background: #2a2a2a;
    cursor: pointer;
    border-radius: 0;
    touch-action: none;
}

.ap-volume-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e0e0e0;
    border-radius: 0;
    pointer-events: none;
}

.ap-volume-handle {
    position: absolute;
    left: 50%;
    bottom: 100%;
    width: 16px;
    height: 8px;
    background: #e0e0e0;
    transform: translate(-50%, 50%);
    pointer-events: none;
    border-radius: 0;
}

.ap-volume-value {
    font-size: 9.5px;
    color: #a0a0a0;
    font-variant-numeric: tabular-nums;
    text-align: center;
    min-width: 24px;
    line-height: 1;
}

/* Layar sempit (sidebar / ponsel): rapatkan kontrol agar tetap pas. */
@media (max-width: 480px) {
    .ap-controls {
        gap: 4px;
        padding: 6px 8px;
    }

    .ap-btn {
        width: 20px;
        height: 20px;
    }

    .ap-time {
        min-width: 54px;
        padding: 0 2px;
        font-size: 9.5px;
    }

    .ap-list {
        max-height: 200px;
    }
}
