/*
 * Proliana Video Carousel — frontend styles (V2.7)
 * Fully driven by CSS variables injected from the settings page.
 */

.pvc-carousel {
    /* Defaults — overridden by inline <style> from the shortcode */
    --pvc-accent: #2e2a39;
    --pvc-video-aspect: 9 / 16;
    --pvc-slide-radius: 10px;
    --pvc-carousel-max-width: 1200px;
    /* V2.7.1: constrain container so slide width (and therefore aspect-ratio'd height)
       is consistent across product pages regardless of the parent Elementor layout. */
    max-width: var(--pvc-carousel-max-width);
    margin-left: auto;
    margin-right: auto;
    --pvc-slide-bg: #111111;
    --pvc-mute-bg: #2d2a38;
    --pvc-mute-icon: #ffffff;
    --pvc-seek-fill: #ff4b2b;
    --pvc-seek-bg: #444444;
    --pvc-arrows-bg: rgba(0, 0, 0, 0.5);
    --pvc-arrows-icon: #ffffff;
    --pvc-heading-color: inherit;
    --pvc-body-color: inherit;
    --pvc-pulse-color: rgba(193, 244, 246, 0.7);
    --pvc-heading-size-mobile: 1.6rem;
    --pvc-heading-size-desktop: 2.2rem;
    --pvc-heading-weight: 700;
    --pvc-heading-align: center;
    --pvc-body-size: 1rem;
    --pvc-body-line-height: 1.5;
    --pvc-pulse-duration: 1200ms;
    --pvc-transition-speed: 300ms;
    --pvc-transition-easing: ease;
}

/* Swiper container */
.pvc-carousel .swiper-container {
    position: relative;
    width: 100%;
    padding: 0 0 50px 0;
    z-index: 1;
    overflow-x: hidden;
}

.pvc-carousel .swiper-slide {
    position: relative;
    width: 200px;
    border-radius: var(--pvc-slide-radius);
    overflow: hidden;
    background: var(--pvc-slide-bg);
}

.pvc-carousel .pvc-video,
.pvc-carousel .pvc-embed {
    width: 100%;
    aspect-ratio: var(--pvc-video-aspect);
    max-height: 70vh;
    border-radius: var(--pvc-slide-radius);
    display: block;
    overflow: hidden;
    position: relative;
}

.pvc-carousel .pvc-video {
    object-fit: cover;
    background: var(--pvc-slide-bg);
}

/* Embed iframes (YouTube/Vimeo) */
.pvc-carousel .pvc-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: var(--pvc-slide-bg);
}
.pvc-carousel .pvc-embed-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.pvc-carousel .pvc-embed.pvc-embed-loaded .pvc-embed-poster,
.pvc-carousel .pvc-embed.pvc-embed-loaded .pvc-embed-play {
    display: none;
}

/* Heading */
.pvc-carousel .pvc-heading {
    text-align: var(--pvc-heading-align);
    margin-bottom: 30px;
    color: var(--pvc-heading-color);
}
.pvc-carousel .pvc-heading.pvc-heading-below {
    margin-top: 30px;
    margin-bottom: 0;
}
.pvc-carousel .pvc-heading h2 {
    font-size: var(--pvc-heading-size-desktop);
    font-weight: var(--pvc-heading-weight);
    margin-bottom: 0.5rem;
    color: inherit;
}
.pvc-carousel .pvc-heading p {
    margin: 0.25rem 0;
    color: var(--pvc-body-color);
    font-size: var(--pvc-body-size);
    line-height: var(--pvc-body-line-height);
}
.pvc-carousel .pvc-overlay-heading {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 5;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
}
.pvc-carousel .pvc-overlay-heading .pvc-heading {
    text-align: left;
    margin: 0;
}
.pvc-carousel .pvc-overlay-heading .pvc-heading h2 {
    font-size: 1rem;
    margin: 0;
}

