/**
 * OmniPress — Media Player (Sticky + Vinyl)
 * @version 1.20.0
 */

/* ============================================================
   ۱. دیسک چرخان (Vinyl)
   ============================================================ */
.op-vinyl {
    position: fixed;
    bottom: 100px;
    left: 24px;
    z-index: 9998;
    width: 120px;
    height: 120px;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.3));
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
}
.op-vinyl.is-active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.op-vinyl:hover {
    transform: scale(1.05) translateY(-4px);
}

.op-vinyl__disc {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #2a2a2a, #111 60%, #000);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.05), 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: op-vinyl-spin 10s linear infinite;
    animation-play-state: paused;
}

.op-vinyl.is-playing .op-vinyl__disc {
    animation-play-state: running;
}

/* شیارهای روی دیسک */
.op-vinyl__disc::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.op-vinyl__label {
    width: 55%;
    height: 55%;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.1);
    z-index: 2;
    position: relative;
}
.op-vinyl__cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.op-vinyl__center {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

.op-vinyl__play-btn {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    display: grid;
    place-items: center;
    z-index: 4;
    cursor: pointer;
    transition: background 0.25s, transform 0.25s, opacity 0.25s;
    opacity: 0.9;
}
.op-vinyl:hover .op-vinyl__play-btn {
    background: var(--op-brand);
    border-color: var(--op-brand);
    transform: scale(1.1);
    opacity: 1;
}
.op-vinyl__play-btn svg {
    width: 20px;
    height: 20px;
    margin-inline-start: 2px; /* برای مرکز شدن در RTL */
}

/* وقتی دیسک در حال پخش است، دکمه پلی مخفی شود (چون روی دیسک کلیک می‌شود) */
.op-vinyl.is-playing .op-vinyl__play-btn {
    opacity: 0;
    pointer-events: none;
}

@keyframes op-vinyl-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   ۲. پخش‌کننده چسبان (Sticky Bottom Player)
   ============================================================ */
.op-sp {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--op-surface);
    border-top: 1px solid var(--op-border);
    box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: none; /* به‌صورت پیش‌فرض مخفی */
}
.op-sp.is-open {
    display: block;
    transform: translateY(0);
}

.op-sp__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    max-width: var(--op-container);
    margin: 0 auto;
    min-height: 72px;
}

/* Cover */
.op-sp__cover {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--op-bg-alt);
    border: 1px solid var(--op-border);
    position: relative;
}
.op-sp__cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.op-sp.is-playing .op-sp__cover {
    animation: op-vinyl-spin 10s linear infinite;
}

/* Info */
.op-sp__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.op-sp__badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--op-brand);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: none;
}
.op-sp__title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--op-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.op-sp__artist {
    font-size: 11.5px;
    color: var(--op-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls */
.op-sp__controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.op-sp__btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--op-text-soft);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.op-sp__btn:hover {
    background: var(--op-bg-alt);
    color: var(--op-brand);
}
.op-sp__btn svg {
    width: 18px;
    height: 18px;
}
.op-sp__btn--play {
    background: var(--op-brand);
    color: #fff;
    width: 42px;
    height: 42px;
}
.op-sp__btn--play:hover {
    background: var(--op-brand-dark);
    transform: scale(1.05);
}

/* Progress */
.op-sp__progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 500px;
    min-width: 200px;
}
.op-sp__time {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--op-text-muted);
    min-width: 40px;
    text-align: center;
}
.op-sp__progress {
    flex: 1;
    height: 6px;
    background: var(--op-border);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.op-sp__progress-fill {
    height: 100%;
    width: 0%;
    background: var(--op-brand);
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Volume */
.op-sp__volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.op-sp__volume {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--op-border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.op-sp__volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--op-brand);
    cursor: pointer;
}
.op-sp__volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--op-brand);
    cursor: pointer;
    border: none;
}

/* Close */
.op-sp__btn--close {
    color: var(--op-text-muted);
}
.op-sp__btn--close:hover {
    background: #fee;
    color: #c00;
}

/* Hidden media elements */
#op-sp-audio,
#op-sp-video {
    display: none !important;
}
.op-sp__embed-container {
    display: none !important;
}

/* ============================================================
   ۳. شورت‌کد Trigger
   ============================================================ */
.op-media-trigger {
    transition: border-color 0.2s, box-shadow 0.2s;
}
.op-media-trigger:hover {
    border-color: var(--op-brand) !important;
    box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.1);
}
.op-media-trigger__btn {
    flex-shrink: 0;
}

/* ============================================================
   ۴. ریسپانسیو
   ============================================================ */
@media (max-width: 900px) {
    .op-sp__inner {
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px 12px;
    }
    .op-sp__progress-wrap {
        order: 10;
        width: 100%;
        max-width: none;
        min-width: 0;
        flex-basis: 100%;
        margin-top: 4px;
    }
    .op-sp__volume-wrap {
        display: none;
    }
    .op-vinyl {
        width: 90px;
        height: 90px;
        bottom: 90px;
        left: 16px;
    }
}

@media (max-width: 620px) {
    .op-sp__cover {
        width: 40px;
        height: 40px;
    }
    .op-sp__title {
        font-size: 12px;
    }
    .op-sp__artist {
        font-size: 10.5px;
    }
    .op-sp__btn--play {
        width: 38px;
        height: 38px;
    }
    .op-vinyl {
        width: 70px;
        height: 70px;
        bottom: 80px;
        left: 12px;
    }
    .op-vinyl__play-btn {
        width: 32px;
        height: 32px;
    }
    .op-vinyl__play-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ============================================================
   ۵. حالت شب
   ============================================================ */
[data-theme="dark"] .op-sp {
    background: var(--op-surface);
    border-top-color: var(--op-border);
    box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .op-vinyl__disc {
    background: radial-gradient(circle at 35% 35%, #1a1a1a, #0a0a0a 60%, #000);
}