/**
 * Shohaz Video Player — CSS
 * همه استایل‌های پلیر اینجاست
 */

/* ── کانتینر اصلی ── */
.shohaz-vp,
.video-player,
.shohaz-video-player {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
}

.shohaz-vp *,
.video-player *,
.shohaz-video-player * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

/* ── ویدیو ── */
.shohaz-vp video,
.video-player video,
.shohaz-video-player video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

/* ── Overlay (دکمه پخش مرکزی) ── */
.vp-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .28);
    z-index: 2;
    transition: opacity .18s ease, visibility .18s ease;
}

.shohaz-vp.playing .vp-overlay,
.video-player.playing .vp-overlay,
.shohaz-video-player.playing .vp-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.vp-play-big {
    width: 62px;
    height: 62px;
    background: rgba(255, 255, 255, .93);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
    transition: transform .15s ease, background .15s ease;
    outline: none;
}

.vp-play-big svg {
    width: 22px;
    height: 22px;
    color: #111;
    margin-right: -2px;
    pointer-events: none;
}

.vp-play-big:hover {
    transform: scale(1.08);
    background: #fff;
}

.vp-play-big:active {
    transform: scale(.94);
}

.vp-play-big:focus-visible {
    outline: 2px solid var(--accent, #22c55e);
    outline-offset: 3px;
}

/* ── Loading / Buffering spinner ── */
.vp-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    z-index: 8;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    pointer-events: none;
}

.shohaz-vp.buffering .vp-loading,
.video-player.buffering .vp-loading,
.shohaz-video-player.buffering .vp-loading {
    opacity: 1;
    visibility: visible;
}

.vp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: var(--accent, #22c55e);
    border-radius: 50%;
    animation: vpSpin .8s linear infinite;
}

@keyframes vpSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ── نوار کنترل ── */
.vp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 10px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    z-index: 3;
    opacity: 0;
    transition: opacity .2s ease;
}

.shohaz-vp:hover .vp-controls,
.shohaz-vp.playing .vp-controls,
.video-player:hover .vp-controls,
.video-player.playing .vp-controls,
.shohaz-video-player:hover .vp-controls,
.shohaz-video-player.playing .vp-controls {
    opacity: 1;
}

/* ── Progress bar ── */
.vp-progress {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, .22);
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 7px;
    direction: ltr;
    transition: height .12s ease;
}

.vp-progress:hover {
    height: 6px;
}

.vp-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: var(--accent, #22c55e);
    border-radius: 4px;
    pointer-events: none;
}

.vp-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform .12s ease;
    pointer-events: none;
}

.vp-progress:hover .vp-progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

/* ── نوار دکمه‌ها ── */
.vp-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    direction: ltr;
}

.vp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background .12s ease;
    outline: none;
    flex-shrink: 0;
}

.vp-btn:hover {
    background: rgba(255, 255, 255, .14);
}

.vp-btn:active {
    background: rgba(255, 255, 255, .22);
}

.vp-btn:focus-visible {
    outline: 1px solid rgba(255, 255, 255, .5);
}

.vp-btn svg {
    pointer-events: none;
}

.vp-time {
    font-size: .7rem;
    color: rgba(255, 255, 255, .82);
    direction: ltr;
    min-width: 74px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    padding: 0 4px;
}

.vp-spacer {
    flex: 1;
}

/* ── آیکون‌های play/pause ── */
.ico-pause {
    display: none;
}

.ico-play {
    display: block;
}

.shohaz-vp.playing .ico-play,
.video-player.playing .ico-play,
.shohaz-video-player.playing .ico-play {
    display: none;
}

.shohaz-vp.playing .ico-pause,
.video-player.playing .ico-pause,
.shohaz-video-player.playing .ico-pause {
    display: block;
}

/* ── آیکون‌های صدا ── */
.ico-mute {
    display: none;
}

.ico-vol {
    display: block;
}

.shohaz-vp.muted .ico-vol,
.video-player.muted .ico-vol,
.shohaz-video-player.muted .ico-vol {
    display: none;
}

.shohaz-vp.muted .ico-mute,
.video-player.muted .ico-mute,
.shohaz-video-player.muted .ico-mute {
    display: block;
}

/* ── آیکون‌های fullscreen ── */
.ico-compress {
    display: none;
}

.ico-expand {
    display: block;
}

.shohaz-vp.fullscreen .ico-expand,
.video-player.fullscreen .ico-expand,
.shohaz-video-player.fullscreen .ico-expand {
    display: none;
}

.shohaz-vp.fullscreen .ico-compress,
.video-player.fullscreen .ico-compress,
.shohaz-video-player.fullscreen .ico-compress {
    display: block;
}

/* ── منوی سرعت ── */
.vp-speed-wrap {
    position: relative;
}

.vp-btn-speed {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: .7rem;
    font-weight: 700;
    padding: 0 6px;
    height: 30px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background .12s;
    white-space: nowrap;
    font-family: inherit;
    outline: none;
}

.vp-btn-speed:hover {
    background: rgba(255, 255, 255, .14);
}

.vp-speed-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1c1c1c;
    border: 1px solid #383838;
    border-radius: 8px;
    overflow: hidden;
    z-index: 20;
    min-width: 68px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .55);
}

.vp-speed-menu.open {
    display: flex;
}

.vp-speed-menu button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .8);
    font-size: .76rem;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    text-align: center;
    transition: background .12s, color .12s;
    font-family: inherit;
    white-space: nowrap;
}

.vp-speed-menu button:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.vp-speed-menu button.active {
    color: var(--accent, #22c55e);
}

/* ── دکمه بستن (floating) ── */
.vp-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, .7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background .12s;
}

.vp-close:hover {
    background: rgba(0, 0, 0, .9);
}

/* ── منوی راست‌کلیک سفارشی ── */
#svp-ctx {
    display: none;
    position: fixed;
    z-index: 99999;
    background: #1c1c1c;
    border: 1px solid #383838;
    border-radius: 8px;
    padding: 10px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    direction: rtl;
    pointer-events: none;
}

#svp-ctx.open {
    display: block;
}

/* ── Floating mini player ── */
.video-player.floating,
.shohaz-vp.floating {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 280px;
    height: auto;
    aspect-ratio: 16/9;
    border-radius: 10px;
    z-index: 9999;
    box-shadow: 0 10px 36px rgba(0, 0, 0, .4);
    animation: vpFloatIn .25s ease;
}

.video-player.floating .vp-close,
.shohaz-vp.floating .vp-close {
    display: flex;
}

.video-player.floating .vp-play-big,
.shohaz-vp.floating .vp-play-big {
    width: 42px;
    height: 42px;
}

.video-player.floating .vp-play-big svg,
.shohaz-vp.floating .vp-play-big svg {
    width: 15px;
    height: 15px;
}

@keyframes vpFloatIn {
    from {
        opacity: 0;
        transform: scale(.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}