.woocommerce-product-gallery.lvp-has-video {
    position: relative;
}

/*
 * 1.4.4 instant startup shell. WooCommerce deliberately keeps its classic
 * gallery transparent while FlexSlider initializes. For video-enabled products
 * we paint the featured-image poster immediately and reserve the correct main
 * media ratio, so the customer never waits on a blank gallery area. The native
 * gallery is still present and initializes normally underneath.
 */
.woocommerce-product-gallery.lvp-has-video:not(.lvp-enhanced):not(.lvp-startup-fallback) {
    opacity: 1 !important;
    aspect-ratio: var(--lvp-gallery-aspect, 1 / 1);
    overflow: hidden;
    background-color: #000;
    background-image: var(--lvp-poster-image, none);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.woocommerce-product-gallery.lvp-has-video:not(.lvp-enhanced):not(.lvp-startup-fallback) > * {
    visibility: hidden !important;
}

.woocommerce-product-gallery.lvp-has-video:not(.lvp-enhanced):not(.lvp-startup-fallback)::after {
    content: "▶";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    box-sizing: border-box;
    padding-left: 5px;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, 0.68);
    font-size: 30px;
    line-height: 1;
    pointer-events: none;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    aspect-ratio: var(--lvp-gallery-aspect, 1 / 1);
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

.woocommerce-product-gallery.lvp-has-video .lvp-product-video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: 0;
    background: #000;
}

.woocommerce-product-gallery.lvp-video-active .woocommerce-product-gallery__trigger {
    display: none !important;
}

.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-video-thumb,
.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-image-thumb-fallback {
    box-sizing: border-box;
}

.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-video-thumb button,
.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-image-thumb-fallback button {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-video-thumb img,
.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-image-thumb-fallback img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-video-thumb.lvp-active img {
    opacity: 1;
}

.woocommerce-product-gallery.lvp-has-video .lvp-generated-thumbs {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
}

.woocommerce-product-gallery.lvp-has-video .lvp-generated-thumbs li {
    width: 18%;
    max-width: 90px;
}

/* User-initiated audible playback */
.woocommerce-product-gallery.lvp-has-video .lvp-video-play-button {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.68);
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-play-button:hover,
.woocommerce-product-gallery.lvp-has-video .lvp-video-play-button:focus-visible {
    background: rgba(0, 0, 0, 0.82);
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-play-icon {
    display: block;
    width: 0;
    height: 0;
    margin-left: 5px;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    border-left: 21px solid #fff;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-play-button.lvp-is-playing {
    opacity: 0;
    pointer-events: none;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-overlay:hover .lvp-video-play-button.lvp-is-playing,
.woocommerce-product-gallery.lvp-has-video .lvp-video-overlay:focus-within .lvp-video-play-button.lvp-is-playing {
    opacity: 0;
}

@media (max-width: 600px) {
    .woocommerce-product-gallery.lvp-has-video:not(.lvp-enhanced):not(.lvp-startup-fallback)::after {
        width: 60px;
        height: 60px;
        font-size: 25px;
    }

    .woocommerce-product-gallery.lvp-has-video .lvp-video-play-button {
        width: 60px;
        height: 60px;
    }

    .woocommerce-product-gallery.lvp-has-video .lvp-video-play-icon {
        border-top-width: 11px;
        border-bottom-width: 11px;
        border-left-width: 18px;
    }
}

/* 1.4.5: show the product's featured thumbnail behind the VIDEO play badge. */
.woocommerce-product-gallery.lvp-has-video .flex-control-thumbs .lvp-video-thumb button {
    position: relative;
    overflow: hidden;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-thumb-media {
    position: relative;
    display: block;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-thumb-media img {
    display: block;
    width: 100%;
    height: auto;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-thumb-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 42%;
    aspect-ratio: 1 / 1;
    max-width: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.72);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-thumb-play::after {
    content: "";
    position: absolute;
    left: 54%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 11px solid #fff;
}

.woocommerce-product-gallery.lvp-has-video .lvp-video-thumb-label {
    display: block;
    margin-top: 3px;
    color: #333;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
}
