/* ================================================================
   WEB Product Image Gallery Widget
   ================================================================ */

/* ---- Outer wrapper ---- */
.web-gallery {
    display: flex;
    flex-direction: column;
    width: 100%;
    user-select: none;
}

.web-gallery--thumbs-left {
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
}

.web-gallery--thumbs-left .web-gallery__stage {
    flex: 1 1 0;
    min-width: 0;
}

/* ---- Stage ---- */
.web-gallery__stage {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ---- Main image container ---- */
.web-gallery__main-wrap {
    position: relative;
    width: 100%;
    background-color: #f0f0f0;
    border-radius: 12px;
    flex-shrink: 0;
    height: auto !important;
}

/* ---- Slides outer ----
   Height is set by JS to exactly match the active slide image height.
   background:transparent ensures the main-wrap background never bleeds. */
.web-gallery__slides {
    overflow: hidden;
    border-radius: inherit;
    width: 100%;
    position: relative;
    background: transparent !important;
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Slides inner ---- */
.web-gallery__slides-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Each slide: height = its image natural height, no more */
.web-gallery__slide {
    flex-shrink: 0;
    flex-grow: 0;
    overflow: hidden;
    line-height: 0;
}

/* Main image: full width, never force a height */
.web-gallery__main-img {
    width: 100%;
    height: auto !important;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* ---- Nav arrows ----
   top is set via CSS variable --pg-arrow-top which Elementor's
   responsive selector writes per breakpoint. We never hard-code top
   here so desktop / tablet / mobile all work independently.           */
.web-gallery__slides .web-pg-slidebtn {
    position: absolute !important;
    top: var(--pg-arrow-top, 50%) !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    color: #1a1a1a !important;
    fill: #1a1a1a !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.22) !important;
    padding: 0 !important;
    transition: box-shadow 0.2s !important;
    line-height: 1 !important;
    text-decoration: none !important;
    font-size: 0 !important;
}
.web-gallery__slides .web-pg-slidebtn:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.32) !important;
}
.web-gallery__slides .web-pg-slidebtn--prev { left: 10px !important; right: auto !important; }
.web-gallery__slides .web-pg-slidebtn--next { right: 10px !important; left: auto !important; }
.web-gallery__slides .web-pg-slidebtn svg {
    display: block !important;
    pointer-events: none !important;
    stroke: #1a1a1a !important;
    fill: none !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}

/* ---- Zoom button ---- */
.web-gallery__zoom-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    color: #1a1a1a;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    outline: none;
}
.web-gallery__zoom-btn:hover {
    background: #f8f8f8;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    transform: scale(1.06);
}
.web-gallery__zoom-btn svg,
.web-gallery__zoom-btn i { pointer-events: none; display: block; }

/* ---- Thumbnails wrap ---- */
.web-gallery__thumbs-wrap { margin-top: 12px; overflow: hidden; }

.web-gallery--thumbs-left .web-gallery__thumbs-wrap {
    margin-top: 0; width: 72px; flex-shrink: 0; order: -1;
}
.web-gallery--thumbs-left .web-gallery__thumbs {
    flex-direction: column; overflow-y: auto; overflow-x: hidden; max-height: 520px;
}

/* ---- Thumbnails strip ---- */
.web-gallery__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 2px 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.web-gallery__thumbs::-webkit-scrollbar { display: none; }

/* ---- Single thumbnail ---- */
.web-gallery__thumb {
    flex-shrink: 0;
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background-color: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer; padding: 0;
    transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
    outline: none; position: relative;
}
.web-gallery__thumb img {
    width: 100%; height: 100%; object-fit: cover;
    display: block; border-radius: 4px; pointer-events: none;
}
.web-gallery__thumb:hover { border-color: rgba(0,0,0,0.35); box-shadow: 0 2px 8px rgba(0,0,0,0.10); }
.web-gallery__thumb.is-active { border-color: #1a1a1a; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.web-gallery__thumb::after {
    content:''; position:absolute; inset:0;
    background:rgba(0,0,0,0); transition:background 0.2s; border-radius:4px;
}
.web-gallery__thumb:hover::after { background:rgba(0,0,0,0.04); }
.web-gallery__thumb--more { background:#1a1a1a; color:#fff; font-size:0.85rem; font-weight:600; }
.web-gallery__thumb--more span { pointer-events:none; }

/* ================================================================
   Lightbox
   ================================================================ */
.web-gallery-lightbox {
    position:fixed; inset:0; z-index:999999;
    display:flex; align-items:center; justify-content:center;
    opacity:0; pointer-events:none; transition:opacity 0.3s ease;
}
.web-gallery-lightbox.is-open { opacity:1; pointer-events:auto; }
.web-gallery-lightbox__backdrop {
    position:absolute; inset:0;
    background:rgba(0,0,0,0.88);
    backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
    cursor:zoom-out;
}
.web-gallery-lightbox__inner {
    position:relative; z-index:1;
    display:flex; align-items:center; justify-content:center;
    max-width:min(90vw,1000px); max-height:90vh; width:100%;
}
.web-gallery-lightbox__img {
    display:block; max-width:100%; max-height:90vh;
    object-fit:contain; border-radius:4px;
    box-shadow:0 24px 80px rgba(0,0,0,0.5); transition:transform 0.25s ease;
}
.web-gallery-lightbox__close {
    position:fixed; top:20px; right:20px;
    width:44px; height:44px;
    display:flex; align-items:center; justify-content:center;
    background:rgba(255,255,255,0.12); border:1px solid rgba(255,255,255,0.2);
    border-radius:50%; color:#fff; cursor:pointer; z-index:2;
    transition:background 0.2s, transform 0.15s; outline:none;
}
.web-gallery-lightbox__close:hover { background:rgba(255,255,255,0.22); transform:scale(1.08) rotate(90deg); }
.web-gallery-lightbox__arrow {
    position:fixed; top:50%; transform:translateY(-50%);
    width:52px; height:52px;
    display:flex; align-items:center; justify-content:center;
    background:rgba(255,255,255,0.10); border:1px solid rgba(255,255,255,0.18);
    border-radius:50%; color:#fff; cursor:pointer; z-index:2;
    transition:background 0.2s, transform 0.15s; outline:none;
}
.web-gallery-lightbox__arrow:hover { background:rgba(255,255,255,0.22); }
.web-gallery-lightbox__arrow--prev { left:20px; }
.web-gallery-lightbox__arrow--next { right:20px; }
.web-gallery-lightbox__arrow--prev:hover { transform:translateY(-50%) scale(1.06) translateX(-2px); }
.web-gallery-lightbox__arrow--next:hover { transform:translateY(-50%) scale(1.06) translateX(2px); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .web-gallery--thumbs-left { flex-direction: column; }
    .web-gallery--thumbs-left .web-gallery__thumbs-wrap { order:1; width:100%; margin-top:10px; }
    .web-gallery--thumbs-left .web-gallery__thumbs { flex-direction:row; overflow-x:auto; overflow-y:hidden; max-height:none; }
    .web-gallery-lightbox__arrow--prev { left:8px; }
    .web-gallery-lightbox__arrow--next { right:8px; }
}
