/**
 * Frontend Video Player Styles
 * 
 * Styles for video player on product pages. Designed to match Avanam theme.
 * 
 * @package PG_Video_Gallery
 * @since 1.0.0
 */

/* ========================================
   GALLERY VIDEO SLIDES
   ======================================== */

/* Main video slide in Splide gallery */
.pg-video-main-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.pg-video-main-slide .pg-video-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Video thumbnail slide */
.pg-video-thumb-slide {
    position: relative;
    cursor: pointer;
}

.pg-video-thumb-slide .pg-video-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pg-video-thumb-slide .pg-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
}

.pg-video-thumb-slide:hover .pg-video-play-icon svg {
    transform: scale(1.1);
}

.pg-video-thumb-slide .pg-video-play-icon svg {
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ========================================
   VIDEO PLAYER WRAPPER
   ======================================== */

/* Video Thumbnails Wrapper */
.pg-video-thumbnails-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

/* Video Player Wrapper */
.pg-video-player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.pg-video-player {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    max-height: 700px;
}

/* Play Overlay */
.pg-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 1;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 10;
}

.pg-video-play-overlay.is-playing {
    opacity: 0;
    pointer-events: none;
}

.pg-video-play-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pg-video-play-button:hover {
    transform: scale(1.1);
}

.pg-video-play-button svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

/* Video Thumbnail in Gallery */
.pg-video-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    overflow: hidden;
}

.pg-video-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pg-video-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.pg-video-thumbnail:hover .pg-video-thumbnail-overlay {
    background: rgba(0, 0, 0, 0.2);
}

.pg-video-thumbnail-play-icon {
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.pg-video-thumbnail:hover .pg-video-thumbnail-play-icon {
    transform: scale(1.15);
}

/* WooCommerce Gallery Integration */
.woocommerce-product-gallery .pg-video-thumbnail {
    border-radius: 4px;
}

.woocommerce-product-gallery__image .pg-video-thumbnail {
    height: 100%;
}

/* Video Modal/Lightbox */
.pg-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pg-video-modal.is-open {
    display: flex;
}

.pg-video-modal-content {
    position: relative;
    max-width: 1200px;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.pg-video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.pg-video-modal-close:hover {
    opacity: 0.7;
}

/* Responsive Video Container */
.pg-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    background: #000;
}

.pg-video-container .pg-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Hide video players by default (shown in modal) */
.pg-video-modal .pg-video-player-wrapper {
    display: block;
}

/* Show video player inside gallery slides */
.pg-video-main-slide .pg-video-player-wrapper,
.splide__slide .pg-video-player-wrapper {
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .pg-video-modal {
        padding: 10px;
    }

    .pg-video-modal-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 50%;
    }

    .pg-video-play-button svg {
        width: 48px;
        height: 48px;
    }

    .pg-video-thumbnail-play-icon {
        width: 36px;
        height: 36px;
    }
}

/* Loading State */
.pg-video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
}

.pg-video-loading::after {
    content: "...";
    animation: pg-loading-dots 1.5s infinite;
}

@keyframes pg-loading-dots {

    0%,
    20% {
        content: ".";
    }

    40% {
        content: "..";
    }

    60%,
    100% {
        content: "...";
    }
}

/* Fullscreen Support */
.pg-video-player:-webkit-full-screen {
    width: 100%;
    height: 100%;
}

.pg-video-player:-moz-full-screen {
    width: 100%;
    height: 100%;
}

.pg-video-player:fullscreen {
    width: 100%;
    height: 100%;
}