/* ================================================
   WC Gallery Video — Frontend Styles
   ================================================ */

/* ---- Gallery thumbnail ---- */
.wcgv-gallery-thumb {
    display: inline-block;
    cursor: pointer;
    margin: 0;
    padding: 0;
    /* Sit inline with WC's flex-control-thumbs */
    vertical-align: top;
}

.wcgv-thumb-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 3px;
    background: #111;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.wcgv-gallery-thumb:hover .wcgv-thumb-inner,
.wcgv-gallery-thumb.wcgv-active .wcgv-thumb-inner {
    border-color: #a46497; /* WC default purple accent — overrides fine */
}

.wcgv-thumb-inner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* Play overlay on thumb */
.wcgv-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
}
.wcgv-play-overlay svg {
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.wcgv-gallery-thumb:hover .wcgv-play-overlay svg circle {
    fill: rgba(0,0,0,0.72);
}

/* Make the thumb match WC thumbnail dimensions */
.flex-control-thumbs .wcgv-gallery-thumb,
.woocommerce-product-gallery .wcgv-gallery-thumb {
    width: calc(25% - 4px); /* match WC default 4-column thumb grid */
}

/* ---- Modal ---- */
.wcgv-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}
.wcgv-modal.wcgv-open {
    display: flex;
}

body.wcgv-modal-active {
    overflow: hidden;
}

.wcgv-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    cursor: pointer;
}

.wcgv-modal-content {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 900px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    animation: wcgv-fadein 0.2s ease;
}

@keyframes wcgv-fadein {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

#wcgv-modal-video {
    display: block;
    width: 100%;
    max-height: 80vh;
    outline: none;
    background: #000;
}

.wcgv-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 18px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}
.wcgv-modal-close:hover {
    background: rgba(255,255,255,0.2);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .flex-control-thumbs .wcgv-gallery-thumb,
    .woocommerce-product-gallery .wcgv-gallery-thumb {
        width: calc(33.33% - 4px);
    }
    .wcgv-modal-content { width: 96vw; }
}
