/* ======================================================================
 *  Vertical Video Product Slider — Front-end Styles v3
 *  Scoped to .cew-vvps-widget to avoid conflicts.
 *
 *  • Clone-aware for infinite loop
 *  • Centre card biggest, sides progressively smaller
 *  • Mobile 1 / Tablet 3 / Desktop 5 visible cards
 *  • Product image poster for video cards (inactive state)
 *  • Dynamic inactive card opacity via Elementor control
 * ====================================================================== */

/* ── Reset ────────────────────────────────────────────────────────────── */

.cew-vvps-widget,
.cew-vvps-widget *::before,
.cew-vvps-widget *::after {
    box-sizing: border-box;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

.cew-vvps-widget {
    display: block;
    width: 100%;
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.cew-vvps-header {
    text-align: center;
    margin-bottom: 48px;
}

.cew-vvps-heading {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.2;
    font-weight: 800;
}

.cew-vvps-subheading {
    margin: 0;
    opacity: 0.7;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

/* ── Carousel wrapper ─────────────────────────────────────────────────── */

.cew-vvps-wrapper {
    position: relative;
    overflow: hidden;
    padding: 48px 0 40px;
    width: 100%;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}

.cew-vvps-wrapper:active {
    cursor: grabbing;
}

/* ── Track ────────────────────────────────────────────────────────────── */

.cew-vvps-track {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    gap: 20px;
}

/* ── Card base ────────────────────────────────────────────────────────── */

.cew-vvps-card {
    flex-shrink: 0;
    transition:
        opacity 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        filter 0.55s ease;
    opacity: var(--cew-inactive-opacity, 0.5);
    transform: scale(0.82);
    filter: brightness(var(--cew-inactive-brightness, 0.7)) saturate(calc(var(--cew-inactive-brightness, 0.7) + 0.1));
    cursor: pointer;
    position: relative;
}

/* Clone cards — same base */
.cew-vvps-card.cew-vvps-clone {
    opacity: var(--cew-inactive-opacity, 0.5);
    transform: scale(0.82);
    filter: brightness(var(--cew-inactive-brightness, 0.7)) saturate(calc(var(--cew-inactive-brightness, 0.7) + 0.1));
}

/* ── Active (centre) card ─────────────────────────────────────────────── */

.cew-vvps-card.is-active {
    opacity: 1 !important;
    transform: scale(1) !important;
    filter: brightness(1) saturate(1) !important;
    z-index: 10;
    cursor: default;
}

/* Glow ring on active */
.cew-vvps-card.is-active::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: calc(12px + 3px);
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.05));
    z-index: -1;
    opacity: 0;
    animation: cew-vvps-glow-in 0.4s ease forwards;
    pointer-events: none;
}

@keyframes cew-vvps-glow-in {
    to { opacity: 1; }
}

/* ── Card inner ───────────────────────────────────────────────────────── */

.cew-vvps-card-inner {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.45s ease, transform 0.45s ease;
    position: relative;
}

.cew-vvps-card.is-active .cew-vvps-card-inner {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ── Hover effects ────────────────────────────────────────────────────── */

.cew-vvps-widget[data-hover="true"] .cew-vvps-card:not(.is-active):hover {
    opacity: 0.7;
    filter: brightness(calc(var(--cew-inactive-brightness, 0.7) + 0.15)) saturate(calc(var(--cew-inactive-brightness, 0.7) + 0.2));
}

.cew-vvps-widget[data-hover="true"] .cew-vvps-card:not(.is-active):hover .cew-vvps-card-inner {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-6px);
}

.cew-vvps-widget[data-hover="true"] .cew-vvps-card.is-active:hover .cew-vvps-card-inner {
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.16),
        0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ── Media container ──────────────────────────────────────────────────── */

.cew-vvps-media {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #0a0a0a;
}

.cew-vvps-media img,
.cew-vvps-media video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.6s ease;
}

.cew-vvps-card.is-active .cew-vvps-media img,
.cew-vvps-card.is-active .cew-vvps-media video {
    transform: scale(1);
}

.cew-vvps-card:not(.is-active) .cew-vvps-media img,
.cew-vvps-card:not(.is-active) .cew-vvps-media video {
    transform: scale(1.05);
}

.cew-vvps-media-link {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    z-index: 2;
}

.cew-vvps-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
    letter-spacing: 0.05em;
}

/* ── Product Image Poster (for video cards) ───────────────────────────── */

/*
 * The poster image is shown when a video card is INACTIVE.
 * It sits above the <video> element but below the overlay.
 * When the card becomes active (.is-active), the poster fades out
 * and the video plays underneath.
 */
.cew-vvps-poster {
    z-index: 2;
    opacity: 1;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

/* Active card → hide poster, show video */
.cew-vvps-card.is-active .cew-vvps-poster {
    opacity: 0;
}

/* ── Video overlay & play button ──────────────────────────────────────── */

.cew-vvps-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 40%);
    transition: background 0.35s ease;
    cursor: pointer;
}

.cew-vvps-card:hover .cew-vvps-video-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.1) 50%);
}

.cew-vvps-play-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), background 0.3s ease, border-color 0.3s ease;
    z-index: 10;
    pointer-events: none;
    padding: 0;
    color: #fff;
}

