/* Video play button base styles */
.video-play-overlay,
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    transition: all 0.3s ease;
    pointer-events: auto;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    padding-left: 3px;
}

.video-play-overlay:hover,
.video-play-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}


/* Specific sizes for different contexts */
.product-thumbnails .video-play-overlay,
.product-thumbnails .video-play-button {
    font-size: 16px;
    width: 32px;
    height: 32px;
    padding-left: 2px;
}

.product-gallery-slider .video-play-overlay,
.product-gallery-slider .video-play-button {
    font-size: 32px;
    width: 60px;
    height: 60px;
    padding-left: 4px;
}

/* Never show video button on first/main image */
.product-thumbnails .col.first .video-play-overlay,
.product-gallery-slider .slide.first .video-play-overlay,
.product-thumbnails .col.first .video-play-button,
.product-gallery-slider .slide.first .video-play-button,
.product-thumbnails .col.first span[class*="video"],
.product-gallery-slider .slide.first span[class*="video"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.video-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.video-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    width: 360px;
    backdrop-filter: blur(2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.video-modal-content:not(.horizontal) {
    width: 360px;
    max-width: 90vw;
}

.video-modal-content.horizontal {
    max-width: 800px;
    width: 800px;
}

.video-modal .close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.video-modal .close:hover,
.video-modal .close:focus {
    background: rgba(0, 0, 0, 0.8);
}

.video-modal iframe,
.video-modal video {
    width: 100%;
    border-radius: 4px;
}

.video-modal-content:not(.horizontal) iframe,
.video-modal-content:not(.horizontal) video {
    height: 720px;
    max-height: 80vh;
}

.video-modal-content.horizontal iframe,
.video-modal-content.horizontal video {
    height: 400px;
}

@media (max-width: 768px) {
    .video-modal-content {
        width: 95%;
        height: 90vh;
        padding: 10px;
        max-width: 95%;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .video-modal-content.horizontal {
        width: 95%;
        height: 90vh;
        max-width: 95%;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .video-modal-content:not(.horizontal) {
        width: 95%;
        max-width: 95%;
    }
    
    .video-modal iframe,
    .video-modal video {
        height: auto;
        max-height: 70vh;
        min-height: 300px;
        margin: auto;
    }
    
    .video-modal iframe.horizontal,
    .video-modal video.horizontal {
        height: auto;
        max-height: 50vh;
        min-height: 200px;
        margin: auto;
    }
}

.woocommerce div.product div.images .woocommerce-product-gallery__image.product-video-thumbnail {
    width: calc(25% - 1em);
    margin-right: 1em;
    margin-bottom: 1em;
}

@media (max-width: 768px) {
    .woocommerce div.product div.images .woocommerce-product-gallery__image.product-video-thumbnail {
        width: calc(50% - 0.5em);
        margin-right: 0.5em;
        margin-bottom: 0.5em;
    }
}