/**
 * Invisible Gallery Widget Styles - Based on Advanced Grid Gallery
 * 
 * Copyright (C) 2024 Winfo.SK s.r.o.
 * Website: https://winfo.sk
 * License: GPL v2 or later
 */

.igw-blank {
  width: 100%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Ensure container can expand for custom positioning */
  min-height: 100px;
}

/* Gradient overlay for better text readability */
.igw-blank::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 35%);
  pointer-events: none;
  z-index: 2;
  display: none; /* Hidden by default, controlled by Elementor */
}

/* Show gradient when enabled */
.igw-blank.igw-gradient-enabled::after {
  display: block;
}

/* When using custom positioning */
.igw-blank.igw-custom-position {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important; /* Force image to be visible outside container bounds */
  position: relative;
}

/* Container wrapper for the image to prevent cropping */
.igw-blank.igw-custom-position::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.igw-blank.igw-custom-position .igw-preview-image {
  position: absolute;
  /* Position will be set by Elementor controls */
  /* Ensure full image is always visible without cropping */
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  /* Use transform for precise positioning */
  transform: translate(-50%, -50%);
  transform-origin: center center;
  /* Ensure image scales to fit container */
  object-fit: contain !important;
  object-position: center !important;
}

/* Style the preview image */
.igw-preview-image {
  /* Default size - can be overridden by Elementor controls */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
  -webkit-transition: transform 0.3s ease;
  -moz-transition: transform 0.3s ease;
  -o-transition: transform 0.3s ease;
  display: block;
}



/* When prevent crop is enabled */
.igw-blank.igw-prevent-crop {
  overflow: visible !important;
}

.igw-blank.igw-prevent-crop .igw-preview-image {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
}



/* Maintain container boundaries for hover effect even when overflow is visible */
.igw-blank.igw-custom-position:hover {
  z-index: 10; /* Ensure hover image appears above other elements */
  overflow: visible !important;
}

/* Ensure transformed image stays visible on hover - maintain transform chain */
.igw-blank.igw-custom-position:hover .igw-preview-image {
  /* Zoom will be added to existing transform by Elementor */
  transform-origin: center center;
}

/* HOVER EFFECT - Zoom the image */
/* Note: Zoom intensity is now controlled by Elementor */
.igw-blank.igw-hover .igw-preview-image,
.igw-blank:hover .igw-preview-image {
  /* transform scale will be set by Elementor control */
  transform: scale(1.1); /* Default fallback */
}

