/**
 * Video Gallery Styles
 *
 * Styles for product video thumbnails in FlexSlider navigation
 * and embedded video player in main product image area
 */

/* ==========================================================================
   Video Thumbnail in Flex Control Thumbs Navigation
   ========================================================================== */

/* The list item containing our video thumbnail */
.flex-control-thumbs .ecml-video-thumb-item {
    cursor: pointer;
}

/* Video thumbnail wrapper */
.ecml-video-thumbnail {
    position: relative;
    display: block;
    overflow: hidden;
}

.ecml-video-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.ecml-video-thumbnail:hover img {
    opacity: 0.8;
}

/* Play Icon Overlay */
.ecml-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    transition: background 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.ecml-video-play-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
}

.ecml-video-thumbnail:hover .ecml-video-play-icon {
    background: rgba(255, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Active state when video is playing */
.ecml-video-thumbnail.ecml-video-active {
    outline: 2px solid #0071a1;
    outline-offset: -2px;
}

.ecml-video-thumbnail.ecml-video-active .ecml-video-play-icon {
    background: rgba(255, 0, 0, 0.9);
}

/* ==========================================================================
   Video Player in Main Image Container
   ========================================================================== */

/* When video is playing, adjust the main image container */
.woocommerce-product-gallery__image.ecml-video-playing {
    overflow: visible;
}

/* Video Wrapper - maintains 16:9 aspect ratio */
.ecml-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

/* The iframe fills the wrapper */
.ecml-video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Close Button */
.ecml-video-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
    padding: 0;
}

.ecml-video-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.ecml-video-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .ecml-video-play-icon {
        width: 35px;
        height: 35px;
    }

    .ecml-video-play-icon::before {
        border-width: 7px 0 7px 12px;
    }

    .ecml-video-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        line-height: 28px;
    }
}

@media (max-width: 480px) {
    .ecml-video-play-icon {
        width: 30px;
        height: 30px;
    }

    .ecml-video-play-icon::before {
        border-width: 6px 0 6px 10px;
    }
}

/* ==========================================================================
   Hide the old PHP-rendered thumbnail (if any exists from hook)
   ========================================================================== */

/* Hide any video thumbnail that got rendered inside the main gallery wrapper */
.woocommerce-product-gallery__wrapper > .ecml-video-thumbnail {
    display: none !important;
}
