/* Product Video Gallery VCD-WAT Frontend Styles - Fixed Version */

.pvg-vcd-wat-main-nav {
    display: none;
}

/* Smooth transitions cho main image container */
.single-product-main-image {
    transition: opacity 0.25s ease-in-out;
}

.single-product-main-image img {
    transition: opacity 0.25s ease-in-out;
}


/* Fix cho mobile: Hiện button navigation khi có nhiều hơn 1 item */
.pvg-vcd-wat-gallery .pvg-vcd-wat-main-nav {
    opacity: 0.7 !important;
}




/* Gallery Container - Tương thích với Flatsome */
.pvg-vcd-wat-gallery {
    position: relative;
}

.pvg-vcd-wat-gallery .woocommerce-product-gallery__wrapper {
    position: relative;
}

/* Main video/image container */
.single-product-main-image {
    position: relative;
    cursor: pointer;
    display: block;
    width: 100%;
}

.single-product-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Main image navigation arrows */
.pvg-vcd-wat-main-nav {
    padding: 0px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    z-index: 100;
    opacity: 0;
}

.single-product-main-image:hover .pvg-vcd-wat-main-nav {
    opacity: 1;
}

.pvg-vcd-wat-main-nav:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.1);
}

.pvg-vcd-wat-main-nav.prev {
    left: 15px;
}

.pvg-vcd-wat-main-nav.next {
    right: 15px;
}

/* Video specific styles */
.pvg-vcd-wat-main-video {
    position: relative;
    cursor: pointer;
    display: block;
    width: 100%;
}

.pvg-vcd-wat-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    opacity: 1;
}

.pvg-vcd-wat-main-video:hover .pvg-vcd-wat-play-overlay {
    background: rgba(0,0,0,0.4);
}

.pvg-vcd-wat-play-button {
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.pvg-vcd-wat-main-video:hover .pvg-vcd-wat-play-button {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
}

/* Thumbnails - Tương thích với Flexslider của Flatsome */
.pvg-vcd-wat-thumbs-container {
    position: relative;
    margin: 10px 0 0 0;
}

.pvg-vcd-wat-thumbs {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 5px;
    margin: 0 !important;
    padding: 0 40px !important;
    list-style: none !important;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pvg-vcd-wat-thumbs::-webkit-scrollbar {
    display: none;
}

.pvg-vcd-wat-thumbs-nav {
    padding: 0px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 10;
}

.pvg-vcd-wat-thumbs-nav:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.1);
}

.pvg-vcd-wat-thumbs-nav.prev {
    left: 5px;
}

.pvg-vcd-wat-thumbs-nav.next {
    right: 5px;
}

.pvg-vcd-wat-thumb {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    transition: all 0.3s ease;
    flex: 0 0 auto;
    width: 80px !important;
    height: 80px !important;
    margin: 0 !important;
}

.pvg-vcd-wat-thumb:hover {
    border-color: #0073aa;
    transform: scale(1.05);
}

.pvg-vcd-wat-thumb.flex-active {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.pvg-vcd-wat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video thumbnail play icon */
.pvg-vcd-wat-thumb-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* Modal Styles - Z-index cao nhất */
.pvg-vcd-wat-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
    animation: pvgVcdWatFadeIn 0.3s ease;
}

.pvg-vcd-wat-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

@keyframes pvgVcdWatFadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

.pvg-vcd-wat-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    animation: pvgVcdWatSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes pvgVcdWatSlideIn {
    from {transform: translateY(-50px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

.pvg-vcd-wat-close {
    position: absolute;
    top: 30px;
    right: 90px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    color: #000000;
    z-index: 1000000;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.pvg-vcd-wat-close:hover {
    background: white;
    transform: scale(1.05);
}

#pvg-vcd-wat-player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
}

#pvg-vcd-wat-player-container iframe,
#pvg-vcd-wat-player-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Player navigation arrows */
.pvg-vcd-wat-player-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 10001;
    opacity: 0.8;
}

.pvg-vcd-wat-player-nav:hover {
    background: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
}

.pvg-vcd-wat-player-nav.prev {
    left: 20px;
}

.pvg-vcd-wat-player-nav.next {
    right: 20px;
}

/* Modal thumbnails */
.pvg-vcd-wat-modal-thumbnails-container {
    position: relative;
}

.pvg-vcd-wat-modal-thumbnails {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    max-height: 120px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0 40px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pvg-vcd-wat-modal-thumbnails::-webkit-scrollbar {
    display: none;
}

.pvg-vcd-wat-modal-thumbs-nav {
    padding: 0px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    z-index: 10002;
}

.pvg-vcd-wat-modal-thumbs-nav:hover {
    background: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(1.1);
}

.pvg-vcd-wat-modal-thumbs-nav.prev {
    left: 5px;
}

.pvg-vcd-wat-modal-thumbs-nav.next {
    right: 5px;
}

.pvg-vcd-wat-modal-thumb {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    transition: all 0.3s ease;
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
}

.pvg-vcd-wat-modal-thumb:hover {
    border-color: #0073aa;
    transform: scale(1.05);
}

.pvg-vcd-wat-modal-thumb.active {
    border-color: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.pvg-vcd-wat-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pvg-vcd-wat-modal-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
}
.pvg-vcd-wat-modal-thumbnails-container {
    margin-bottom: 25px;
}
/* Counter */
.pvg-vcd-wat-counter {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    z-index: 10001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
}

/* Loading animation */
.pvg-vcd-wat-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: pvgVcdWatSpin 1s linear infinite;
}

@keyframes pvgVcdWatSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Error message */
.pvg-vcd-wat-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .pvg-vcd-wat-play-button {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .pvg-vcd-wat-modal-content {
        width: 98%;
        padding: 15px;
    }
    
    .pvg-vcd-wat-thumb {
        width: 60px !important;
        height: 60px !important;
    }
    
    .pvg-vcd-wat-modal-thumb {
        width: 60px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .pvg-vcd-wat-play-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .pvg-vcd-wat-thumb {
        width: 50px !important;
        height: 50px !important;
    }
    
    .pvg-vcd-wat-modal-thumb {
        width: 50px;
        height: 38px;
    }
    
    .pvg-vcd-wat-modal-thumbnails {
        max-height: 100px;
    }
}

/* Hide body scroll when modal open */
body.pvg-vcd-wat-modal-open {
    overflow: hidden !important;
}

/* Scrollbar for modal thumbnails */
.pvg-vcd-wat-modal-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.pvg-vcd-wat-modal-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pvg-vcd-wat-modal-thumbnails::-webkit-scrollbar-thumb {
    background: #0073aa;
    border-radius: 3px;
}

.pvg-vcd-wat-modal-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #005a8c;
}

/* Fallback styles for products without videos */
.woocommerce-product-gallery:not(.pvg-vcd-wat-gallery) {
    /* Giữ nguyên style mặc định của WooCommerce */
}

/* Ensure proper display when no custom gallery is used */
.single-product-main-image a.woocommerce-product-gallery__trigger {
    display: block;
    position: relative;
}

.single-product-main-image a.woocommerce-product-gallery__trigger img {
    width: 100%;
    height: auto;
    display: block;
}


/* Áp dụng cho cả di động và iPad */
@media screen and (max-width: 1024px) {
  .pvg-vcd-wat-close {
    top: 10px;
    right: 10px;
  }

#pvg-vcd-wat-player-container {
   
    padding-bottom: 100%; 
   
}

}