/**
 * MN WooCommerce Product Gallery Widget Styles
 */

/* Editor Notice */
.mn-woo-gallery-editor-notice {
    padding: 20px;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    text-align: center;
    color: #666;
    border-radius: 4px;
}

/* Gallery Wrapper */
.mn-woo-gallery-wrapper {
    position: relative;
    width: 100%;
}

/* Fix Elementor Sticky Duplication - hide the spacer/placeholder */
.elementor-sticky--effects ~ .elementor-sticky__spacer .mn-woo-gallery-wrapper,
.elementor-sticky__spacer .mn-woo-gallery-wrapper {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Alternative: if sticky is on column level */
.elementor-sticky__spacer .mn-woo-gallery-container {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Sale Badge */
.mn-woo-gallery-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Gallery Container */
.mn-woo-gallery-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

/* Thumbnails Wrapper */
.mn-woo-gallery-thumbnails-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

/* Thumbnails Container */
.mn-woo-gallery-thumbnails {
    overflow: hidden;
    position: relative;
}

.mn-woo-gallery-thumbnails-inner {
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

/* Thumbnail Item */
.mn-woo-gallery-thumb {
    cursor: pointer;
    overflow: hidden;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mn-woo-gallery-thumb:last-child {
    margin-bottom: 0 !important;
}

.mn-woo-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mn-woo-gallery-thumb.active {
    opacity: 1 !important;
    border-style: solid;
}

.mn-woo-gallery-thumb:hover {
    opacity: 1 !important;
}

/* Navigation Arrows */
.mn-woo-gallery-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
    margin: 5px 0;
}

.mn-woo-gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.mn-woo-gallery-nav svg {
    width: 50%;
    height: 50%;
}

/* Main Image Container */
.mn-woo-gallery-main {
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    cursor: pointer;
}

.mn-woo-gallery-main-image {
    display: none;
}

.mn-woo-gallery-main-image.active {
    display: block;
}

.mn-woo-gallery-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox Styles */
.mn-woo-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.mn-woo-gallery-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.mn-woo-gallery-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mn-woo-gallery-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.mn-woo-gallery-lightbox-close:hover {
    opacity: 0.7;
}

.mn-woo-gallery-lightbox-prev,
.mn-woo-gallery-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10;
}

.mn-woo-gallery-lightbox-prev:hover,
.mn-woo-gallery-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mn-woo-gallery-lightbox-prev {
    left: 20px;
}

.mn-woo-gallery-lightbox-next {
    right: 20px;
}

.mn-woo-gallery-lightbox-image {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mn-woo-gallery-lightbox-image img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

/* Zoom Icon Overlay */
.mn-woo-gallery-zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.mn-woo-gallery-zoom-icon svg {
    width: 24px;
    height: 24px;
}

.mn-woo-gallery-main:hover .mn-woo-gallery-zoom-icon {
    opacity: 1;
}

/* =============================================
   Thumbnail Position Variants
   ============================================= */

/* Position: Right */
.mn-gallery-pos-right .mn-woo-gallery-container {
    flex-direction: row-reverse;
}

/* Position: Top */
.mn-gallery-pos-top .mn-woo-gallery-container {
    flex-direction: column;
}

.mn-gallery-pos-top .mn-woo-gallery-thumbnails-wrapper {
    flex-direction: row;
    width: 100%;
    margin-bottom: 10px;
}

.mn-gallery-pos-top .mn-woo-gallery-thumbnails {
    width: 100% !important;
    height: auto !important;
}

.mn-gallery-pos-top .mn-woo-gallery-thumbnails-inner {
    flex-direction: row;
    gap: 10px;
}

.mn-gallery-pos-top .mn-woo-gallery-thumb {
    margin-bottom: 0 !important;
}

.mn-gallery-pos-top .mn-woo-gallery-nav {
    transform: rotate(-90deg);
}

/* Position: Bottom */
.mn-gallery-pos-bottom .mn-woo-gallery-container {
    flex-direction: column-reverse;
}

.mn-gallery-pos-bottom .mn-woo-gallery-thumbnails-wrapper {
    flex-direction: row;
    width: 100%;
    margin-top: 10px;
}

.mn-gallery-pos-bottom .mn-woo-gallery-thumbnails {
    width: 100% !important;
    height: auto !important;
}

.mn-gallery-pos-bottom .mn-woo-gallery-thumbnails-inner {
    flex-direction: row;
    gap: 10px;
}

.mn-gallery-pos-bottom .mn-woo-gallery-thumb {
    margin-bottom: 0 !important;
}

.mn-gallery-pos-bottom .mn-woo-gallery-nav {
    transform: rotate(-90deg);
}

/* =============================================
   Responsive
   ============================================= */

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
    .mn-woo-gallery-main {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 4 / 3;
    }
    
    .mn-woo-gallery-main-image img {
        object-fit: contain;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .mn-woo-gallery-container {
        flex-direction: column-reverse !important;
    }
    
    .mn-woo-gallery-thumbnails-wrapper {
        flex-direction: row;
        width: 100%;
        margin-top: 10px;
    }
    
    .mn-woo-gallery-thumbnails {
        width: 100% !important;
        height: auto !important;
    }
    
    .mn-woo-gallery-thumbnails-inner {
        flex-direction: row;
        gap: 10px;
    }
    
    .mn-woo-gallery-thumb {
        margin-bottom: 0 !important;
        width: 60px !important;
        height: 60px !important;
    }
    
    .mn-woo-gallery-nav {
        transform: rotate(-90deg);
    }
    
    .mn-woo-gallery-main {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
    }
    
    .mn-woo-gallery-main-image img {
        object-fit: contain;
    }
    
    .mn-woo-gallery-lightbox-prev,
    .mn-woo-gallery-lightbox-next {
        width: 40px;
        height: 40px;
    }
    
    .mn-woo-gallery-lightbox-prev {
        left: 10px;
    }
    
    .mn-woo-gallery-lightbox-next {
        right: 10px;
    }
}
