/**
 * Custom Product Gallery - Styles
 * 
 * @package CustomProductGallery
 * @version 1.0.0
 */
#qodef-woo-page.qodef--single .qodef-woo-single-image{
	width:55% !important;
}
/* ========================================
   Gallery Wrapper
======================================== */
.cpg-gallery-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    position: relative;
    display: block;
    clear: both;
}

/* Ensure gallery stays in WooCommerce container */
.woocommerce div.product div.images {
    width: 100%;
    float: none !important;
}

.woocommerce div.product .cpg-gallery-wrapper {
    margin-bottom: 2em;
}

/* Override any theme styles that might interfere */
.woocommerce-product-gallery.images .cpg-gallery-wrapper {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Hide default WooCommerce gallery elements when using custom gallery */
body.cpg-custom-gallery-active .woocommerce-product-gallery__wrapper,
body.cpg-custom-gallery-active .flex-viewport,
body.cpg-custom-gallery-active .flex-control-thumbs,
body.cpg-custom-gallery-active .woocommerce-product-gallery__trigger {
    display: none !important;
}

/* Ensure our gallery wrapper takes full width */
.woocommerce div.product .woocommerce-product-gallery.cpg-gallery-wrapper {
    width: 100%;
    margin: 0;
}

/* Force proper display of arrow SVGs */
.cpg-arrow svg,
.cpg-main-nav-arrow svg,
.cpg-lightbox-arrow svg,
.cpg-lightbox-close svg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ========================================
   Main Image Container
======================================== */
.cpg-main-image-wrapper {
    width: 100%;
    margin: 0 auto 20px;
    position: relative;
    background: #f5f5f5;
    /* clip arrows that are positioned absolute */
    overflow: visible;
}

.cpg-main-image-container {
    position: relative;
    width: 100%;
    cursor: pointer;
    /* Fixed height so object-fit:contain has both axes to work with */
    height: 600px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cpg-main-image {
    /* Let the image fill the container without cropping */
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: opacity 0.25s ease;
}

/* Fade-out state during image swap */
.cpg-main-image.cpg-fading {
    opacity: 0;
}

/* Removed: old slide transition */
.cpg-main-image-container.sliding {
    transition: none;
}

/* ========================================
   Main Image Navigation Arrows
======================================== */
.cpg-main-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    font-size: 24px;
    color: #333;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
}

.cpg-main-image-wrapper:hover .cpg-main-nav-arrow {
    opacity: 1;
    pointer-events: auto;
}

.cpg-main-nav-arrow:hover {
    background: rgba(255, 255, 255, 1);
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cpg-main-nav-arrow:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

.cpg-main-nav-prev {
    left: 20px;
}

.cpg-main-nav-next {
    right: 20px;
}

.cpg-main-nav-arrow i,
.cpg-main-nav-arrow svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
}

/* Hide arrows when disabled */
.cpg-main-nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   Lightbox/Fancybox Overlay
======================================== */
.cpg-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cpg-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cpg-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpg-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cpg-lightbox-image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Lightbox Close Button */
.cpg-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 24px;
    color: #333;
    width: 50px;
    height: 50px;
    transition: all 0.3s ease;
    z-index: 1000001;
}

.cpg-lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: rotate(90deg);
}

.cpg-lightbox-close:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Lightbox Navigation Arrows */
.cpg-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 28px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 1000000;
}

.cpg-lightbox-arrow:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.cpg-lightbox-arrow:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

.cpg-lightbox-prev {
    left: 30px;
}

.cpg-lightbox-next {
    right: 30px;
}

.cpg-lightbox-arrow i,
.cpg-lightbox-arrow svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    display: block;
}

/* Lightbox Counter */
.cpg-lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000001;
}

/* ========================================
   Thumbnails Section
======================================== */
.cpg-thumbnails-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Arrow positioning for outside arrows */
.cpg-gallery-wrapper[data-arrow-position="outside"] .cpg-thumbnails-wrapper {
    padding: 0 50px;
}

/* Viewport: the element that clips and scrolls */
.cpg-thumbnails-viewport {
    flex: 1;
    min-width: 0;
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cpg-thumbnails-viewport::-webkit-scrollbar {
    display: none;
    height: 0;
}

/* Container: pure flex row, never scrolls itself */
.cpg-thumbnails-container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    width: max-content;
}

/* ========================================
   Thumbnails
======================================== */
.cpg-thumbnail {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    object-fit: cover;
    object-position: center;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0.7;
    border: 2px solid transparent;
    display: block;
}

.cpg-thumbnail:hover {
    opacity: 1;
    transform: scale(1.05);
}

.cpg-thumbnail.active {
    opacity: 1;
    border-color: #000;
}

/* Smooth transition during metal switching */
.cpg-thumbnail.cpg-updating {
    opacity: 0.3;
    transition: opacity 0.15s ease;
}

/* ========================================
   Thumbnail Navigation Arrows
======================================== */
.cpg-arrow {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 20px;
    color: #333;
}

.cpg-arrow:hover {
    background: rgba(255, 255, 255, 1);
    color: #000;
}

.cpg-arrow:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

.cpg-arrow svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
}

