/* ======================================================================
   Fluid MP3 Player — Frontend styles
   Half-size player, fluid morph to FAB, intensified wave background,
   flat volume slider, top-corner minimize + close, fully responsive.
   ====================================================================== */

:root {
    --fmp-bg-0: #0a0a0b;
    --fmp-bg-1: #141416;
    --fmp-bg-2: #1c1c20;
    --fmp-bg-3: #26262b;
    --fmp-line: rgba(255, 255, 255, 0.08);
    --fmp-text: #f4f4f5;
    --fmp-muted: #9b9ba1;
    --fmp-accent: #d4d4d8;
    --fmp-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.35);
    --fmp-radius: 14px;
    --fmp-morph: cubic-bezier(.34, 1.36, .64, 1);
    --fmp-morph-out: cubic-bezier(.65, 0, .35, 1);
    --fmp-vol: 60%;
}

/* ----------------------------- Container ------------------------------ */

.fmp-player {
    position: fixed;
    bottom: 14px;
    right: 14px;
    z-index: 99999;
    width: 200px;
    max-width: calc(100vw - 24px);
    color: var(--fmp-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    opacity: 1;
    pointer-events: auto;
    animation: fmp-enter 0.5s var(--fmp-morph) both;
    transition: width 0.55s var(--fmp-morph);
}

@keyframes fmp-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.85); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.fmp-player.is-ready { /* legacy hook, harmless */ opacity: 1; }

.fmp-player.is-dismissed {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.fmp-player__inner {
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, var(--fmp-bg-1) 0%, var(--fmp-bg-0) 100%);
    border: 1px solid var(--fmp-line);
    border-radius: var(--fmp-radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--fmp-shadow);
    padding: 10px 10px 8px;
    isolation: isolate;
    transition:
        width        0.55s var(--fmp-morph),
        height       0.55s var(--fmp-morph),
        padding      0.55s var(--fmp-morph),
        border-radius 0.55s var(--fmp-morph),
        box-shadow   0.45s var(--fmp-morph-out);
}

/* ------------------------- Fluid wave background ---------------------- */
/* Faster, larger amplitude, more saturated than v1.x. */

.fmp-fluid {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    filter: blur(20px) saturate(150%);
    opacity: 0.95;
    transition: opacity 0.5s ease, filter 0.5s ease;
}

.fmp-fluid__blob {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    mix-blend-mode: screen;
    will-change: transform, opacity;
}