/* Swiper navigation arrows */
.pvc-carousel .swiper-button-prev,
.pvc-carousel .swiper-button-next {
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: var(--pvc-arrows-bg);
    border-radius: 50%;
    color: var(--pvc-arrows-icon);
    z-index: 2;
}
.pvc-carousel .swiper-button-prev::after {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z' fill='white'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-left: -2px;
}
.pvc-carousel .swiper-button-next::after {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z' fill='white'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: -2px;
}

.pvc-carousel .swiper-pagination-bullet-active {
    background: grey;
}

/* Central play button */
.pvc-carousel .pvc-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    color: white;
    cursor: pointer;
    z-index: 15;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 100%;
    background: var(--pvc-accent);
    transition: all var(--pvc-transition-speed) var(--pvc-transition-easing) 0s;
    box-shadow: var(--pvc-pulse-color) 0 0 0 0;
    animation: pvc-pulse var(--pvc-pulse-duration) cubic-bezier(0.8, 0, 0, 1) 0s infinite normal none running;
    border: 0;
    padding: 0;
}

@keyframes pvc-pulse {
    100% { box-shadow: 0 0 0 45px transparent; }
}

.pvc-carousel .pvc-play-btn.hide,
.pvc-carousel .pvc-play-btn[data-permanently-hidden="true"] {
    display: none;
}

/* Mute button */
.pvc-carousel .pvc-mute-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--pvc-mute-bg);
    border: none;
    color: var(--pvc-mute-icon);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 12;
    padding: 0;
}
.pvc-carousel .pvc-mute-btn[data-muted="true"] .pvc-svg-unmute { display: none; }
.pvc-carousel .pvc-mute-btn[data-muted="false"] .pvc-svg-mute { display: none; }

.pvc-carousel .pvc-icon {
    pointer-events: none;
    fill: currentColor;
    display: block;
}

/* Seek bar */
.pvc-carousel .pvc-seek-bar {
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    width: 70%;
    margin: 0 auto 10px;
    height: 4px;
    border-radius: 2px;
    background: var(--pvc-seek-bg);
    cursor: pointer;
    display: none;
    z-index: 11;
}
.pvc-carousel .pvc-seek-bar.show {
    display: block;
}
.pvc-carousel .swiper-slide:hover .pvc-seek-bar {
    display: block;
}
.pvc-carousel .pvc-seek-bar::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--pvc-seek-fill) 0%, var(--pvc-seek-fill) var(--seek-before-width, 0%), var(--pvc-seek-bg) var(--seek-before-width, 0%), var(--pvc-seek-bg) 100%);
}
.pvc-carousel .pvc-seek-bar::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: var(--pvc-seek-bg);
}
.pvc-carousel .pvc-seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: black;
    cursor: pointer;
    margin-top: -4px;
}
.pvc-carousel .pvc-seek-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--pvc-seek-fill);
    cursor: pointer;
}

/* CTA overlay */
.pvc-carousel .pvc-cta-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 13;
    pointer-events: none;
}
.pvc-carousel .pvc-cta-overlay span {
    display: inline-block;
    padding: 6px 12px;
    background: var(--pvc-accent);
    color: #fff;
    font-weight: 600;
    border-radius: 999px;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Focus styles for keyboard accessibility */
.pvc-carousel .pvc-play-btn:focus-visible,
.pvc-carousel .pvc-mute-btn:focus-visible,
.pvc-carousel .pvc-seek-bar:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Mobile breakpoint
 * V2.7.1: arrows visibility now controlled by `show_arrows` setting only, not by viewport size.
 * The admin can decide to hide them on mobile via the setting. */
@media (max-width: 500px) {
    .pvc-carousel .pvc-heading h2 {
        font-size: var(--pvc-heading-size-mobile);
    }
    .pvc-carousel .pvc-seek-bar {
        display: block;
        height: 6px;
    }
    .pvc-carousel .pvc-seek-bar::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
        margin-top: -6px;
    }
    .pvc-carousel .pvc-seek-bar::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }
}

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
    .pvc-carousel[data-respect-reduced-motion="true"] .pvc-play-btn {
        animation: none;
        transition: none;
    }
    .pvc-carousel[data-respect-reduced-motion="true"] * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
