/* ============================================================
   JD Video Slider — Styles  v1.4.0
   ============================================================ */

/* ── Pre-init skeleton (prevents height jump) ────────────── */

.jd-video-slider-wrapper:not([data-jd-vs-init="1"]) .jd-vs-swiper {
    display: flex; overflow: hidden;
}
.jd-video-slider-wrapper:not([data-jd-vs-init="1"]) .swiper-wrapper {
    display: flex; width: 100%;
}
.jd-video-slider-wrapper:not([data-jd-vs-init="1"]) .jd-vs-slide {
    flex: 0 0 25%; /* matches default 4 slides per view */
    aspect-ratio: 9 / 16;
    background: #1a1a1a;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}
/* Shimmer loading animation */
.jd-video-slider-wrapper:not([data-jd-vs-init="1"]) .jd-vs-poster::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
    animation: jd-shimmer 1.5s ease-in-out infinite;
}
@keyframes jd-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
/* Hide buttons before init */
.jd-video-slider-wrapper:not([data-jd-vs-init="1"]) .jd-vs-arrow,
.jd-video-slider-wrapper:not([data-jd-vs-init="1"]) .jd-vs-pagination { display: none; }

.jd-video-slider-wrapper { position: relative; width: 100%; overflow: hidden; }
.jd-vs-swiper { position: relative; overflow: hidden; }
.jd-vs-swiper > .swiper-wrapper { display: flex; }

/* ── Slide ────────────────────────────────────────────────── */

.jd-vs-slide {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #111;
    aspect-ratio: 9 / 16;
    flex-shrink: 0;
    transition: transform 0.5s cubic-bezier(0.22,1,0.36,1), opacity 0.4s ease;
}

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

.jd-vs-swiper.jd-vs-centered .swiper-slide {
    transform: scale(0.92); opacity: 0.7;
    transition: transform 0.5s cubic-bezier(0.22,1,0.36,1), opacity 0.4s ease;
}
.jd-vs-swiper.jd-vs-centered .swiper-slide-active {
    transform: scale(var(--jd-center-scale, 1.08)); opacity: 1; z-index: 2;
}
.jd-vs-swiper.jd-vs-centered .swiper-slide-prev,
.jd-vs-swiper.jd-vs-centered .swiper-slide-next {
    opacity: 0.85; transform: scale(0.95);
}
.jd-vs-swiper.jd-vs-centered { padding: 20px 0; overflow: visible; clip-path: inset(-20px 0); }
.jd-vs-swiper.jd-vs-centered > .swiper-wrapper { overflow: visible; }

/* ── Video container ─────────────────────────────────────── */

.jd-vs-video-wrap { position: absolute; inset: 0; z-index: 1; }
.jd-vs-video-wrap video,
.jd-vs-video-wrap iframe {
    width: 100%; height: 100%; object-fit: cover; display: block; border: 0;
}

/* ── Poster (thumbnail background) ───────────────────────── */

.jd-vs-poster {
    position: absolute; inset: 0; z-index: 2;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    background-color: #1a1a1a;
    transition: opacity 0.4s cubic-bezier(0.22,1,0.36,1);
    cursor: pointer;
}
.jd-vs-poster--empty { background-color: #1a1a1a; }
.jd-vs-poster.is-hidden { opacity: 0; pointer-events: none; }

/* ── Play / Pause button (center, OUTSIDE poster) ────────── */

.jd-vs-playpause {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    border-radius: 50%;
    border: none; cursor: pointer;
    color: #fff;
    background-color: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), background-color 0.3s ease, opacity 0.3s ease;
    padding: 0; line-height: 0;
}
.jd-vs-playpause svg {
    width: 24px; height: 24px;
}
/*
 * SVGs inside buttons: pointer-events:all ensures clicks on
 * transparent (fill:none) areas are captured, then bubble to <button>.
 */
