/* =============================================
   DW Product Gallery Shortcode - CSS
   Version: 1.3.4
   Fixed jump on close + Smaller clean lightbox
============================================= */

.dw-product-gallery {
    margin: 40px 0 30px;
    clear: both;
}

/* Responsive Grid */
.dw-gallery-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, 1fr);
}

.dw-columns-2 .dw-gallery-grid { grid-template-columns: repeat(2, 1fr); }
.dw-columns-4 .dw-gallery-grid { grid-template-columns: repeat(4, 1fr); }
.dw-columns-5 .dw-gallery-grid { grid-template-columns: repeat(5, 1fr); }
.dw-columns-6 .dw-gallery-grid { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 768px) {
    .dw-gallery-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 12px; 
    }
}

@media (max-width: 480px) {
    .dw-gallery-grid { 
        grid-template-columns: 1fr; 
        gap: 10px; 
    }
}

/* Gallery Items */
.dw-gallery-item {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    transition: all 0.35s ease;
}

.dw-gallery-item:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.18);
    transform: translateY(-4px);
}

.dw-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

.dw-gallery-item:hover img {
    transform: scale(1.08);
}

/* ==================== FIXED LIGHTBOX - No Jump on Close ==================== */
.dw-lightbox-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.94) !important;
    z-index: 2147483647 !important;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.dw-lightbox-overlay.show {
    display: flex !important;
    opacity: 1;
}

/* Center content properly and prevent layout shift */
.dw-lightbox-content {
    position: relative;
    max-width: 85%;
    max-height: 85vh;
    padding: 25px;                    /* Increased padding */
    box-sizing: border-box;
    z-index: 2147483648 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dw-lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    display: block;
    transition: transform 0.2s ease;
}

/* Close Button - Stable positioning */
.dw-lightbox-close {
    position: absolute;
    top: -58px;
    right: 15px;
    color: #ffffff;
    font-size: 50px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    z-index: 2147483649 !important;
    text-shadow: 0 3px 12px rgba(0,0,0,0.85);
    transition: all 0.2s ease;
    padding: 5px 12px;
    margin: -5px;                     /* Better click area */
}

.dw-lightbox-close:hover {
    color: #ffdddd;
    transform: scale(1.15);
}

/* Prevent body scroll */
body.dw-lightbox-open {
    overflow: hidden;
}