/* =========================================================================
 * Revo Player - premium music player styling
 * Docked glass bar + floating mini-player. Mobile-first responsive.
 * ========================================================================= */
:root {
    --rp-accent: #00eaff;
    --rp-accent-2: #7c5cff;
    --rp-bg: rgba(14, 18, 28, 0.82);
    --rp-bg-solid: #0e121c;
    --rp-border: rgba(255, 255, 255, 0.10);
    --rp-text: #f2f6ff;
    --rp-muted: rgba(226, 235, 255, 0.55);
    --rp-radius: 18px;
    --rp-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* hidden media backends - kept in DOM but visually out of the way */
.rp-media {
    position: fixed;
    width: 1px;
    height: 1px;
    left: -9999px;
    bottom: 0;
    opacity: 0;
    pointer-events: none;
}
/* SoundCloud iframe — must stay in the visible area for autoplay to work.
   Kept inside the player bar with zero visible height. */
.rp-sc-wrap {
    height: 0;
    overflow: hidden;
    width: 100%;
}
.rp-sc-wrap iframe {
    width: 100%;
    height: 166px;
    border: 0;
}

/* ================================================================ main bar */
.revo-player {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 140%);
    width: min(1100px, calc(100vw - 32px));
    z-index: 9990;
    background: var(--rp-bg);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow);
    color: var(--rp-text);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, visibility 0.35s;
    overflow: hidden;
}
.revo-player[data-state="open"] {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}
.revo-player[data-state="mini"],
.revo-player[data-state="hidden"] {
    transform: translate(-50%, 160%);
    opacity: 0;
    visibility: hidden;
}

/* glowing top edge */
.revo-player::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--rp-accent), var(--rp-accent-2), transparent);
    opacity: 0.7;
}

/* ---- seek bar ---- */
.rp-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.10);
    cursor: pointer;
    touch-action: none;
}
.rp-bar:hover { height: 8px; }
.rp-bar-buffer {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.12);
    width: 0;
}
.rp-bar-played {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--rp-accent), var(--rp-accent-2));
    box-shadow: 0 0 12px rgba(0, 234, 255, 0.6);
}
.rp-bar-played::after {
    content: "";
    position: absolute;
    right: -6px; top: 50%;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%) scale(0);
    transition: transform 0.15s ease;
    box-shadow: 0 0 10px rgba(0, 234, 255, 0.9);
}
.rp-bar:hover .rp-bar-played::after { transform: translateY(-50%) scale(1); }

/* ---- body ---- */
.rp-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
}

/* ---- track info ---- */
.rp-track {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.rp-art {
    position: relative;
    width: 54px; height: 54px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #1a2030;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.rp-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.revo-player.is-playing .rp-art::after {
    content: "";
    position: absolute; inset: 0;
    border: 2px solid var(--rp-accent);
    border-radius: 12px;
    animation: rpPulse 2s ease-in-out infinite;
}
@keyframes rpPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.85; } }

.rp-source {
    position: absolute;
    bottom: 3px; right: 3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}
.rp-source[data-src="youtube"] { color: #ff4646; }
.rp-source[data-src="soundcloud"] { color: #ff7700; }
.rp-source[data-src="local"], .rp-source[data-src="direct"] { color: var(--rp-accent); }

.rp-meta { min-width: 0; }
.rp-title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rp-artist {
    font-size: 0.8rem;
    color: var(--rp-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- center controls ---- */
.rp-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.rp-buttons { display: flex; align-items: center; gap: 0.5rem; }
.rp-btn {
    background: transparent;
    border: 0;
    color: var(--rp-text);
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.rp-btn:hover { background: rgba(255, 255, 255, 0.12); }
.rp-btn:active { transform: scale(0.92); }
.rp-btn.active { color: var(--rp-accent); }
.rp-btn.rp-play {
    width: 48px; height: 48px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--rp-accent), var(--rp-accent-2));
    color: #06121a;
    box-shadow: 0 6px 18px rgba(0, 234, 255, 0.35);
}
.rp-btn.rp-play:hover { filter: brightness(1.08); }

.rp-repeat { position: relative; }
.rp-repeat[data-mode="one"]::after {
    content: "1";
    position: absolute;
    top: 4px; right: 4px;
    font-size: 8px;
    font-weight: 800;
    color: var(--rp-accent);
}
.rp-time {
    font-size: 0.72rem;
    color: var(--rp-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* ---- right extras ---- */
.rp-extra {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}
.rp-volume { display: flex; align-items: center; gap: 0.4rem; }
.rp-vol {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
}
.rp-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px; height: 13px;
    border-radius: 50%;
    background: var(--rp-accent);
    box-shadow: 0 0 8px rgba(0, 234, 255, 0.7);
    cursor: pointer;
}
.rp-vol::-moz-range-thumb {
    width: 13px; height: 13px;
    border: 0;
    border-radius: 50%;
    background: var(--rp-accent);
    cursor: pointer;
}

/* ================================================== floating mini-player */
.revo-mini {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 9991;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.7rem 0.4rem 0.4rem;
    background: var(--rp-bg);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--rp-border);
    border-radius: 999px;
    box-shadow: var(--rp-shadow);
    color: var(--rp-text);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(120%) scale(0.9);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s;
}
.revo-mini[data-state="open"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.revo-mini-art {
    position: relative;
    width: 44px; height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #1a2030;
}
.revo-mini-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.revo-mini.is-playing .revo-mini-art { animation: rpSpin 8s linear infinite; }
@keyframes rpSpin { to { transform: rotate(360deg); } }

.revo-mini-play {
    background: linear-gradient(135deg, var(--rp-accent), var(--rp-accent-2));
    color: #06121a;
    border: 0;
    width: 34px; height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* equaliser bars on mini when playing */
.revo-mini-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
    padding-right: 4px;
}
.revo-mini.is-playing .revo-mini-eq { display: flex; }
.revo-mini-eq i {
    width: 3px;
    background: var(--rp-accent);
    border-radius: 2px;
    animation: rpEq 0.9s ease-in-out infinite;
}
.revo-mini-eq i:nth-child(1) { animation-delay: 0s; height: 60%; }
.revo-mini-eq i:nth-child(2) { animation-delay: 0.25s; height: 100%; }
.revo-mini-eq i:nth-child(3) { animation-delay: 0.5s; height: 45%; }
@keyframes rpEq { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

/* ============================================================== toast */
.revo-toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translate(-50%, 16px);
    background: rgba(239, 68, 68, 0.96);
    color: #fff;
    padding: 11px 22px;
    border-radius: 10px;
    font-size: 0.85rem;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.revo-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================= responsive */
@media (max-width: 768px) {
    .revo-player {
        bottom: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
    }
    .revo-player[data-state="open"] { transform: translate(-50%, 0); }
    .rp-body {
        grid-template-columns: 1fr auto;
        grid-template-areas: "track extra" "controls controls";
        gap: 0.5rem 0.75rem;
        padding: 0.7rem 0.9rem 0.85rem;
    }
    .rp-track { grid-area: track; }
    .rp-extra { grid-area: extra; }
    .rp-controls { grid-area: controls; }
    .rp-volume { display: none; }            /* use device volume on mobile */
    .rp-art { width: 46px; height: 46px; }
}

@media (max-width: 420px) {
    .rp-buttons .rp-btn:not(.rp-play):not(#rp-prev):not(#rp-next) { display: none; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .revo-player, .revo-mini, .revo-toast { transition: opacity 0.2s ease; }
    .revo-mini.is-playing .revo-mini-art,
    .revo-mini-eq i,
    .revo-player.is-playing .rp-art::after { animation: none; }
}