/* Play/Pause button — HIDDEN by default on ALL cards */
.cew-vvps-card .cew-vvps-play-btn {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Show only on card hover */
.cew-vvps-card:hover .cew-vvps-play-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Active card without hover — still hidden */
.cew-vvps-card.is-active .cew-vvps-play-btn {
    opacity: 0;
}

/* Active card WITH hover — visible */
.cew-vvps-card.is-active:hover .cew-vvps-play-btn {
    opacity: 1;
    pointer-events: auto;
}

.cew-vvps-play-btn:hover {
    transform: scale(1.12);
    background: rgba(0, 0, 0, 0.55);
    border-color: #fff;
}

.cew-vvps-play-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.cew-vvps-icon-pause { display: none; }
.cew-vvps-play-btn.is-playing .cew-vvps-icon-play { display: none; }
.cew-vvps-play-btn.is-playing .cew-vvps-icon-pause { display: block; }

/* ── Iframe ───────────────────────────────────────────────────────────── */

.cew-vvps-iframe-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    cursor: pointer;
    z-index: 1;
}

.cew-vvps-media iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 3;
}

/* Pause-frame canvas — shows last frame when video is paused */
.cew-vvps-pause-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 4;
    pointer-events: none;
}

/* ── Info strip ───────────────────────────────────────────────────────── */

.cew-vvps-info {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
}

.cew-vvps-thumb-link {
    flex-shrink: 0;
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f5f5;
    text-decoration: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    border: 1px solid rgba(0,0,0,0.06);
}

.cew-vvps-thumb-link:hover {
    transform: scale(1.05);
    opacity: 0.85;
}

.cew-vvps-thumb-link img {
    position: static;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.cew-vvps-details {
    flex: 1;
    min-width: 0;
}

.cew-vvps-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    text-decoration: none;
    line-height: 1.35;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.cew-vvps-title:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.cew-vvps-price {
    font-size: 15px;
    font-weight: 700;
    display: block;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

/* ── Arrows ───────────────────────────────────────────────────────────── */

.cew-vvps-arrows {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.cew-vvps-arrow {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #333;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cew-vvps-arrow:hover {
    background: #f8f8f8;
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.15);
}

.cew-vvps-arrow:active {
    transform: scale(0.96);
}

.cew-vvps-arrow svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

/* ── Progress dots ────────────────────────────────────────────────────── */

.cew-vvps-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.cew-vvps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cew-vvps-dot.is-active {
    background: #333;
    transform: scale(1.3);
}

.cew-vvps-dot:hover {
    background: rgba(0, 0, 0, 0.35);
}

/* ══════════════════════════════════════════════════════════════════════
 *  Responsive
 * ══════════════════════════════════════════════════════════════════════ */

/* ── Mobile: 1 card visible ───────────────────────────────────────────── */

@media screen and (max-width: 749px) {
    .cew-vvps-wrapper {
        width: 100vw;
        max-width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        padding: 32px 0;
    }

    .cew-vvps-card {
        width: calc(78vw - 20px);
        max-width: 340px;
    }

    .cew-vvps-header {
        margin-bottom: 32px;
        padding: 0 20px;
    }

    .cew-vvps-heading {
        font-size: 24px !important;
    }

    .cew-vvps-subheading {
        font-size: 14px;
    }

    .cew-vvps-play-btn {
        width: 52px;
        height: 52px;
    }

    .cew-vvps-play-btn svg {
        width: 20px;
        height: 20px;
    }

    .cew-vvps-arrow {
        width: 44px;
        height: 44px;
    }

    .cew-vvps-arrow svg {
        width: 20px;
        height: 20px;
    }
}

/* ── Tablet: 3 cards visible ──────────────────────────────────────────── */

@media screen and (min-width: 750px) and (max-width: 989px) {
    .cew-vvps-wrapper {
        padding: 40px 0;
    }

    .cew-vvps-card {
        width: calc((100% - 40px) / 3);
        max-width: 380px;
    }
}

/* ── Desktop: 5 cards visible ─────────────────────────────────────────── */

@media screen and (min-width: 990px) {
    .cew-vvps-card {
        width: calc((1400px - 80px) / 5);
        max-width: 350px;
    }
}

/* ══════════════════════════════════════════════════════════════════════
 *  Entrance animation — real cards only
 * ══════════════════════════════════════════════════════════════════════ */

.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone) {
    animation: cew-vvps-card-enter 0.5s ease both;
}

.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(1)  { animation-delay: 0.05s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(2)  { animation-delay: 0.1s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(3)  { animation-delay: 0.15s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(4)  { animation-delay: 0.2s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(5)  { animation-delay: 0.25s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(6)  { animation-delay: 0.3s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(7)  { animation-delay: 0.35s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(8)  { animation-delay: 0.4s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(9)  { animation-delay: 0.45s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(10) { animation-delay: 0.5s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(11) { animation-delay: 0.55s; }
.cew-vvps-widget .cew-vvps-track > .cew-vvps-card:not(.cew-vvps-clone):nth-child(12) { animation-delay: 0.6s; }

@keyframes cew-vvps-card-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: var(--cew-inactive-opacity, 0.5);
        transform: translateY(0) scale(0.82);
    }
}

.cew-vvps-widget .cew-vvps-card.is-active {
    animation: none;
}

/* ══════════════════════════════════════════════════════════════════════
 *  Accessibility
 * ══════════════════════════════════════════════════════════════════════ */

.cew-vvps-widget:focus-visible {
    outline: 2px solid #0073e6;
    outline-offset: 4px;
    border-radius: 8px;
}

.cew-vvps-arrow:focus-visible {
    outline: 2px solid #0073e6;
    outline-offset: 2px;
}

.cew-vvps-play-btn:focus-visible {
    outline: 2px solid #0073e6;
    outline-offset: 2px;
    opacity: 1 !important;
}