.jd-vs-playpause svg,
.jd-vs-mute svg,
.jd-vs-arrow svg {
    pointer-events: all;
}
.jd-vs-playpause .jd-vs-ico-play { margin-left: 3px; }
.jd-vs-playpause:hover { transform: translate(-50%, -50%) scale(1.12); background-color: rgba(0,0,0,0.65); }

/* When playing: fade out but show on hover */
.jd-vs-slide.is-playing .jd-vs-playpause { opacity: 0; }
.jd-vs-slide.is-playing:hover .jd-vs-playpause,
.jd-vs-slide.is-playing .jd-vs-playpause:focus { opacity: 1; }

/* ── Mute button ─────────────────────────────────────────── */

.jd-vs-mute {
    position: absolute; z-index: 7;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none; cursor: pointer;
    color: #fff;
    background-color: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    transition: background-color 0.25s ease, transform 0.2s ease, opacity 0.3s ease;
    opacity: 0; pointer-events: none;
    padding: 4px; /* Extra click area around the icon */
    line-height: 0;
    box-sizing: border-box;
}
.jd-vs-mute svg {
    width: 100%; height: 100%;
    display: block;
}
.jd-vs-slide.is-playing .jd-vs-mute { opacity: 1; pointer-events: auto; }
.jd-vs-mute:hover { background-color: rgba(0,0,0,0.7); transform: scale(1.1); }

/* Mute positions */
.jd-vs-mute--bottom-right { bottom: 10px; right: 10px; }
.jd-vs-mute--bottom-left  { bottom: 10px; left: 10px; }
.jd-vs-mute--top-right    { top: 10px;    right: 10px; }
.jd-vs-mute--top-left     { top: 10px;    left: 10px; }

/* ── Navigation arrows ───────────────────────────────────── */

.jd-vs-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%; border: none; cursor: pointer;
    color: #fff; background-color: rgba(0,0,0,0.35);
    transition: background-color 0.25s ease, opacity 0.25s ease;
    -webkit-tap-highlight-color: transparent; padding: 0;
}
.jd-vs-arrow svg { width: 24px; height: 24px; }
.jd-vs-arrow:hover { background-color: rgba(0,0,0,0.6); }
.jd-vs-arrow--prev { left: 8px; }
.jd-vs-arrow--next { right: 8px; }
.jd-vs-arrow.swiper-button-disabled { opacity: 0.3; cursor: default; }

/*
 * Override Swiper's built-in .swiper-pagination { position: absolute; z-index: 10; }
 * Without !important, Swiper's CSS wins and the dots overlay the slides,
 * blocking mute/play button clicks.
 */
.jd-vs-pagination--outside {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    text-align: center;
    padding-top: 20px;
    z-index: 1;
}

/* ── Pagination — Inside (overlay) ───────────────────────── */

.jd-vs-pagination--inside {
    position: absolute !important;
    bottom: 12px !important; left: 0 !important; right: 0 !important;
    text-align: center;
    z-index: 8;
    pointer-events: none; /* Container is click-through — won't block mute button */
    height: auto !important;
}
.jd-vs-pagination--inside .swiper-pagination-bullet {
    background: rgba(255,255,255,0.5);
    pointer-events: auto; /* Only the dots themselves are clickable */
}
.jd-vs-pagination--inside .swiper-pagination-bullet-active { background: #fff; }

/* ── Common dot styles ───────────────────────────────────── */

.jd-vs-pagination .swiper-pagination-bullet {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(0,0,0,0.25);
    opacity: 1; margin: 0 4px !important;
    transition: background 0.3s ease, transform 0.3s ease;
    cursor: pointer; display: inline-block;
}
.jd-vs-pagination .swiper-pagination-bullet-active {
    background: #3D4FD6; transform: scale(1.25);
}

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

@media (max-width: 767px) {
    .jd-vs-arrow { width: 32px; height: 32px; }
    .jd-vs-arrow svg { width: 18px; height: 18px; }
    .jd-vs-arrow--prev { left: 4px; }
    .jd-vs-arrow--next { right: 4px; }
}
