/**
 * Product Video Carousel - Frontend Styles
 */

/* Wrapper */
.pvc-video-carousel-wrapper {
    margin: 25px 0 20px;
    width: 100%;
    position: relative;
    clear: both;
}

/* Carousel Container */
.pvc-video-carousel {
    width: 100%;
    overflow: hidden;
    padding: 10px 0;
}

.pvc-video-carousel .swiper-wrapper {
    align-items: stretch;
    transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* Smooth slide transitions */
.pvc-video-slide {
    transition: transform 0.3s ease;
}

/* Slide */
.pvc-video-slide {
    width: auto !important;
    flex-shrink: 0;
    height: auto;
}

.swiper-slide {
    width: auto !important;
}

/* Video Container */
.pvc-video-container {
    position: relative;
    width: 200px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

/* Thumbnail */
.pvc-video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
    z-index: 1;
    position: relative;
}

.pvc-video-container:hover .pvc-video-thumbnail {
    transform: scale(1.05);
}

.pvc-video-container.pvc-playing .pvc-video-thumbnail,
.pvc-video-container.pvc-playing .pvc-video-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* Video Placeholder (no thumbnail) */
.pvc-video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
    z-index: 1;
    position: relative;
}

.pvc-video-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

.pvc-video-placeholder svg {
    width: 30px;
    height: 30px;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 2;
    margin-left: 4px;
}

.pvc-video-container:hover .pvc-video-placeholder {
    transform: scale(1.02);
}

.pvc-video-container:hover .pvc-video-placeholder::before {
    background: rgba(255, 255, 255, 0.25);
}



/* Play Button */
.pvc-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
    padding: 0;
    pointer-events: auto;
}

.pvc-play-button svg {
    width: 24px;
    height: 24px;
    margin-left: 3px;
    color: #1a1a1a;
}

.pvc-video-container:hover .pvc-play-button {
    transform: translate(-50%, -50%) scale(1.1);
    background: #fff;
}

.pvc-video-container.pvc-playing .pvc-play-button {
    opacity: 0;
    pointer-events: none;
}

/* Video Player */
.pvc-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pvc-video-container.pvc-playing .pvc-video-player {
    opacity: 1;
    pointer-events: auto;
}

/* Expand icon hint when video is playing */
.pvc-video-container.pvc-playing::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    z-index: 6;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z'/%3E%3C/svg%3E");
    background-size: 18px 18px;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pvc-video-container.pvc-playing:hover::after {
    opacity: 1;
}

/* Auto-generated thumbnail */
.pvc-auto-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
}

/* Video Title */
.pvc-video-title {
    margin: 8px 0 0;
    padding: 0 5px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Navigation Buttons */
.pvc-nav-prev,
.pvc-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.pvc-nav-prev {
    left: 0;
}

.pvc-nav-next {
    right: 0;
}

.pvc-nav-prev:hover,
.pvc-nav-next:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pvc-nav-prev::after,
.pvc-nav-next::after {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.pvc-nav-prev.swiper-button-disabled,
.pvc-nav-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .pvc-video-container {
        width: 180px;
        height: 135px;
    }

    .pvc-video-title {
        max-width: 180px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .pvc-video-carousel-wrapper {
        margin: 15px 0;
    }

    .pvc-video-container {
        width: 160px;
        height: 120px;
        border-radius: 10px;
    }

    .pvc-video-title {
        max-width: 160px;
        font-size: 12px;
    }

    .pvc-play-button {
        width: 44px;
        height: 44px;
    }

    .pvc-play-button svg {
        width: 20px;
        height: 20px;
    }

    .pvc-nav-prev,
    .pvc-nav-next {
        width: 32px;
        height: 32px;
    }

    .pvc-nav-prev::after,
    .pvc-nav-next::after {
        font-size: 12px;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .pvc-video-container {
        width: 140px;
        height: 105px;
        border-radius: 8px;
    }

    .pvc-video-title {
        max-width: 140px;
        font-size: 11px;
    }

    .pvc-play-button {
        width: 40px;
        height: 40px;
    }

    .pvc-play-button svg {
        width: 18px;
        height: 18px;
    }

    .pvc-nav-prev,
    .pvc-nav-next {
        width: 28px;
        height: 28px;
    }

    .pvc-nav-prev::after,
    .pvc-nav-next::after {
        font-size: 10px;
    }
}

/* Loading State */
.pvc-video-container.pvc-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pvc-spin 0.8s linear infinite;
    z-index: 3;
}

.pvc-video-container.pvc-loading .pvc-play-button {
    opacity: 0;
}

@keyframes pvc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Video Controls Override */
.pvc-video-player::-webkit-media-controls {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pvc-video-container:hover .pvc-video-player::-webkit-media-controls {
    opacity: 1;
}

/* Prevent WooCommerce lightbox interference */
.pvc-video-carousel-wrapper {
    pointer-events: auto;
}

.pvc-video-carousel-wrapper a,
.pvc-video-carousel-wrapper .woocommerce-product-gallery__trigger {
    display: none !important;
}

.pvc-video-slide {
    cursor: pointer;
}

.pvc-video-container {
    pointer-events: auto;
}

/* Custom Lightbox Styles */
.pvc-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pvc-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
}

.pvc-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
}

.pvc-lightbox-video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    background: #000;
}

.pvc-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pvc-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.pvc-lightbox-prev,
.pvc-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pvc-lightbox-prev {
    left: 20px;
}

.pvc-lightbox-next {
    right: 20px;
}

.pvc-lightbox-prev:hover,
.pvc-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
    .pvc-lightbox-prev,
    .pvc-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .pvc-lightbox-prev {
        left: 10px;
    }

    .pvc-lightbox-next {
        right: 10px;
    }

    .pvc-lightbox-close {
        top: -35px;
        width: 32px;
        height: 32px;
        font-size: 24px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .pvc-video-title {
        color: #e0e0e0;
    }

    .pvc-nav-prev,
    .pvc-nav-next {
        background: #2a2a2a;
    }

    .pvc-nav-prev:hover,
    .pvc-nav-next:hover {
        background: #3a3a3a;
    }

    .pvc-nav-prev::after,
    .pvc-nav-next::after {
        color: #fff;
    }
}
