/* ============================================================
   Product Video Gallery
   inc/product-video-gallery/product-video-gallery.css
   Version: 1.0.3
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
.pvg-gallery {
    --pvg-thumb-size: 80px;
    --pvg-gap: 8px;
    --pvg-radius: 6px;
    width: 100%;
    user-select: none;
    font-family: inherit;
}

/* ── Stage ─────────────────────────────────────────────────── */
.pvg-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    border-radius: var(--pvg-radius);
    overflow: hidden;
    margin-bottom: var(--pvg-gap);
}

.pvg-slide {
    display: none;
}

/* Both slide types fill the stage identically when active */
.pvg-slide.pvg-active {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Image Slide ───────────────────────────────────────────── */
.pvg-slide--image a.pvg-lightbox-trigger {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.pvg-slide--image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ── Video Slide ───────────────────────────────────────────── */
.pvg-slide--video {
    display: none;
}

.pvg-slide--video.pvg-active {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.pvg-cover {
    position: relative;
    display: flex;
    width: 100% !important;
    height: 100% !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

/* Dark overlay on top of cover image */
.pvg-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    transition: background 0.2s;
    z-index: 1;
}

.pvg-cover:hover::after {
    background: rgba(0, 0, 0, 0.32);
}

/* Cover image fills the stage fully */
.pvg-cover-img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    z-index: 0;
}

/* Play button sits above overlay */
.pvg-play-btn {
    position: relative;
    z-index: 2;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 68px;
    height: 48px;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.9;
}

.pvg-play-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

.pvg-play-btn svg {
    width: 68px;
    height: 48px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

/* ── Thumbnail Strip ───────────────────────────────────────── */
.pvg-thumbs {
    display: flex;
    gap: var(--pvg-gap);
    flex-wrap: wrap;
}

.pvg-thumb {
    flex: 0 0 var(--pvg-thumb-size);
    width: var(--pvg-thumb-size);
    height: var(--pvg-thumb-size);
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--pvg-radius);
    overflow: hidden;
    cursor: pointer;
    background: #eeeeee;
    position: relative;
    transition: border-color 0.15s;
}

.pvg-thumb:hover {
    border-color: #bbbbbb;
}

.pvg-thumb.pvg-active {
    border-color: #111111;
}

.pvg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pvg-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.38);
}

.pvg-thumb-play svg {
    width: 16px;
    height: 16px;
}

/* ── YouTube Popup ─────────────────────────────────────────── */
.pvg-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.pvg-popup[aria-hidden="false"] {
    display: flex;
}

.pvg-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

.pvg-popup-inner {
    position: relative;
    z-index: 1;
    width: min(90vw, 960px);
    animation: pvgFadeIn 0.2s ease;
}

.pvg-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.pvg-popup-close:hover {
    opacity: 1;
}

.pvg-popup-frame {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
    background: #000000;
    border-radius: 4px;
    overflow: hidden;
}

.pvg-popup-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* ── Lightbox ──────────────────────────────────────────────── */
.pvg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.pvg-lightbox[aria-hidden="false"] {
    display: flex;
}

.pvg-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.pvg-lightbox-inner {
    position: relative;
    z-index: 1;
    animation: pvgFadeIn 0.2s ease;
}

.pvg-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.pvg-lightbox-close:hover {
    opacity: 1;
}

#pvg-lightbox-img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

/* ── Animation ─────────────────────────────────────────────── */
@keyframes pvgFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .pvg-gallery {
        --pvg-thumb-size: 60px;
    }
}