:root {
    --ap2-red: #FF0000;
    --ap2-blue: #0271CD;
    --ap2-white: #ffffff;
    --ap2-bg: #f8fafc;
    --ap2-soft: #eef2f7;
    --ap2-soft-2: #e5e7eb;
    --ap2-text: #1f2937;
    --ap2-muted: #6b7280;
    --ap2-border: rgba(0,0,0,0.08);
    --ap2-radius: 16px;
    --ap2-radius-sm: 12px;
}

/* =========================================================
   BASE
========================================================= */

#fixed-player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-top: 1px solid var(--ap2-border);
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    max-height: none;
    overflow: visible;
}

#player-container {
    display: block;
    width: 100%;
    min-height: 78px;
}

#player-container #audio {
    min-width: 0;
    padding: 6px 12px;
}

#player-container #audio audio#audio-player {
    display: none !important;
}

#playlist-container {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
}

#playlist-container.visible {
    height: 90px;
}

@-moz-document url-prefix() {
    #playlist-container.visible {
        height: 84px;
    }
}

/* =========================================================
   SHELL
========================================================= */

.ap2-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    color: var(--ap2-text);
}

.ap2-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.ap2-artwork {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--ap2-soft-2);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ap2-blue);
    box-shadow: none;
}

.ap2-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ap2-artwork--placeholder {
    background: var(--ap2-soft);
    color: var(--ap2-blue);
}

.ap2-artwork--placeholder i {
    font-size: 18px;
    line-height: 1;
}

.ap2-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ap2-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap2-artist {
    font-size: 14px;
    color: var(--ap2-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================================
   BOTÃO FECHA EM ALÇA
========================================================= */

#ap2-toggle-player {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 18px;
    padding-top: 4px;
    border: 0;
    border-radius: 5px 5px 0 0;
    background: #ffffff;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

#ap2-toggle-player::before {
    content: "";
    width: 42px;
    height: 5px;
    border-radius: 999px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    background: #ff0000;
    position: absolute;
}

#ap2-toggle-player i {
    display: none;
}

/* =========================================================
   BOTÕES FLAT
========================================================= */

.ap2-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ap2-btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--ap2-soft);
    color: #334155;
    font-size: 14px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    box-shadow: none;
}

.ap2-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ap2-btn:hover {
    background: var(--ap2-soft-2);
    transform: translateY(-1px);
}

.ap2-btn:active {
    transform: scale(.96);
}

.ap2-btn.ap2-btn-main {
    width: 44px;
    height: 44px;
    background: var(--ap2-red);
    color: #fff;
    box-shadow: none;
}

.ap2-btn.ap2-btn-main:hover {
    background: var(--ap2-red);
}

.ap2-btn.active {
    background: var(--ap2-blue);
    color: #fff;
}

.ap2-btn.ap2-speed.active {
    background: var(--ap2-red);
    color: #fff;
}

/* =========================================================
   PROGRESSO
========================================================= */

.ap2-progress-row {
    display: grid;
    grid-template-columns: 44px minmax(0,1fr) 44px auto;
    gap: 8px;
    align-items: center;
}

.ap2-time {
    font-size: 11px;
    color: var(--ap2-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ap2-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: var(--ap2-soft-2);
    outline: none;
    cursor: pointer;
}

.ap2-progress::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--ap2-red) 0%,
        var(--ap2-red) var(--progress, 0%),
        var(--ap2-soft-2) var(--progress, 0%),
        var(--ap2-soft-2) 100%
    );
}

.ap2-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    margin-top: -4px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--ap2-red);
    box-shadow: none;
}

.ap2-progress::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: var(--ap2-soft-2);
}

.ap2-progress::-moz-range-progress {
    height: 5px;
    border-radius: 999px;
    background: var(--ap2-red);
}

.ap2-progress::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--ap2-red);
    box-shadow: none;
}

/* =========================================================
   VOLUME
========================================================= */

.ap2-volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ap2-volume {
    -webkit-appearance: none;
    appearance: none;
    width: 82px;
    height: 6px;
    border-radius: 999px;
    background: var(--ap2-soft-2);
    cursor: pointer;
}

.ap2-volume::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--ap2-blue) 0%,
        var(--ap2-blue) var(--volume, 100%),
        var(--ap2-soft-2) var(--volume, 100%),
        var(--ap2-soft-2) 100%
    );
}

.ap2-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    margin-top: -4px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--ap2-blue);
}

.ap2-volume::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--ap2-soft-2);
}

.ap2-volume::-moz-range-progress {
    height: 4px;
    border-radius: 999px;
    background: var(--ap2-blue);
}

.ap2-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--ap2-blue);
}

/* =========================================================
   FILA / PLAYLIST ATUAL
========================================================= */

#playlist {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0 12px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    box-sizing: border-box;

    scrollbar-width: thin;
    scrollbar-color: var(--ap2-red) transparent;
}

/* Chrome / Edge */
#playlist::-webkit-scrollbar {
    height: 6px;
}

#playlist::-webkit-scrollbar-track {
    background: transparent;
}

#playlist::-webkit-scrollbar-thumb {
    background: var(--ap2-red);
    border-radius: 999px;
}

.ap2-track {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 230px;
    min-width: 230px;
    height: 72px;
    padding: 7px 9px;
    background: var(--ap2-blue);
    color: #fff;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 0;
    transition: transform .18s ease, opacity .18s ease, background .18s ease;
    box-shadow: none;
}