.fmp-fluid__blob--a {
    background: radial-gradient(circle at 30% 30%, #5b5b78, transparent 60%);
    top: -50px; left: -50px;
    animation: fmp-flow-a 7s ease-in-out infinite;
}

.fmp-fluid__blob--b {
    background: radial-gradient(circle at 60% 50%, #7e7e95, transparent 60%);
    bottom: -60px; right: -40px;
    animation: fmp-flow-b 6s ease-in-out infinite;
}

.fmp-fluid__blob--c {
    background: radial-gradient(circle at 50% 50%, #a3a3b8, transparent 55%);
    top: 25%; left: 30%;
    animation: fmp-flow-c 5s ease-in-out infinite;
}

.fmp-fluid__blob--d {
    background: radial-gradient(circle at 50% 50%, #4a4a5e, transparent 65%);
    bottom: 10%; left: -20px;
    animation: fmp-flow-d 8s ease-in-out infinite;
}

.fmp-player.is-playing .fmp-fluid {
    opacity: 1;
    animation: fmp-fluid-pulse 3.5s ease-in-out infinite;
}

@keyframes fmp-fluid-pulse {
    0%, 100% { filter: blur(20px) saturate(150%); }
    50%      { filter: blur(28px) saturate(200%); }
}

@keyframes fmp-flow-a {
    0%   { transform: translate(0, 0)         scale(1);    }
    33%  { transform: translate(70px, 50px)   scale(1.3);  }
    66%  { transform: translate(-30px, 80px)  scale(0.85); }
    100% { transform: translate(0, 0)         scale(1);    }
}

@keyframes fmp-flow-b {
    0%   { transform: translate(0, 0)          scale(1);    }
    33%  { transform: translate(-80px, -40px)  scale(1.2);  }
    66%  { transform: translate(40px, -70px)   scale(0.85); }
    100% { transform: translate(0, 0)          scale(1);    }
}

@keyframes fmp-flow-c {
    0%   { transform: translate(0, 0)         scale(1);   }
    50%  { transform: translate(50px, -60px)  scale(1.4); }
    100% { transform: translate(0, 0)         scale(1);   }
}

@keyframes fmp-flow-d {
    0%   { transform: translate(0, 0)         scale(1);    }
    50%  { transform: translate(60px, -40px)  scale(1.25); }
    100% { transform: translate(0, 0)         scale(1);    }
}

/* ---------------------- Top corner: minimize + close ------------------ */

.fmp-corner {
    position: absolute;
    top: 6px; right: 6px;
    display: flex;
    gap: 4px;
    z-index: 3;
    transition: opacity 0.25s var(--fmp-morph-out), transform 0.35s var(--fmp-morph);
}

.fmp-cbtn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--fmp-line);
    color: var(--fmp-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease, transform 0.25s var(--fmp-morph);
}

.fmp-cbtn:hover,
.fmp-cbtn:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    color: var(--fmp-text);
    outline: none;
}

.fmp-cbtn--close:hover    { transform: rotate(90deg); }
.fmp-cbtn--minimize:hover { transform: translateY(1px); }

.fmp-cbtn svg {
    width: 9px; height: 9px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round;
}

/* v2.x removes the close button entirely (visitors can't dismiss the player). */
.fmp-player .fmp-close,
.fmp-player .fmp-cbtn--close,
.fmp-player .fmp-toggle { display: none !important; }

/* ----------------------------- Artwork -------------------------------- */

.fmp-art {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px 0 8px;
    height: 64px;
    position: relative;
}

.fmp-disc {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, var(--fmp-bg-3) 0%, var(--fmp-bg-2) 35%, var(--fmp-bg-0) 100%);
    box-shadow:
        inset 0 0 0 1px var(--fmp-line),
        inset 0 0 14px rgba(0, 0, 0, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.5);
    animation: fmp-spin 12s linear infinite;
    animation-play-state: paused;
}

.fmp-player.is-playing .fmp-disc { animation-play-state: running; }

.fmp-disc__ring {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.fmp-disc__center {
    position: absolute;
    top: 50%; left: 50%;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--fmp-accent);
    box-shadow: 0 0 0 3px var(--fmp-bg-0);
}

@keyframes fmp-spin { to { transform: rotate(360deg); } }

/* Equalizer overlay (kept for back-compat with existing plugin markup) */
.fmp-equalizer { display: none; }

/* ------------------------------ Meta ---------------------------------- */

.fmp-meta {
    text-align: center;
    margin-bottom: 7px;
    padding: 0 4px;
}

.fmp-meta__label {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 8px;
    color: var(--fmp-muted);
    margin-bottom: 2px;
}

.fmp-meta__title {
    font-size: 11px;
    font-weight: 600;
    color: var(--fmp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.fmp-meta__artist {
    font-size: 10px;
    color: var(--fmp-muted);
    margin-top: 1px;
    min-height: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ----------------------------- Progress ------------------------------- */

.fmp-progress { margin-bottom: 7px; }

.fmp-progress__bar {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    cursor: pointer;
    overflow: hidden;
}

.fmp-progress__fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6b6b73, var(--fmp-accent));
    border-radius: inherit;
    transition: width 0.1s linear;
}

.fmp-progress__thumb { display: none; } /* deprecated, kept for back-compat */

.fmp-progress__time {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--fmp-muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* ----------------------------- Controls ------------------------------- */

.fmp-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 2px;
}

.fmp-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--fmp-line);
    color: var(--fmp-text);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.25s var(--fmp-morph);
    flex-shrink: 0;
}

.fmp-btn:hover,
.fmp-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.fmp-btn:active { transform: translateY(0) scale(0.94); }

