/* ==========================================
   VETRA — PRODUCT GALLERY + LIGHTBOX
   (loaded only on pages using product-gallery-template.php)
   ========================================== */

/* Fallback for --color-white if the parent theme doesn't define it */
.product-gallery-section,
.product-lightbox {
    --color-white: #ffffff;
}

/* ==========================================
   GALLERY SECTION
   ========================================== */
.product-gallery-section {
    padding: 48px 0 72px;
    background-color: #F8F4EE;
}

.product-gallery-section .gallery-header {
    text-align: center;
    margin-bottom: 24px;
}

.product-gallery-section .gallery-title {
    font-size: 30px;
    font-weight: 700;
    color: #4A2E2A;
    letter-spacing: 2px;
    margin:6px 0 0 0;
}

.product-gallery-section .product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.product-gallery-section .product-item {
    cursor: pointer;
}

.product-gallery-section .product-image {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 2.5;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.product-gallery-section .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-gallery-section .product-image img[src=""] {
    background: linear-gradient(135deg, #d4c8bc 0%, #a89485 100%);
}



.product-gallery-section .product-overlay {
    position: absolute;
    inset: 0;
    background: rgba(74, 46, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.product-gallery-section .product-item:hover .product-overlay {
    opacity: 1;
}

.product-gallery-section .product-code {
    color: var(--color-white);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 6px 20px;
    border: 2px solid var(--color-white);
    border-radius: 4px;
    transform: translateY(10px);
    transition: transform 0.4s ease;
}

.product-gallery-section .product-item:hover .product-code {
    transform: translateY(0);
}

/* Responsive grid */
@media (max-width: 991px) {
    .product-gallery-section .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .product-gallery-section .product-grid {
        grid-template-columns: 1fr;
    }
    .product-gallery-section .gallery-title {
        font-size: 24px;
    }
}

/* ==========================================
   LIGHTBOX MODAL
   Body-scoped selectors + !important to beat
   TheGem's `top: 75px` rule on #main children.
   ========================================== */
body .product-lightbox,
body #productLightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body .product-lightbox.active,
body #productLightbox.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.product-lightbox .lightbox-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgb(0 0 0 / 75%);
    z-index: 1;
}

/* Toolbar (top-right buttons) */
.product-lightbox .lightbox-toolbar {
    position: fixed !important;
    top: 15px !important;
    right: 15px !important;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 9999999 !important;
}

.product-lightbox .toolbar-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.product-lightbox .toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.product-lightbox .zoom-out-icon { display: none; }
.product-lightbox.zoomed .zoom-in-icon { display: none; }
.product-lightbox.zoomed .zoom-out-icon { display: block; }
.product-lightbox.zoomed .lightbox-image { cursor: grab; }
.product-lightbox.zoomed .lightbox-image:active { cursor: grabbing; }

/* Share dropdown */
.product-lightbox .share-wrapper {
    position: relative;
}

.product-lightbox .share-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--color-white);
    border-radius: 6px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    min-width: 220px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 20;
}

.product-lightbox .share-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.product-lightbox .share-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--color-white);
}

.product-lightbox .share-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: #333;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease;
}

.product-lightbox .share-option:hover {
    background: #f5f5f5;
}

.product-lightbox .share-option svg {
    flex-shrink: 0;
}

/* Navigation arrows */
.product-lightbox .lightbox-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 9999999 !important;
}

.product-lightbox .lightbox-prev { left: 20px !important; }
.product-lightbox .lightbox-next { right: 20px !important; }

.product-lightbox .lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.product-lightbox .lightbox-prev:hover {
    transform: translateY(-50%) translateX(-3px);
}

.product-lightbox .lightbox-next:hover {
    transform: translateY(-50%) translateX(3px);
}

.product-lightbox.zoomed .lightbox-nav {
    opacity: 0;
    pointer-events: none;
}

/* Image container + image */
.product-lightbox .lightbox-content {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 999999 !important;
}

.product-lightbox .lightbox-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: all 0.4s ease;
    cursor: zoom-in;
}

.product-lightbox.zoomed .lightbox-content {
    width: 100vw !important;
    height: 100vh !important;
    padding: 0;
}

.product-lightbox.zoomed .lightbox-image {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    cursor: grab;
}

.product-lightbox.zoomed .lightbox-image:active {
    cursor: grabbing;
}

/* Body lock while lightbox is open */
body.lightbox-open {
    overflow: hidden !important;
}

/* ==========================================
   HIDE FIXED/STICKY OVERLAYS WHILE LIGHTBOX IS OPEN
   Applies ONLY when body has .lightbox-open class,
   so nothing changes on the rest of the site.

   Using the exact selectors from the Vetra site:
     #tpbr_topbar    → "We are Live / Shop Now" top bar
     .entry-effect   → Enquire Now side button
     .whtsup-icon    → WhatsApp floating icon
   ========================================== */
body.lightbox-open #tpbr_topbar,
body.lightbox-open .entry-effect,
body.lightbox-open .whtsup-icon,
body.lightbox-open .site-header,
body.lightbox-open #site-header,
body.lightbox-open .header-sticky,
body.lightbox-open .site-header-sticky {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

@media (max-width: 991px) {

 /* Product Gallery */
    .product-gallery-section {
        padding: 50px 0 60px;
    }

    .product-gallery-section .gallery-title {
        font-size: 26px;
    }

    .product-gallery-section .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .product-gallery-section .product-code {
        font-size: 16px;
        padding: 10px 20px;
    }

    .product-lightbox .lightbox-content {
        padding: 70px 60px;
    }

    .product-lightbox .lightbox-toolbar {
        right: 10px;
    }
}

@media (max-width: 767px) {

     /* Product Gallery */
    .product-gallery-section .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-gallery-section .product-code {
        font-size: 14px;
        padding: 8px 15px;
        letter-spacing: 1px;
    }

    .product-lightbox .lightbox-content {
        padding: 60px 0;
        width: 290px;
    }

    .product-lightbox .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .product-lightbox .lightbox-prev {
        left: 10px;
    }

    .product-lightbox .lightbox-next {
        right: 10px;
    }

    .product-lightbox .toolbar-btn {
        width: 36px;
        height: 36px;
    }

    .product-lightbox .share-dropdown {
        right: -50px;
    }

    .product-lightbox .share-dropdown::before {
        right: 62px;
    }
}

@media (max-width: 575px) {


 /* Product Gallery */
    .product-gallery-section {
        padding: 40px 0 50px;
    }

    .product-gallery-section .gallery-title {
        font-size: 22px;
        letter-spacing: 1px;
    }

    .product-gallery-section .gallery-header {
        margin-bottom: 30px;
    }

    .product-gallery-section .product-grid {
        gap: 12px;
    }

    .product-gallery-section .product-image {
        border-radius: 6px;
    }

    .product-gallery-section .product-code {
        font-size: 12px;
        padding: 6px 12px;
    }

    .product-lightbox .lightbox-nav svg {
        width: 22px;
        height: 22px;
    }

    .product-lightbox .toolbar-btn {
        width: 34px;
        height: 34px;
    }

    .product-lightbox .toolbar-btn svg {
        width: 18px;
        height: 18px;
    }

    .product-lightbox.zoomed .lightbox-content {
        padding: 10px;
    }

    .product-lightbox.zoomed .lightbox-image {
        width: calc(100vw - 20px);
    }
}