/* Placeholder styling */
.igw-placeholder {
  background: #f7f7f7;
  color: #888;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

/* Custom Text Styling */
.igw-custom-text {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  display: inline-block;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
  text-decoration: none;
  line-height: 1.4;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Ensure HTML elements inside custom text inherit styles */
.igw-custom-text * {
  color: inherit;
  line-height: inherit;
}

.igw-custom-text p {
  margin: 0;
  padding: 0;
}

.igw-custom-text br {
  display: block;
  content: "";
  margin: 0.2em 0;
}

.igw-custom-text:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Ensure custom text stays above image and gradient */
.igw-blank .igw-custom-text {
  z-index: 10;
}

/* Ensure gradient doesn't cover the custom text */
.igw-blank::after {
  z-index: 2;
}

.igw-blank .igw-preview-image {
  z-index: 1;
}

/* ======================================================================= */
/* GOLDEN FRAME STYLES */
/* ======================================================================= */

/* Golden frame - positioned to create the offset effect */
.igw-golden-frame {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 100%;
  height: 100%;
  border: 3px solid #D4AF37;
  border-style: solid;
  pointer-events: none;
  z-index: 5;
  box-sizing: border-box;
}

/* Main container allows frame to overflow */
.igw-blank.igw-has-golden-frame {
  overflow: visible !important;
  position: relative;
}

/* Image wrapper clips the zoom effect */
.igw-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.igw-blank.igw-has-golden-frame .igw-image-wrapper .igw-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* Hover zoom for golden frame - contained within wrapper */
.igw-blank.igw-has-golden-frame:hover .igw-image-wrapper .igw-preview-image {
  transform: scale(1.1);
}

/* Ensure custom text stays above the frame */
.igw-blank.igw-has-golden-frame .igw-custom-text {
  z-index: 10;
}

/* Ensure gradient overlay stays above image but below frame */
.igw-blank.igw-has-golden-frame::after {
  z-index: 2;
}

/* Mobile responsive adjustments for custom text */
@media (max-width: 768px) {
  .igw-custom-text {
    bottom: 15px;
    left: 15px;
    padding: 8px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .igw-custom-text {
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ======================================================================= */
/* CUSTOM LIGHTBOX STYLES - COPIED FROM A_GALERIA_PLUGIN WITH EXACT FUNCTIONALITY */
/* ======================================================================= */

/* Enhanced Custom Lightbox Styles - WITH MOBILE SWIPE AND CLOSE BUTTON ON LEFT */
.igw-lightbox-open {
    overflow: hidden !important;
}

.igw-custom-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Touch action for mobile swipe support */
    touch-action: pan-y pinch-zoom;
}

.igw-custom-lightbox.swipe-enabled {
    touch-action: pan-y pinch-zoom;
}

/* Full-screen swipe area for drag-to-close */
.igw-lightbox-fullscreen-swipe-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    touch-action: pan-y pinch-zoom;
    pointer-events: auto;
}

.igw-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.igw-lightbox-container {
    position: relative;
    width: 100%;
    height: 90%;
    max-width: 100%; /* Changed from 1400px */
    max-height: 95vh; /* Increased from 90vh */
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
}

.igw-lightbox-header {
    display: none; /* Hide the header completely */
}

.igw-lightbox-counter {
    color: white;
    font-size: 16px;
    font-weight: 500;
    position: fixed;
    top: 10px;
    left: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.igw-lightbox-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    padding-bottom: 4px !important;
}

.igw-lightbox-close:hover {
    background: rgba(255, 0, 0, 0.3);
    transform: scale(1.1);
}

/* Ensure perfect centering for close button icon */
.igw-lightbox-close {
    line-height: 1;
    text-align: center;
    padding: 0;
    font-family: inherit;
}

.igw-lightbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    padding: 0; /* Removed padding to give image more space */
    min-height: 0; /* Allow flex shrinking */
    /* Touch handling for mobile swipe */
    touch-action: pan-y pinch-zoom;
}

/* DESKTOP: Side arrows (default behavior) - Now hidden on tablets and mobile */
.igw-lightbox-arrow {
    position: absolute;
    top: 50%;
    left: 97%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: none; /* Hide arrows by default */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(10px);
    font-size: 30px;
    font-weight: 300;
    touch-action: manipulation;
    padding-bottom: 14px !important;
}

.igw-lightbox-arrow:hover {
    background: #c36;
    transform: translate(-50%, -50%) scale(1.1);
}

.igw-lightbox-arrow:not(:hover) {
    background: rgba(255, 255, 255, 0.1) !important;
}

.igw-lightbox-arrow:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.igw-lightbox-prev {
    left: 50px;
}

.igw-lightbox-next {
    right: 20px;
}

/* Show arrows only on large desktop screens (larger than tablets) */
@media (min-width: 1025px) {
    .igw-lightbox-arrow {
        display: flex;
    }
}

/* Thumbnail Preview Container - Auto-width for number of pictures */
.igw-lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    max-width: 80%;
    overflow: hidden;
    z-index: 15;
    transition: opacity 0.3s ease;
    /* AUTO WIDTH - width depends on the number of thumbnails */
    width: auto !important;
    min-width: 0;
    white-space: nowrap;
    /* COMPLETELY disable interaction during drag gestures */
    pointer-events: none !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    /* Ensure no interference with swipe */
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Enable thumbnails only when not dragging */
.igw-custom-lightbox:not(.dragging-gesture) .igw-lightbox-thumbnails {
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.igw-lightbox-thumbnail {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
    /* Inherit interaction state from container */
    pointer-events: inherit;
    touch-action: inherit;
    /* Create isolated interaction zone */
    position: relative;
    z-index: 1;
}

/* Create a click-through overlay specifically for thumbnail area */
.igw-lightbox-thumbnails::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    z-index: -1;
    pointer-events: none !important;
    touch-action: pan-y !important;
}

.igw-lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.igw-lightbox-thumbnail.active {
    border-color: #fff;
    opacity: 1;
    transform: scale(1.1);
}

.igw-lightbox-thumbnail:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Adjust container padding when thumbnails are shown */
.igw-lightbox-container.has-thumbnails .igw-lightbox-content {
    padding-bottom: 120px;
}

/* MOBILE AND TABLET: Completely hide all arrows */
@media (max-width: 1024px) {
    /* Hide all arrow-related elements */
    .igw-lightbox-arrow,
    .igw-lightbox-prev,
    .igw-lightbox-next,
    .igw-lightbox-arrows-container {
        display: none !important;
        visibility: hidden !important;
    }
    
    .igw-lightbox-content {
        flex-direction: column;
        padding: 0;
        height: 100%;
        justify-content: center;
    }
    
    .igw-lightbox-image-container {
        margin: 0;
        flex: 0 1 auto; /* Allow shrinking but maintain aspect ratio */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }
    
    .igw-lightbox-text-container {
        margin: 10px 0;
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
        flex-shrink: 0;
        text-align: center;
    }
}

/* Enhanced Image Container with Text Display - SCALABLE IMAGES */
.igw-lightbox-image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0; /* Removed all margins */
    max-height: 100%;
    min-height: 0; /* Allow flex shrinking */
    position: relative;
    /* Touch handling for mobile swipe */
    touch-action: pan-y pinch-zoom;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    /* Default smooth transition when not dragging */
    transition: transform 0.2s ease;
    /* Ensure pointer events work */
    pointer-events: auto;
}

/* SWIPE SUPPORT: Touch area for swipe gestures (mobile and PC) */
.igw-lightbox-image-container.swipe-enabled {
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: grab;
}

/* Remove transition during drag for immediate feedback */
.igw-lightbox-image-container.dragging {
    cursor: grabbing !important;
    transition: none !important;
}

/* DEFAULT: Lightbox image with customizable scaling - uses Elementor controls */
.igw-lightbox-image {
    max-width: 100%; /* Full width available */
    max-height: 90vh; /* Use most of viewport height */
    min-height: 0; /* Allow flex shrinking */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    margin: 0; /* No margins */
    background: transparent;
    transition: opacity 0.15s ease; /* Faster transition */
    flex-shrink: 1; /* Allow shrinking */
    display: block;
    width: auto; /* Auto width to maintain aspect ratio */
    height: auto; /* Auto height to maintain aspect ratio */
    /* Prevent image from interfering with drag */
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    /* Support for pinch-to-zoom transforms */
    transform-origin: center center;
    will-change: transform;
}

/* Text container for title, alt text, and category */
.igw-lightbox-text-container {
    width: 100%;
    max-width: 700px; /* Increased from 600px */
    padding: 0 20px;
    box-sizing: border-box;
    flex-shrink: 0; /* Don't shrink text */
    margin-top: 20px; /* Changed from absolute positioning */
    position: relative; /* Changed from absolute */
}

/* Individual text elements - Enhanced styling */
.igw-lightbox-title {
    color: white;
    margin-bottom: 12px; /* Increased spacing */
    padding: 10px 18px; /* Increased padding */
    background: rgba(0, 0, 0, 0.8);
    border-radius: 25px; /* More rounded */
    display: inline-block;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 16px; /* Increased font size */
    font-weight: 600; /* Made bolder */
    border: 1px solid rgba(255, 255, 255, 0.2); /* Enhanced border */
}

.igw-lightbox-alt-text {
    color: white;
    margin-bottom: 10px; /* Increased spacing */
    padding: 12px 20px; /* Increased padding */
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px; /* More rounded */
    display: inline-block;
    word-wrap: break-word;
    line-height: 1.5;
    max-width: 100%;
    font-size: 15px; /* Increased font size */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.igw-lightbox-category {
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 16px; /* Increased padding */
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px; /* More rounded */
    display: inline-block;
    font-size: 14px; /* Increased font size */
    font-weight: 500; /* Made bolder */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Hide elements when empty - IMPORTANT */
.igw-lightbox-title:empty,
.igw-lightbox-alt-text:empty,
.igw-lightbox-category:empty {
    display: none !important;
}

/* Smooth transitions for text elements */
.igw-lightbox-title,
.igw-lightbox-alt-text,
.igw-lightbox-category {
    transition: all 0.3s ease;
}

/* Responsive adjustments for thumbnails - TABLETS USE SAME AS DESKTOP */
@media (max-width: 768px) {
    .igw-lightbox-thumbnails {
        max-width: 90%;
        padding: 8px;
        /* Auto-width: width adjusts to content */
        width: auto !important;
    }
    
    .igw-lightbox-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Mobile Responsive for Lightbox - Enhanced with Mobile Swipe Support */
@media (max-width: 768px) {
    .igw-lightbox-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    /* Counter and close button are now fixed positioned, so mobile styles are simplified */
    .igw-lightbox-counter {
        font-size: 14px;
        top: 10px;
        left: 20px;
        padding: 6px 12px;
    }
    
    .igw-lightbox-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 10px;
        right: 20px;
    }
    
    .igw-lightbox-content {
        padding: 20px 0; /* Reduced padding since no header/arrows */
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 0;
        width: 100%;
        box-sizing: border-box;
        /* Enhanced touch support for drag-to-close */
        touch-action: pan-y pinch-zoom;
        overscroll-behavior: contain;
    }
    
    .igw-lightbox-image-container {
        margin: 0;
        padding: 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
        flex: 0 1 auto;
        /* Enhanced drag-to-close support */
        position: relative;
        transition: transform 0.2s ease-out, opacity 0.1s ease-out;
    }
    
    /* Mobile: Center image properly */
    .igw-lightbox-image {
        max-height: 50vh; /* Leave room for text and arrows */
        max-width: 90%;
        margin: 0 auto;
        display: block;
        object-fit: contain;
    }
    
    .igw-lightbox-text-container {
        padding: 10px 15px;
        margin: 10px auto;
        max-width: none;
        text-align: center;
    }
    
    .igw-lightbox-title {
        margin-bottom: 8px;
        padding: 6px 14px;
        font-size: 14px;
    }
    
    .igw-lightbox-alt-text {
        margin-bottom: 6px;
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .igw-lightbox-category {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    /* Arrows completely removed on mobile - no styles needed */
    
    .igw-lightbox-thumbnails {
        position: fixed;
        bottom: 20px; /* No arrows to avoid */
        left: 50%;
        transform: translateX(-50%);
        max-width: 90%;
        padding: 6px;
        gap: 5px;
        z-index: 20;
        /* FIXED: Auto width for mobile thumbnails */
        width: auto !important;
        min-width: 0;
        /* COMPLETELY remove from touch/pointer interaction flow */
        pointer-events: none !important;
        touch-action: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        /* Make container completely non-interactive */
        -webkit-touch-callout: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .igw-lightbox-thumbnail {
        width: 40px;
        height: 40px;
        /* Create isolated click zone for thumbnails */
        pointer-events: auto !important;
        touch-action: manipulation !important;
        position: relative;
        z-index: 100;
        /* Isolate thumbnail from container interactions */
        isolation: isolate;
    }
    
    /* Drag-to-close visual feedback */
    .igw-lightbox-image-container.dragging-to-close {
        transition: none !important;
    }
}

@media (max-width: 480px) {
    .igw-lightbox-image-container {
        margin: 0 55px; /* Increased from 50px */
    }
    
    /* Small mobile: Ensure image scales properly */
    .igw-lightbox-image {
        max-height: 65vh; /* Small mobile default - can be overridden by Elementor */
        max-width: 98%; /* Small mobile default - can be overridden by Elementor */
        margin-bottom: 12px;
    }
    
    .igw-lightbox-text-container {
        padding: 0 10px;
    }
    
    .igw-lightbox-title {
        margin-bottom: 8px;
        padding: 7px 14px;
        font-size: 14px;
    }
    
    .igw-lightbox-alt-text {
        margin-bottom: 6px;
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .igw-lightbox-category {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .igw-lightbox-counter {
        font-size: 13px;
        top: 8px;
        left: 20px;
        padding: 5px 10px;
    }
    
    .igw-lightbox-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
        top: 8px;
        right: 20px;
    }
    
    .igw-lightbox-thumbnails {
        /* FIXED: Auto width for mobile thumbnails */
        width: auto !important;
        min-width: 0;
        max-width: 95%;
        padding: 4px;
        gap: 3px;
        /* COMPLETELY disable interaction during drag gestures - MOBILE */
        pointer-events: none !important;
        touch-action: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        /* Ensure no interference with swipe on mobile */
        -webkit-touch-callout: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Enable mobile thumbnails only when not dragging */
    .igw-custom-lightbox:not(.dragging-gesture) .igw-lightbox-thumbnails {
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
}

/* Landscape orientation on mobile - optimize for larger images */
@media (max-width: 768px) and (orientation: landscape) {
    .igw-lightbox-image {
        max-height: 80vh; /* Landscape mobile default - can be overridden by Elementor */
        max-width: 90%; /* Use more screen space in landscape */
    }
    
    .igw-lightbox-text-container {
        margin-top: 10px;
    }
}

/* NEW: Responsive scaling for different lightbox size presets */
@media (max-width: 768px) {
    /* Small preset on mobile */
    .igw-lightbox-image[data-preset="small"] {
        max-height: 50vh !important;
        max-width: 85% !important;
    }
    
    /* Medium preset on mobile */
    .igw-lightbox-image[data-preset="medium"] {
        max-height: 60vh !important;
        max-width: 90% !important;
    }
    
    /* Large preset on mobile */
    .igw-lightbox-image[data-preset="large"] {
        max-height: 70vh !important;
        max-width: 95% !important;
    }
    
    /* Extra large preset on mobile */
    .igw-lightbox-image[data-preset="extra-large"] {
        max-height: 75vh !important;
        max-width: 98% !important;
    }
    
    /* Full screen preset on mobile */
    .igw-lightbox-image[data-preset="full-screen"] {
        max-height: 85vh !important;
        max-width: 100% !important;
    }
    
    .igw-lightbox-container[data-preset="full-screen"] {
        width: 100% !important;
        height: 100% !important;
    }
    
    .igw-lightbox-image-container[data-preset="full-screen"] {
        margin: 0 45px !important;
    }
}

@media (max-width: 480px) {
    /* Adjust presets for very small screens */
    .igw-lightbox-image[data-preset="small"] {
        max-height: 45vh !important;
        max-width: 90% !important;
    }
    
    .igw-lightbox-image[data-preset="medium"] {
        max-height: 55vh !important;
        max-width: 95% !important;
    }
    
    .igw-lightbox-image[data-preset="large"] {
        max-height: 65vh !important;
        max-width: 98% !important;
    }
    
    .igw-lightbox-image[data-preset="extra-large"],
    .igw-lightbox-image[data-preset="full-screen"] {
        max-height: 70vh !important;
        max-width: 100% !important;
    }
}

/* MOBILE SWIPE LIGHTBOX TRANSITIONS and DRAG-TO-CLOSE - Enhanced */
/* Remove all transitions during active dragging for smooth feedback */
.igw-lightbox-image-container.dragging {
    transition: none !important;
}

/* Loading state during transitions */
.igw-lightbox-image.swipe-loading {
    opacity: 0.5;
    /* Use same transition as main image */
}

/* Enhanced drag-to-close states */
.igw-custom-lightbox.drag-closing {
    pointer-events: none;
}

.igw-lightbox-image-container.drag-closing {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Touch area enhancement for better mobile experience */
@media (max-width: 768px) {
    .igw-lightbox-image-container {
        padding: 20px 10px;
        min-height: 60vh;
        justify-content: center;
    }
    
    /* Increase touch target area */
    .igw-lightbox-image-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: -20px;
        right: -20px;
        bottom: 0;
        z-index: 1;
        pointer-events: auto;
    }
    
    .igw-lightbox-image {
        position: relative;
        z-index: 2;
    }
}

/* Touch-friendly sizing for mobile */
@media (max-width: 768px) {
    .igw-lightbox-close {
        min-width: 40px;
        min-height: 40px;
        touch-action: manipulation;
    }
}

/* Pinch-to-zoom support styles */
.igw-lightbox-image.zooming {
    transition: none !important;
}

.igw-lightbox-image-container.zoom-active {
    overflow: visible !important;
}

/* Ensure smooth zoom transitions */
.igw-lightbox-image {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

/* Zoom indicators for accessibility */
.igw-zoom-indicator {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.igw-zoom-indicator.active {
    opacity: 1;
}

/* Lightbox Performance Optimizations */
/* will-change is set dynamically in JavaScript when needed */

/* Accessibility Improvements */
.igw-lightbox-close:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .igw-lightbox-title,
    .igw-lightbox-alt-text,
    .igw-lightbox-category {
        background: rgba(0, 0, 0, 0.95) !important;
        border: 2px solid #ffffff !important;
        color: #ffffff !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .igw-lightbox-close {
        transition: none !important;
    }
    
    .igw-lightbox-title,
    .igw-lightbox-alt-text,
    .igw-lightbox-category {
        animation: none !important;
        transition: none !important;
    }
    
    /* Disable lightbox swipe transitions */
    .igw-custom-lightbox * {
        transition: none !important;
    }
}

/* Responsive positioning for tablets */
@media (max-width: 1024px) {
  .elementor-tablet .igw-blank.igw-custom-position .igw-preview-image {
    /* Elementor will inject tablet-specific positioning here */
  }
}

/* Responsive positioning for mobile */
@media (max-width: 767px) {
  .elementor-mobile .igw-blank.igw-custom-position .igw-preview-image {
    /* Elementor will inject mobile-specific positioning here */
  }
}