/* =============================================
   WooCommerce Category Video Tile - Frontend
   Compatible with Kadence theme
   ============================================= */

/* ======================
   CATEGORY TILES
   ====================== */

.wcvt-tile {
    position: relative;
    overflow: hidden;
    width: 100%;
    background: #f5f5f5;
    display: block;
}

.wcvt-tile .wcvt-video {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Poster (hover mode) */
.wcvt-tile .wcvt-poster {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    transition: opacity 0.4s ease;
}
.wcvt-tile.wcvt-playing .wcvt-poster {
    opacity: 0;
    pointer-events: none;
}

/* Overlay title */
.wcvt-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 12px 16px;
    background: linear-gradient(0deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    text-align: center;
    pointer-events: none;
}
.wcvt-overlay-bottom .wcvt-title-overlay { bottom: 0; }
.wcvt-overlay-center .wcvt-title-overlay {
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 16px 20px;
}
.wcvt-title-text {
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.wcvt-title-count {
    font-size: 0.85em;
    opacity: 0.8;
    font-weight: 400;
}

/* Kadence: hide default title when overlay */
.product-category:has(.wcvt-has-overlay) .product-details,
.product-category:has(.wcvt-has-overlay) .entry-content-wrap {
    display: none !important;
}

.product-category .wcvt-tile {
    border-radius: inherit;
}

/* Hover zoom on category tiles */
.wcvt-tile .wcvt-video {
    transition: transform 0.6s ease;
}
.product-category:hover .wcvt-tile .wcvt-video {
    transform: scale(1.03);
}

.wcvt-tile[data-play-mode="hover"] {
    cursor: pointer;
}


/* ======================
   PRODUCT TILES
   ======================
   Kadence structure (actual):
   .product > a.woocommerce-loop-image-link > img + video.wcvt-product-video + img.secondary-product-image
   No wrapper div — everything directly inside <a>.
*/

/* Make the <a> link a positioning container with proper clipping */
.wcvt-has-product-video > a.woocommerce-loop-image-link {
    position: relative;
    overflow: hidden;
    display: block;
    z-index: 0; /* new stacking context so video doesn't bleed over text below */
}

/* Position video absolutely over the main image */
.wcvt-has-product-video .wcvt-product-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #f5f5f5;
}

/* ── HOVER MODE: Slide-in from right (matching Kadence's image swap) ── */
.wcvt-has-product-video .wcvt-product-video[data-play-mode="hover"] {
    transform: translateX(100%);
    opacity: 1;
    transition: transform 0.35s ease;
}
.wcvt-has-product-video:hover .wcvt-product-video[data-play-mode="hover"],
.wcvt-has-product-video.wcvt-touch-active .wcvt-product-video[data-play-mode="hover"] {
    transform: translateX(0);
}

/* Hide Kadence's default hover image when we have video */
.wcvt-has-product-video .secondary-product-image,
.wcvt-has-product-video .product-loop-image-hover {
    display: none !important;
}

/* ── AUTOPLAY MODE: always visible ── */
.wcvt-has-product-video .wcvt-product-video[data-play-mode="autoplay"] {
    transform: none;
    opacity: 1;
}

/* ── Ended state for no-loop hover: slide back out ── */
.wcvt-has-product-video .wcvt-product-video.wcvt-ended {
    transform: translateX(100%);
}

/* ── Touch support: simulate hover on tap ── */
.wcvt-has-product-video.wcvt-touch-active .wcvt-product-video[data-play-mode="hover"] {
    transform: translateX(0);
}


/* ======================
   SINGLE PRODUCT GALLERY VIDEO (Kadence Splide)
   ====================== */

/* Main video slide */
.wcvt-gallery-video-slide {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wcvt-gallery-video-slide .wcvt-gallery-video {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Thumbnail placeholder when no poster */
.wcvt-thumb-play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #222;
    color: #fff;
    font-size: 28px;
}

/* Ensure thumbnail slide matches others */
.wcvt-gallery-thumb-slide {
    overflow: hidden;
}
.wcvt-gallery-thumb-slide img {
    display: block;
}


/* ======================
   RESPONSIVE
   ====================== */

@media (max-width: 767px) {
    .wcvt-title-text { font-size: 0.95em; }
    .wcvt-title-overlay { padding: 8px 12px; }
}
