/* ============================================================
   Bottom audio player
   Works both as an inline strip inside the desktop footer
   and as a mobile-only panel above the bottom navigation.
   ============================================================ */

:root {
    --footer-h: 64px;
    --footer-bg: #16292a;      /* dark green/teal */
    --footer-fg: #e8f2ef;
    --footer-muted: #7fa19a;
    --footer-accent: #00baba;
}

/* Base player box */
.player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    width: 100%;
    color: var(--footer-fg);
}

.player-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

/* Cover */
.player-cover {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, .05);
    flex-shrink: 0;
}

.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info */
.player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 0 1 160px;
}

.player-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--footer-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-artist {
    font-size: 11px;
    color: var(--footer-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress */
.player-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 80px;
}

.player-time {
    font-size: 11px;
    color: var(--footer-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.player-seek {
    flex: 1;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    outline: none;
}

.player-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--footer-accent);
    cursor: pointer;
    border: 0;
}

.player-seek::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--footer-accent);
    cursor: pointer;
    border: 0;
}

/* Actions */
.player-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.player-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--footer-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background .15s ease, transform .15s ease;
}

.player-btn:hover {
    background: rgba(255, 255, 255, .08);
}

.player-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
    opacity: .85;
}

.player-btn-primary {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, .1);
}

.player-btn-primary:hover {
    background: rgba(255, 255, 255, .18);
}

.player-btn-primary img {
    width: 18px;
    height: 18px;
    opacity: 1;
}

.player-btn[data-active="1"] {
    background: var(--footer-accent);
}

.player-btn[data-active="1"] img {
    opacity: 1;
}

/* Close button only used on mobile */
.player-btn-close {
    display: none;
}

/* ---- Desktop (inline inside the footer bar) ---- */
@media (min-width: 769px) {
    .player[data-state="idle"] {
        display: none;
    }
    .player[data-state="open"] {
        display: flex;
    }
}

/* ---- Mobile (panel above the bottom navigation) ---- */
@media (max-width: 768px) {
    .player {
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--footer-h);
        z-index: 25;

        background: var(--footer-bg);
        border-top: 1px solid rgba(255, 255, 255, .06);

        padding: 10px 12px;

        transform: translateY(8px);
        opacity: 0;
        pointer-events: none;
        transition: transform .2s ease, opacity .2s ease;

        display: flex;
    }

    .player[data-state="closed"],
    .player[data-state="idle"] {
        display: flex;
        transform: translateY(8px);
        opacity: 0;
        pointer-events: none;
    }

    .player[data-state="open"] {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* On mobile: hide progress bar and time to save space,
       show cover + info + controls. */
    .player-progress {
        display: none;
    }

    .player-info {
        flex: 1 1 auto;
    }

    .player-btn-close {
        display: inline-flex;
    }

    body.player-open {
        padding-bottom: calc(var(--footer-h) + 64px);
    }
}





/* ============================================
   Player — base layout
   ============================================ */

.player {
    /* متغیرها را اینجا تنظیم کنید — همه‌چیز از همین‌جا کنترل می‌شود */
    --player-bg: #1f2430;
    --player-fg: #ffffff;
    --player-muted: #9aa3b2;
    --player-accent: #4f8cff;
    --player-radius: 12px;
    --player-padding: 10px 14px;
    --player-gap: 12px;
    --player-cover-size: 48px;

    background: var(--player-bg);
    color: var(--player-fg);
    border-radius: var(--player-radius);
    padding: var(--player-padding);
    box-sizing: border-box;
}

.player-inner {
    display: flex;
    align-items: center;
    gap: var(--player-gap);
}

/* ---------- Cover ---------- */
.player-cover {
    flex: 0 0 auto;
    width: var(--player-cover-size);
    height: var(--player-cover-size);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}
.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- Info ---------- */
.player-info {
    flex: 1 1 auto;
    min-width: 0;
}
.player-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-artist {
    font-size: 12px;
    color: var(--player-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Progress ---------- */
.player-progress {
    flex: 2 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}
.player-time {
    font-size: 12px;
    color: var(--player-muted);
    font-variant-numeric: tabular-nums;
    min-width: 42px;
    text-align: center;
}
.player-seek {
    flex: 1 1 auto;
    accent-color: var(--player-accent);
    cursor: pointer;
}

/* ---------- Actions ---------- */
.player-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.player-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
}
.player-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.player-btn img {
    width: 20px;
    height: 20px;
    display: block;
}
.player-btn-primary {
    width: 44px;
    height: 44px;
    background: var(--player-accent);
}
.player-btn-primary:hover {
    background: color-mix(in srgb, var(--player-accent) 85%, white);
}

/* ---------- Loop mode (با data-mode، بدون JS) ---------- */
.player-btn[data-mode="off"] .icon-loop,
.player-btn[data-mode="all"] .icon-loop,
.player-btn[data-mode="one"] .icon-loop {
    /* اگر می‌خواهید آیکون را با CSS عوض کنید */
}

/* ---------- Visibility states ---------- */
.player[data-state="idle"],
.player[data-state="closed"] {
    display: none;
}

.player[data-state="open"] {
    display: block;
}

/* ============================================
   Mobile mode
   ============================================ */
.player--mobile {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
    z-index: 900;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* در حالت موبایل، Progress ممکن است زیر Info برود */
@media (max-width: 768px) {
    .player-inner {
        flex-wrap: wrap;
        gap: 8px;
    }
    .player-progress {
        order: 3;
        flex-basis: 100%;
    }
    .player-actions {
        margin-inline-start: auto;
    }
    .player-btn-close {
        display: inline-flex;
    }
}

/* در دسکتاپ دکمه بستن لازم نیست */
@media (min-width: 769px) {
    .player-btn-close {
        display: none;
    }
}

/* ============================================
   Idle / placeholder
   ============================================ */
.player[data-state="idle"] .player-cover img,
.player[data-state="closed"] .player-cover img {
    opacity: 0.4;
}