.fmp-btn svg {
    width: 11px; height: 11px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0;
}

/* Play button is intentionally not rendered in v2.x (background-music mode).
   Hide any legacy markup that still includes it. */
.fmp-btn--play { display: none !important; }

/* ---------- Now-playing equalizer (replaces play button) ---------- */
.fmp-now-playing {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a30, #16161a);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    padding: 8px 7px 9px;
    flex-shrink: 0;
}
.fmp-now-playing span {
    display: block;
    width: 3px;
    height: 4px;
    background: linear-gradient(to top, var(--fmp-accent), rgba(255, 255, 255, 0.4));
    border-radius: 2px;
    animation: fmp-eq-bar 1s ease-in-out infinite;
    animation-play-state: paused;
}
.fmp-now-playing span:nth-child(1) { animation-delay: -0.10s; }
.fmp-now-playing span:nth-child(2) { animation-delay: -0.40s; }
.fmp-now-playing span:nth-child(3) { animation-delay: -0.70s; }
.fmp-now-playing span:nth-child(4) { animation-delay: -0.20s; }
.fmp-now-playing span:nth-child(5) { animation-delay: -0.50s; }

.fmp-player.is-playing .fmp-now-playing span {
    animation-play-state: running;
}

@keyframes fmp-eq-bar {
    0%, 100% { height: 4px;  opacity: 0.55; }
    50%      { height: 14px; opacity: 1;    }
}

/* ----------------------- Volume — flat bar, no thumb ------------------ */

.fmp-volume {
    margin-left: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}

.fmp-volume__icon {
    width: 13px; height: 13px;
    fill: var(--fmp-muted);
    flex-shrink: 0;
}

.fmp-volume__slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 56px;
    height: 4px;
    border-radius: 999px;
    background:
        linear-gradient(to right,
            var(--fmp-accent) 0%,
            var(--fmp-accent) var(--fmp-vol),
            rgba(255, 255, 255, 0.12) var(--fmp-vol),
            rgba(255, 255, 255, 0.12) 100%);
    outline: none;
    cursor: pointer;
    margin: 0;
    padding: 0;
    border: none;
    transition: background 0.15s linear;
}

.fmp-volume__slider::-webkit-slider-runnable-track { height: 4px; background: transparent; border: none; }
.fmp-volume__slider::-moz-range-track             { height: 4px; background: transparent; border: none; }

.fmp-volume__slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 10px; height: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-top: -3px;
}
.fmp-volume__slider::-moz-range-thumb {
    width: 10px; height: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.fmp-btn--mute { display: none; } /* deprecated; mute is now via clicking the volume icon if desired */

/* ====================== MINIMIZED — Floating Button (FAB) =============== */

.fmp-mini {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--fmp-text);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.4);
    pointer-events: none;
    transition:
        opacity   0.25s var(--fmp-morph-out) 0s,
        transform 0.35s var(--fmp-morph) 0s;
}

.fmp-mini__icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform 0.25s var(--fmp-morph);
    position: relative;
    z-index: 2;
}

.fmp-mini__ring {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.22);
    animation: fmp-spin 8s linear infinite;
    animation-play-state: paused;
    pointer-events: none;
}

.fmp-mini__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    opacity: 0;
    pointer-events: none;
}

.fmp-player--minimized .fmp-mini {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    transition:
        opacity   0.3s var(--fmp-morph) 0.15s,
        transform 0.45s var(--fmp-morph) 0.1s;
}

.fmp-player--minimized.is-playing .fmp-mini__ring  { animation-play-state: running; }
.fmp-player--minimized.is-playing .fmp-mini__pulse { animation: fmp-mini-pulse 2.4s ease-out infinite; }

@keyframes fmp-mini-pulse {
    0%   { opacity: 0.55; transform: scale(1); }
    100% { opacity: 0;    transform: scale(1.7); }
}

.fmp-mini:hover .fmp-mini__icon { transform: scale(1.12); }

/* The morph itself */
.fmp-player--minimized {
    width: 56px;
}