.ap2-track.playing {
    background: var(--ap2-red);
}

.ap2-track.moving {
    opacity: 0.45;
    transform: scale(.98);
    border: 2px dashed rgba(255,255,255,.55);
}

.ap2-track.over {
    outline: 2px solid rgba(255,255,255,.65);
    outline-offset: -2px;
    box-shadow: none;
}

.ap2-track img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    pointer-events: none;
}

.ap2-track-meta {
    min-width: 0;
	flex: 1;
    display: flex;
    flex-direction: column;
}

.ap2-track-title {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ap2-track-artist {
    font-size: 12px;
    opacity: 0.92;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-remove-btn {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 0;
    background: rgba(255,255,255,.18);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s ease, transform .18s ease;
    box-shadow: none;
}

.playlist-remove-btn:hover {
    background: rgba(255,255,255,.28);
    transform: scale(1.05);
}

/* =========================================================
   DRAWER PLAYLISTS SALVAS
========================================================= */

#playlist-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    opacity: 0;
    visibility: hidden;
    transition: .22s ease;
    z-index: 99996;
}

#playlist-modal-overlay.aberto {
    opacity: 1;
    visibility: visible;
}

.playlist-modal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: min(72vh, 620px);
    background: #fff;
    border-radius: 22px 22px 0 0;
    box-shadow: none;
    transform: translateY(100%);
    opacity: 1;
    display: flex;
    flex-direction: column;
    z-index: 99997;
    transition: transform .28s ease;
    overflow: hidden;
    border-top: 1px solid var(--ap2-border);
}

.playlist-modal.aberto {
    transform: translateY(0);
}

.playlist-modal::before {
    content: "";
    width: 64px;
    height: 5px;
    border-radius: 999px;
    background: #d1d5db;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 24px 18px 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 900;
    letter-spacing: .02em;
    color: #111827;
}

#modal-close {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 0;
    background: var(--ap2-soft);
    color: #111827;
    font-size: 24px;
    cursor: pointer;
    box-shadow: none;
}

.modal-content {
    overflow-y: auto;
    padding: 14px;
    flex: 1;
    background: var(--ap2-bg);
}

#playlists-saved-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#playlists-saved-list li {
    margin-bottom: 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
    border: 1px solid var(--ap2-border);
}

/* =========================================================
   MODAL ALERT / PROMPT
========================================================= */

.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.68);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 16px;
}

.custom-modal-content {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    color: #111827;
    box-shadow: none;
    border: 1px solid var(--ap2-border);
}

.custom-modal-content h3 {
    margin: 0 0 10px;
    color: var(--ap2-blue);
    font-size: 1.18rem;
}

.custom-modal-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    box-sizing: border-box;
    box-shadow: none;
    outline: none;
}

.custom-modal-input:focus {
    border-color: var(--ap2-blue);
}

.custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.custom-modal-buttons button {
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    cursor: pointer;
    font-weight: 800;
    font-size: .95rem;
    box-shadow: none;
}

.custom-modal-buttons .btn-confirm {
    background: var(--ap2-red);
    color: #fff;
}

.custom-modal-buttons .btn-cancel,
.custom-modal-buttons .btn-alert {
    background: var(--ap2-soft-2);
    color: #111827;
}

/* =========================================================
   UTIL
========================================================= */

#repeat.active,
#rockdoido.active {
    color: #fff !important;
}

@keyframes rockShake {
    0%   { transform: translate(0, 0) rotate(0deg); }
    10%  { transform: translate(-1px, -1px) rotate(-1deg); }
    20%  { transform: translate(1px, 1px) rotate(1deg); }
    30%  { transform: translate(-2px, 0) rotate(-1deg); }
    40%  { transform: translate(2px, 0) rotate(1deg); }
    50%  { transform: translate(-1px, 1px) rotate(-1deg); }
    60%  { transform: translate(1px, -1px) rotate(1deg); }
    70%  { transform: translate(-2px, 1px) rotate(-1deg); }
    80%  { transform: translate(2px, -1px) rotate(1deg); }
    90%  { transform: translate(-1px, 0) rotate(-1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.ap2-speed.active {
    animation: rockShake 0.4s infinite;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {
	
	#ap2-toggle-player {
		top: -10px;
	}

    .ap2-main {
        display: grid;
        grid-template-columns: auto minmax(0,1fr);
        grid-template-areas:
            "cover meta controls";
        align-items: center;
        gap: 8px;
    }

    .ap2-artwork {
        grid-area: cover;
        width: 50px;
        height: 50px;
    }

    .ap2-meta {
        grid-area: meta;
        min-width: 0;
    }

    .ap2-title,
    .ap2-artist {
        text-align: left;
    }

    .ap2-controls {
        grid-area: controls;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        margin-top: 6px;
    }

    .ap2-btn {
        width: 42px;
        height: 42px;
        font-size: 15px;
    }

    .ap2-btn.ap2-btn-main {
        width: 52px;
        height: 52px;
        font-size: 18px;
    }

    .ap2-progress-row {
        grid-template-columns: 36px minmax(0,1fr) 36px;
        gap: 6px;
    }

    .ap2-volume-wrap {
        display: none;
    }
	
	#playlist {
		padding: 0 12px 8px;
	}
}