/**
 * Product Video Gallery
 *
 * Styles for YouTube video slides injected into the WooCommerce product gallery.
 */

.kx-video-slide {
    position: relative;
}

.kx-product-video {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    margin: 0;
    background: #000;
    cursor: pointer;
    line-height: 0;
    overflow: hidden;
}

.kx-product-video img {
    display: block;
    width: 100%;
    height: auto;
    /* YouTube posters are 4:3 with letterboxing; crop to a clean 16:9 face */
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.kx-product-video:hover img {
    opacity: 0.85;
}

/* Play button overlay */
.kx-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.65);
    transition: background 0.2s ease;
    pointer-events: none;
}

.kx-product-video:hover .kx-video-play {
    background: #cc0000;
}

.kx-video-play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 11px 0 11px 19px;
    border-color: transparent transparent transparent #fff;
}

/* -------------------------------------------------------------------------
   Flexslider thumbnail navigation
   YouTube posters are 16:9 while product thumbnails are square, which left the
   video thumb top-aligned in its cell. Normalize every nav thumb to a centered
   square crop so the strip is uniform.
   ------------------------------------------------------------------------- */
.woocommerce-product-gallery .flex-control-thumbs li img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 100%;
    height: auto;
}

/* Play badge on video thumbnails (class added by JS once flexslider builds nav) */
.woocommerce-product-gallery .flex-control-thumbs li.kx-video-thumb {
    position: relative;
}

.woocommerce-product-gallery .flex-control-thumbs li.kx-video-thumb::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.woocommerce-product-gallery .flex-control-thumbs li.kx-video-thumb::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
    pointer-events: none;
}

/* Inline embed after click */
.kx-video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.kx-video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