.fmp-player--minimized .fmp-player__inner {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.6),
        0 4px 10px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Children fade FAST when minimizing, fade in DELAYED when expanding,
   producing the fluid morph effect (container morphs first, content follows). */
.fmp-art,
.fmp-meta,
.fmp-progress,
.fmp-controls,
.fmp-corner {
    transition:
        opacity   0.25s var(--fmp-morph-out) 0.2s,
        transform 0.35s var(--fmp-morph) 0.2s;
}

.fmp-player--minimized .fmp-art,
.fmp-player--minimized .fmp-meta,
.fmp-player--minimized .fmp-progress,
.fmp-player--minimized .fmp-controls,
.fmp-player--minimized .fmp-corner {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
    transition:
        opacity   0.18s var(--fmp-morph-out) 0s,
        transform 0.25s var(--fmp-morph-out) 0s;
}

.fmp-player--minimized .fmp-fluid {
    opacity: 0.65;
    filter: blur(14px) saturate(170%);
}

.fmp-player--minimized.is-playing .fmp-fluid { opacity: 1; }

/* ============================ PREVIEW MODE =========================== */
/* Admin-only inert state shown on the live site when the playlist is
   empty. Lets admins instantly see where the player will appear. */

.fmp-player--preview .fmp-meta__label {
    color: #f59e0b;
    cursor: pointer;
}

.fmp-player--preview .fmp-disc {
    box-shadow:
        inset 0 0 0 1px rgba(245, 158, 11, 0.35),
        inset 0 0 14px rgba(0, 0, 0, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.5);
    animation: none;
}

.fmp-player--preview .fmp-disc__center {
    background: #f59e0b;
    box-shadow: 0 0 0 3px var(--fmp-bg-0), 0 0 12px rgba(245, 158, 11, 0.5);
}

.fmp-player--preview .fmp-disc__ring {
    border-color: rgba(245, 158, 11, 0.25);
}

.fmp-player--preview .fmp-progress,
.fmp-player--preview .fmp-volume {
    opacity: 0.35;
    pointer-events: none;
}

.fmp-player--preview .fmp-btn--play {
    background: linear-gradient(135deg, #3a2a10, #1f1608);
    border-color: rgba(245, 158, 11, 0.45);
}

/* ============================ RESPONSIVE ============================= */

@media (max-width: 600px) {
    .fmp-player {
        right: 12px;
        bottom: 12px;
        width: 220px;
    }
    .fmp-player--minimized { width: 60px; }
    .fmp-player--minimized .fmp-player__inner { width: 60px; height: 60px; }
    .fmp-mini__icon { width: 26px; height: 26px; }

    .fmp-cbtn { width: 22px; height: 22px; }
    .fmp-cbtn svg { width: 10px; height: 10px; }
    .fmp-btn { width: 28px; height: 28px; }
    .fmp-btn--play { width: 36px; height: 36px; }
    .fmp-btn svg { width: 12px; height: 12px; }
    .fmp-btn--play svg { width: 14px; height: 14px; }
}

@media (max-width: 380px) {
    .fmp-player {
        width: calc(100vw - 24px);
        max-width: 240px;
    }
    .fmp-volume__slider { max-width: 44px; }
}

@media (max-width: 320px) {
    .fmp-player { right: 8px; bottom: 8px; }
    .fmp-player--minimized { width: 52px; }
    .fmp-player--minimized .fmp-player__inner { width: 52px; height: 52px; }
    .fmp-mini__icon { width: 22px; height: 22px; }
    .fmp-volume { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .fmp-disc,
    .fmp-fluid__blob,
    .fmp-mini__ring,
    .fmp-mini__pulse,
    .fmp-player.is-playing .fmp-fluid {
        animation: none !important;
    }
    .fmp-player,
    .fmp-player__inner,
    .fmp-art,
    .fmp-meta,
    .fmp-progress,
    .fmp-controls,
    .fmp-corner,
    .fmp-mini {
        transition-duration: 0.2s !important;
    }
}