/* Outside arrows */
.cpg-arrow-outside {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.cpg-arrow-outside.cpg-arrow-left {
    left: 0;
}

.cpg-arrow-outside.cpg-arrow-right {
    right: 0;
}

/* Inside arrows */
.cpg-arrow-inside {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.cpg-arrow-inside.cpg-arrow-left {
    left: 5px;
}

.cpg-arrow-inside.cpg-arrow-right {
    right: 5px;
}

/* ========================================
   Editor/Error Messages
======================================== */
.cpg-editor-notice,
.cpg-no-images {
    padding: 20px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* ========================================
   Loading State
======================================== */
.cpg-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: cpg-spin 0.8s linear infinite;
    z-index: 5;
}

@keyframes cpg-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================
   Responsive Design
======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .cpg-main-image-container {
        height: 500px;
    }
    
    .cpg-main-nav-arrow {
        padding: 12px;
        font-size: 20px;
    }
    
    .cpg-main-nav-prev {
        left: 15px;
    }
    
    .cpg-main-nav-next {
        right: 15px;
    }
    
    .cpg-thumbnail {
        width: 80px;
        height: 80px;
    }
    
    .cpg-arrow {
        padding: 8px;
        font-size: 16px;
    }
    
    .cpg-arrow svg {
        width: 16px;
        height: 16px;
    }
    
    .cpg-lightbox-arrow {
        padding: 15px;
        font-size: 24px;
    }
    
    .cpg-lightbox-prev {
        left: 20px;
    }
    
    .cpg-lightbox-next {
        right: 20px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .cpg-main-image-container {
        height: 400px;
    }
    
    .cpg-main-nav-arrow {
        padding: 10px;
        font-size: 18px;
    }
    
    .cpg-main-nav-prev {
        left: 10px;
    }
    
    .cpg-main-nav-next {
        right: 10px;
    }
    
    .cpg-main-nav-arrow i,
    .cpg-main-nav-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .cpg-thumbnail {
        width: 70px;
        height: 70px;
    }
    
    
    
    .cpg-gallery-wrapper[data-arrow-position="outside"] .cpg-thumbnails-wrapper {
        padding: 0 40px;
    }
    
    .cpg-arrow {
        padding: 6px;
        font-size: 14px;
    }
    
    .cpg-arrow svg {
        width: 14px;
        height: 14px;
    }
    
    .cpg-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        padding: 10px;
        font-size: 20px;
    }
    
    .cpg-lightbox-arrow {
        padding: 12px;
        font-size: 20px;
    }
    
    .cpg-lightbox-prev {
        left: 10px;
    }
    
    .cpg-lightbox-next {
        right: 10px;
    }
    
    .cpg-lightbox-counter {
        bottom: 20px;
        font-size: 12px;
        padding: 8px 16px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .cpg-main-image-container {
        height: 300px;
    }
    
    .cpg-main-nav-arrow {
        padding: 8px;
        font-size: 16px;
    }
    
    .cpg-main-nav-prev {
        left: 8px;
    }
    
    .cpg-main-nav-next {
        right: 8px;
    }
    
    .cpg-thumbnail {
        width: 60px;
        height: 60px;
    }
    
    
    
    .cpg-gallery-wrapper[data-arrow-position="outside"] .cpg-thumbnails-wrapper {
        padding: 0 35px;
    }
    
    .cpg-lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
	#qodef-woo-page.qodef--single .qodef-woo-single-image{
		width:100% !important;
	}
}

/* ========================================
   Accessibility
======================================== */
.cpg-thumbnail:focus,
.cpg-arrow:focus,
.cpg-main-nav-arrow:focus,
.cpg-lightbox-arrow:focus,
.cpg-lightbox-close:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Screen reader only text */
.cpg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cpg-thumbnail,
    .cpg-arrow,
    .cpg-main-image,
    .cpg-main-nav-arrow,
    .cpg-lightbox-overlay,
    .cpg-lightbox-image,
    .cpg-lightbox-arrow,
    .cpg-lightbox-close {
        transition: none;
    }
    
    .cpg-thumbnails-container {
        scroll-behavior: auto;
    }
    
    .cpg-loading {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .cpg-thumbnail {
        border-width: 3px;
    }
    
    .cpg-thumbnail.active {
        border-color: currentColor;
    }
    
    .cpg-arrow,
    .cpg-main-nav-arrow,
    .cpg-lightbox-arrow,
    .cpg-lightbox-close {
        border: 2px solid currentColor;
    }
}

/* ========================================
   Theme Compatibility Overrides
======================================== */

/* Force gallery to work with popular themes */
.woocommerce div.product .images .cpg-gallery-wrapper,
.woocommerce-page div.product .images .cpg-gallery-wrapper,
.single-product .product .images .cpg-gallery-wrapper {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    margin: 0 !important;
}

/* Override Flatsome theme */
.product-gallery .cpg-gallery-wrapper {
    width: 100% !important;
}

/* Override Astra theme */
.ast-woocommerce-container .cpg-gallery-wrapper {
    width: 100% !important;
}

/* Override OceanWP theme */
.oceanwp-woocommerce-container .cpg-gallery-wrapper {
    width: 100% !important;
}

/* Override Storefront theme */
.storefront .cpg-gallery-wrapper {
    width: 100% !important;
}

/* Override Divi theme */
.et_pb_wc_images .cpg-gallery-wrapper {
    width: 100% !important;
}

/* Fix for themes with flexbox layouts */
.woocommerce div.product .images {
    display: block !important;
}

.woocommerce div.product .images .cpg-gallery-wrapper {
    flex: none !important;
}

/* Ensure proper z-index stacking */
.cpg-gallery-wrapper {
    z-index: 1;
}

.cpg-main-nav-arrow {
    z-index: 10;
}

.cpg-arrow {
    z-index: 10;
}

.cpg-lightbox-overlay {
    z-index: 999999;
}
button.cpg-main-nav-arrow.cpg-main-nav-next.transparent-button, button.cpg-main-nav-arrow.cpg-main-nav-prev.transparent-button {
    width: 50%;
    height: 100%;
    padding: 0 !important;
    border: none !important;
}