/**
 * Simple Gallery Lightbox - Custom Styles V7
 */

/* === Gallery link styling === */
.gallery-item a,
.wp-block-gallery .wp-block-image a,
.wp-block-gallery figure a,
.wp-block-image a,
a[class*="sgl-gallery-"],
a.sgl-standalone {
    cursor: pointer !important;
    outline: none !important;
    text-decoration: none !important;
}

a[class*="sgl-gallery-"] img,
a.sgl-standalone img {
    cursor: pointer !important;
}

/* Subtle hover effect */
.wp-block-gallery .wp-block-image a:hover img,
.wp-block-gallery figure a:hover img,
a[class*="sgl-gallery-"]:hover img,
a.sgl-standalone:hover img {
    opacity: 0.85;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* === LIGHTBOX OVERLAY === */
.goverlay {
    z-index: 99998 !important;
}

/* === LIGHTBOX CONTAINER === */
.glightbox-container {
    z-index: 99999 !important;
}

/* === IMAGE SIZING === */
.glightbox-container .gslide-image img {
    max-width: 90vw !important;
    max-height: 85vh !important;
    width: auto !important;
    height: auto !important;
}

/* === Prevent clipping of buttons === */
.glightbox-container .gslide,
.glightbox-container .gslide-inner-content,
.glightbox-container .ginner-container,
.glightbox-container .gcontainer {
    overflow: visible !important;
}

/* ============================================
   NAVIGATION BUTTONS - ALWAYS VISIBLE
   ============================================ */

.glightbox-container .gprev,
.glightbox-container .gnext {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 100002 !important;
    width: 50px !important;
    height: 50px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: background 0.2s ease, border-color 0.2s ease !important;
}

.glightbox-container .gprev {
    left: 20px !important;
    right: auto !important;
}

.glightbox-container .gnext {
    right: 20px !important;
    left: auto !important;
}

.glightbox-container .gprev:hover,
.glightbox-container .gnext:hover {
    background: rgba(0, 0, 0, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
}

.glightbox-container .gprev svg,
.glightbox-container .gnext svg {
    width: 20px !important;
    height: 20px !important;
    fill: #fff !important;
}

/* Close button */
.glightbox-container .gclose {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    z-index: 100003 !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: background 0.2s ease, border-color 0.2s ease !important;
}

.glightbox-container .gclose:hover {
    background: rgba(0, 0, 0, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
}

.glightbox-container .gclose svg {
    width: 16px !important;
    height: 16px !important;
    fill: #fff !important;
}

/* Prevent theme button styles from interfering */
.glightbox-container button.gprev,
.glightbox-container button.gnext,
.glightbox-container button.gclose {
    background-color: rgba(0, 0, 0, 0.6) !important;
    color: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
    line-height: 1 !important;
    font-size: 0 !important;
    min-width: auto !important;
    min-height: auto !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* === WordPress admin bar fix === */
body.admin-bar .glightbox-container,
body.admin-bar .goverlay {
    top: 0 !important;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .glightbox-container .gprev {
        left: 10px !important;
        width: 40px !important;
        height: 40px !important;
    }

    .glightbox-container .gnext {
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
    }

    .glightbox-container .gclose {
        top: 10px !important;
        right: 10px !important;
        width: 38px !important;
        height: 38px !important;
    }

    .glightbox-container .gprev svg,
    .glightbox-container .gnext svg {
        width: 16px !important;
        height: 16px !important;
    }

    .glightbox-container .gclose svg {
        width: 14px !important;
        height: 14px !important;
    }

    .glightbox-container .gslide-image img {
        max-width: 95vw !important;
        max-height: 80vh !important;
    }
}

/* =============================================
   Elementor Lightbox fixes (V7.2)
   - Keep toolbar/close inside viewport
   - Ensure arrows are clickable/visible
   ============================================= */

.elementor-lightbox .dialog-widget-content{
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  transform: none !important;
}

.elementor-lightbox .dialog-close-button{
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  right: auto !important;
  z-index: 999999 !important;
}

.elementor-lightbox .elementor-slideshow__header{
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 999998 !important;
  padding-top: max(12px, env(safe-area-inset-top)) !important;
  padding-left: max(56px, env(safe-area-inset-left)) !important;
  padding-right: max(12px, env(safe-area-inset-right)) !important;
}

.elementor-lightbox .elementor-swiper-button,
.elementor-lightbox .swiper-button-next,
.elementor-lightbox .swiper-button-prev{
  position: fixed !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 999999 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.elementor-lightbox .elementor-swiper-button-prev,
.elementor-lightbox .swiper-button-prev{
  left: 12px !important;
}

.elementor-lightbox .elementor-swiper-button-next,
.elementor-lightbox .swiper-button-next{
  right: 12px !important;
}

/* Extra: if theme sets overflow hidden on body/html, keep controls visible */
.elementor-lightbox{
  overflow: visible !important;
}
