/**
 * WooCommerce Product Gallery Video - Modal Styles
 * Supports Flexslider and Slick Slider
 */

/* Video thumbnail styling */
.wcpvg-video-thumb {
    border: none;
    cursor: pointer !important;
    transition: border-color 0.3s ease;
}

.wcpvg-video-thumb:hover {
    border-color: #2a70c2 !important;
}

/* Pure CSS Play Button Icon */
.wcpvg-video-play-icon {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 55px !important;
    height: 55px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: 999 !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* CSS Triangle Play Button */
.wcpvg-video-play-icon::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 16px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 3px;
}

/* Ensure parent containers are positioned */
.flex-control-thumbs li,
.woocommerce-product-gallery__image,
#wpgis-gallery .slick-slide li,
#wpgis-gallery li {
    position: relative !important;
}

/* Hover effect */
.flex-control-thumbs li:hover .wcpvg-video-play-icon,
.woocommerce-product-gallery__image:hover .wcpvg-video-play-icon,
.wcpvg-has-video:hover .wcpvg-video-play-icon,
#wpgis-gallery .slick-slide:hover .wcpvg-video-play-icon {
    background: rgba(255, 59, 48, 0.9) !important;
    transform: translate(-50%, -50%) scale(1.15) !important;
}

/* Modal/Popup Styles - Responsive and Screen-Fitted */
.wcpvg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wcpvg-fade-in 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    overflow: auto;
}

@keyframes wcpvg-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wcpvg-modal-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    background: #000;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: wcpvg-slide-up 0.3s ease;
    overflow: hidden;
}

@keyframes wcpvg-slide-up {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.wcpvg-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 45px;
    height: 45px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    font-weight: 300;
}

.wcpvg-modal-close:hover {
    background: #ff3b30;
    color: #fff;
    transform: rotate(90deg) scale(1.1);
}

.wcpvg-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Video container with 16:9 aspect ratio */
.wcpvg-modal-content video {
    width: 100%;
    height: auto;
    max-height: 85vh;
    display: block;
    object-fit: contain;
}

/* iframe container with responsive sizing */
.wcpvg-modal-content iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 85vh;
    border: none;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .wcpvg-modal-overlay {
        padding: 15px;
    }
    
    .wcpvg-modal-container {
        max-height: 85vh;
    }
    
    .wcpvg-modal-content video,
    .wcpvg-modal-content iframe {
        max-height: 80vh;
    }
}

@media (max-width: 768px) {
    .wcpvg-modal-overlay {
        padding: 10px;
    }
    
    .wcpvg-modal-container {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 6px;
    }
    
    .wcpvg-modal-content video,
    .wcpvg-modal-content iframe {
        max-height: 75vh;
    }
    
    .wcpvg-modal-close {
        top: -10px;
        right: -10px;
        width: 38px;
        height: 38px;
        font-size: 26px;
    }
    
    /* Play button smaller on mobile */
    .wcpvg-video-play-icon {
        width: 45px !important;
        height: 45px !important;
    }
    
    .wcpvg-video-play-icon::before {
        border-width: 8px 0 8px 13px;
    }
}

@media (max-width: 480px) {
    .wcpvg-modal-overlay {
        padding: 5px;
    }
    
    .wcpvg-modal-content video,
    .wcpvg-modal-content iframe {
        max-height: 70vh;
    }
    
    /* Even smaller play button on very small screens */
    .wcpvg-video-play-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    .wcpvg-video-play-icon::before {
        border-width: 7px 0 7px 11px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .wcpvg-modal-container {
        max-height: 95vh;
    }
    
    .wcpvg-modal-content video,
    .wcpvg-modal-content iframe {
        max-height: 90vh;
    }
    
    .wcpvg-modal-close {
        top: 5px;
        right: 5px;
    }
}
