/* ═══════════════════════════════════════════════════════════════
   Richsound — Standalone player bar (Spotify-style)
   Used on pages that include it as a fixed/static bottom bar.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&display=swap');

.player-bar {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr minmax(160px, 240px);
    align-items: center;
    gap: 0;
    min-height: 90px;
    padding: 0 16px;
    background: #0e0e16;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-family: "Sora", "Segoe UI", system-ui, sans-serif;
    color: #fff;
}

.player-bar.player-bar--fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Now playing ──────────────────────────────────────────────── */

.player-bar .player__now {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding-right: 8px;
}

.player-bar .player__art {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    flex-shrink: 0;
    background:
        linear-gradient(135deg, #27131c, #3b1d4e 40%, #ee8340);
    background-size: cover;
    background-position: center;
}

.player-bar .player__info { min-width: 0; flex: 1; }

.player-bar .player__title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    letter-spacing: -0.01em;
}

.player-bar .player__artist {
    margin: 0;
    font-size: 12px;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

/* Generic icon button */
.player-bar .player__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    padding: 0;
    background: transparent;
    color: #b3b3b3;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, transform 0.15s;
    flex-shrink: 0;
}

.player-bar .player__btn:hover { color: #fff; transform: scale(1.06); }
.player-bar .player__btn:active { transform: scale(0.95); }
.player-bar .player__btn:disabled { opacity: 0.35; cursor: default; transform: none !important; }

.player-bar .player__btn--heart { margin-left: 8px; color: #8b5cf6; }
.player-bar .player__btn--heart:hover { color: #a78bfa; }

/* ── Center ──────────────────────────────────────────────────── */

.player-bar .player__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
}

.player-bar .player__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Play/pause button */
.player-bar .player__btn--play {
    width: 40px;
    height: 40px;
    background: #fff;
    color: #000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.player-bar .player__btn--play:hover {
    color: #000;
    background: #f0f0f0;
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.6);
}

.player-bar .player__btn--play:active { transform: scale(0.96); }

/* Play/pause icon toggling */
.player-bar .player__icon-play  { display: block; }
.player-bar .player__icon-pause { display: none;  }
[data-playing] .player__icon-play  { display: none;  }
[data-playing] .player__icon-pause { display: block; }

@keyframes player-pulse {
    0%, 100% { box-shadow: 0 0 0 0    rgba(139, 92, 246, 0.55), 0 4px 16px rgba(0,0,0,0.45); }
    55%       { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0),   0 4px 16px rgba(0,0,0,0.45); }
}

[data-playing] .player-bar .player__btn--play {
    animation: player-pulse 2.6s ease-out infinite;
}

/* ── Progress bar ────────────────────────────────────────────── */

.player-bar .player__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.player-bar .player__time {
    font-size: 11px;
    color: #b3b3b3;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 34px;
    text-align: center;
}

/* ── Slider component ────────────────────────────────────────── */

.player-bar .player__slider {
    position: relative;
    flex: 1;
    height: 4px;
    border-radius: 2px;
    cursor: pointer;
}

.player-bar .player__slider::before {
    content: '';
    position: absolute;
    inset: -10px 0;
}

.player-bar .player__slider-rail {
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.18);
}

.player-bar .player__slider-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--fill, 0%);
    background: #b3b3b3;
    border-radius: 2px;
    pointer-events: none;
}

.player-bar .player__slider:hover .player__slider-fill { background: #8b5cf6; }

.player-bar .player__slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: var(--fill, 0%);
    transform: translate(-50%, -50%) scale(0);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    pointer-events: none;
    transition: transform 0.12s ease;
    z-index: 2;
}

.player-bar .player__slider:hover::after { transform: translate(-50%, -50%) scale(1); }

/* На тач-экранах нет hover — показываем заливку и ползунок постоянно */
@media (hover: none), (pointer: coarse) {
    .player-bar .player__slider .player__slider-fill { background: #8b5cf6; }
    .player-bar .player__slider::after { transform: translate(-50%, -50%) scale(1); }
}

.player-bar .player__range {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: calc(4px + 20px);
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
    z-index: 3;
    -webkit-appearance: none;
    appearance: none;
}

/* ── Side: volume ────────────────────────────────────────────── */

.player-bar .player__side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-left: 8px;
}

.player-bar .player__slider--vol {
    flex: none;
    width: 93px;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 900px) {
    .player-bar {
        grid-template-columns: minmax(180px, 240px) 1fr minmax(130px, 190px);
        padding: 0 12px;
    }
    .player-bar .player__slider--vol { width: 72px; }
}

@media (max-width: 680px) {
    .player-bar .player__btn--shuffle,
    .player-bar .player__btn--repeat { display: none; }
}

@media (max-width: 540px) {
    .player-bar {
        grid-template-columns: 1fr auto;
        min-height: auto;
        padding: 10px 14px;
        gap: 10px;
    }

    .player-bar .player__side { display: none; }

    .player-bar .player__center {
        gap: 4px;
        padding: 0;
    }

    .player-bar .player__controls { gap: 4px; }

    .player-bar .player__btn--play {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 400px) {
    .player-bar .player__art { width: 44px; height: 44px; }
    .player-bar .player__title { font-size: 13px; }
    .player-bar .player__artist { font-size: 11px; }
    .player-bar .player__btn--heart { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Design improvements — focus, polish
   ═══════════════════════════════════════════════════════════════ */

/* ── Focus states ───────────────────────────────────────────────── */
.player-bar .player__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
    color: #fff;
}

.player-bar .player__btn--play:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.55),
                0 4px 16px rgba(0, 0, 0, 0.45);
}

/* ── Heart button — use CSS var fallback ─────────────────────────── */
.player-bar .player__btn--heart {
    color: #8b5cf6; /* = var(--accent) */
}

/* ── Slider fill — accent on active ─────────────────────────────── */
.player-bar .player__slider:active .player__slider-fill,
.player-bar .player__slider:focus-within .player__slider-fill {
    background: #8b5cf6;
}

/* ── Active mode buttons (shuffle/repeat) ───────────────────── */
.player__btn--active {
    color: #8b5cf6;
}
.player__btn--active svg {
    filter: drop-shadow(0 0 4px rgba(139,92,246,.6));
}

/* ── Queue panel ────────────────────────────────────────────── */
.player-queue {
    position: fixed;
    bottom: 90px;
    right: 16px;
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: rgba(14,14,22,.96);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200;
    display: none;
    flex-direction: column;
    font-family: "Sora", "Segoe UI", system-ui, sans-serif;
}
.player-queue--open {
    display: flex;
}
.player-queue__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.4);
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.player-queue__list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.player-queue__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background .14s;
    border-radius: 0;
}
.player-queue__item:hover,
.player-queue__item:active {
    background: rgba(255,255,255,.05);
}
.player-queue__item--active {
    background: rgba(139,92,246,.12);
}
.player-queue__item--active .player-queue__title {
    color: #8b5cf6;
}
.player-queue__cover {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(139,92,246,.15);
    flex-shrink: 0;
    object-fit: cover;
}
.player-queue__cover-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(139,92,246,.12);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.player-queue__meta {
    flex: 1;
    min-width: 0;
}
.player-queue__title {
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}
.player-queue__artist {
    font-size: .72rem;
    color: rgba(255,255,255,.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
