/* Advanced Grid Gallery Styles - Enhanced with Alt Text, Mobile Swipe, and Larger Lightbox */

.agg-gallery-wrapper {
    width: 100%;
    position: relative;
}

/* Filter Bar Styles */
.agg-filter-bar {
    margin-bottom: 30px;
    text-align: center;
}

.agg-filter-btn {
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 20px;
    margin: 0 5px 10px 5px;
    background: #f8f9fa;
    color: #333;
    border-radius: 25px;
    outline: none;
    position: relative;
    overflow: hidden;
}

/* Hover animation - only when enabled */
.agg-gallery-wrapper[data-filter-hover-effect="true"] .agg-filter-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.agg-gallery-wrapper[data-filter-hover-effect="true"] .agg-filter-btn:hover:before {
    left: 100%;
}

.agg-filter-btn:hover,
.agg-filter-btn.active {
    background: #007cba;
    color: #fff;
}

.agg-filter-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.agg-filter-btn.processing {
    opacity: 0.7;
    pointer-events: none;
}

/* Gallery Grid Styles */
.agg-gallery-grid {
    display: grid;
    grid-gap: 15px;
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grid Column Classes */
.agg-gallery-grid.columns-1 { grid-template-columns: repeat(1, 1fr); }
.agg-gallery-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.agg-gallery-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.agg-gallery-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }
.agg-gallery-grid.columns-5 { grid-template-columns: repeat(5, 1fr); }
.agg-gallery-grid.columns-6 { grid-template-columns: repeat(6, 1fr); }

/* Mobile Swipe Styles */
.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 10px;
    scroll-behavior: smooth;
}

.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid::-webkit-scrollbar {
    display: none;
}

.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid.dragging {
    scroll-behavior: auto;
    cursor: grabbing;
    user-select: none;
}

.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid.mobile-swipe-enabled {
    cursor: grab;
}

/* Mobile Swipe Grid Templates - Only on mobile */
@media (max-width: 768px) {
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid {
        grid-auto-flow: column;
        grid-auto-columns: calc((100% - 30px) / var(--mobile-columns, 2));
        grid-template-rows: auto;
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe.mobile-columns-1 .agg-gallery-grid {
        --mobile-columns: 1;
        grid-auto-columns: calc(100% - 20px);
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe.mobile-columns-2 .agg-gallery-grid {
        --mobile-columns: 2;
        grid-auto-columns: calc((100% - 30px) / 2);
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe.mobile-columns-3 .agg-gallery-grid {
        --mobile-columns: 3;
        grid-auto-columns: calc((100% - 40px) / 3);
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-item {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}

/* Responsive Grid - Standard behavior when swipe is disabled */
@media (max-width: 1024px) {
    .agg-gallery-grid.columns-5,
    .agg-gallery-grid.columns-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .agg-gallery-wrapper:not(.agg-mobile-swipe) .agg-gallery-grid.columns-3,
    .agg-gallery-wrapper:not(.agg-mobile-swipe) .agg-gallery-grid.columns-4,
    .agg-gallery-wrapper:not(.agg-mobile-swipe) .agg-gallery-grid.columns-5,
    .agg-gallery-wrapper:not(.agg-mobile-swipe) .agg-gallery-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Mobile Filter Improvements */
    .agg-filter-bar {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .agg-filter-btn {
        padding: 8px 16px;
        margin: 0;
        flex: 0 1 auto;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .agg-gallery-wrapper:not(.agg-mobile-swipe) .agg-gallery-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
    
    /* Better mobile filter layout */
    .agg-filter-bar {
        gap: 6px;
        padding: 0 10px;
    }
    
    .agg-filter-btn {
        padding: 7px 14px;
        min-width: 70px;
    }
    
    .agg-load-more-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .agg-load-more-btn,
    .agg-load-less-btn {
        margin: 0 !important;
        width: 100%;
        max-width: 200px;
    }
}

/* Gallery Item Styles */
.agg-gallery-item {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 8px;
    cursor: pointer;
    background: #f8f9fa;
    animation: scaleIn 0.5s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.agg-gallery-item:hover {
    transform: translateY(-5px);
}

.agg-item-inner {
    position: relative;
    width: 100%;
    flex: 1;
}

.agg-gallery-item img {
    width: 100%;
    height: auto;
    min-height: 350px; /* Increased from 250px */
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-radius: 8px;
}

.agg-gallery-item:hover img {
    transform: scale(1.05);
}

/* Alt Text Styles */
.agg-alt-text {
    padding: 8px 12px 12px 12px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    background: transparent;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    margin-top: auto;
    border-radius: 0 0 8px 8px;
}

/* Alt text responsive sizing */
@media (max-width: 768px) {
    .agg-alt-text {
        font-size: 13px;
        padding: 6px 10px 10px 10px;
    }
}

@media (max-width: 480px) {
    .agg-alt-text {
        font-size: 12px;
        padding: 5px 8px 8px 8px;
    }
}

/* Lazy Loading Styles */
.agg-lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.agg-loading {
    opacity: 0.7;
}

.agg-loaded {
    opacity: 1;
}

.agg-error {
    opacity: 0.5;
    background: #f0f0f0;
    position: relative;
}

.agg-error:after {
    content: "Image failed to load";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
}

/* Overlay Styles */
.agg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 8px;
    backdrop-filter: blur(2px);
}

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

.agg-overlay i,
.agg-overlay svg {
    color: #fff;
    font-size: 24px;
    transition: all 0.3s ease;
    fill: #fff;
    width: 24px;
    height: 24px;
}

.agg-gallery-item:hover .agg-overlay i,
.agg-gallery-item:hover .agg-overlay svg {
    transform: scale(1.2);
}

/* Load More/Less Button Styles */
.agg-load-more-container {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.agg-load-more-btn,
.agg-load-less-btn {
    background: #007cba;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    outline: none;
    position: relative;
    overflow: hidden;
    min-width: 120px;
    display: inline-block;
}

/* Hover animation - only when enabled */
.agg-gallery-wrapper[data-load-more-hover-effect="true"] .agg-load-more-btn:before,
.agg-gallery-wrapper[data-load-more-hover-effect="true"] .agg-load-less-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.agg-gallery-wrapper[data-load-more-hover-effect="true"] .agg-load-more-btn:hover:before,
.agg-gallery-wrapper[data-load-more-hover-effect="true"] .agg-load-less-btn:hover:before {
    left: 100%;
}

.agg-load-more-btn:hover,
.agg-load-less-btn:hover {
    background: #005a87;
}

.agg-load-more-btn:focus,
.agg-load-less-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.agg-load-more-btn:active,
.agg-load-less-btn:active {
    transform: translateY(0);
}

.agg-load-more-btn:disabled,
.agg-load-less-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.agg-load-less-btn {
    background: #6c757d;
}

.agg-load-less-btn:hover {
    background: #545b62;
}

/* Loading Animation */
.agg-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    margin-right: 8px;
    opacity: 0.8;
}

/* No Items Message */
.agg-no-items {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

/* Enhanced Custom Lightbox Styles - SCALABLE IMAGES */
.agg-lightbox-open {
    overflow: hidden !important;
}

.agg-custom-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.agg-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 10px 10px 0 0;
    position: absolute;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.agg-lightbox-counter {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.agg-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;
}

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

.agg-lightbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    padding: 20px;
    min-height: 0; /* Allow flex shrinking */
}

.agg-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(10px);
    font-size: 30px;
    font-weight: 300;
}

.agg-lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.agg-lightbox-prev {
    left: 20px;
}

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

/* Enhanced Image Container with Text Display - SCALABLE IMAGES */
.agg-lightbox-image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0 80px;
    max-height: 100%;
    min-height: 0; /* Allow flex shrinking */
}

/* DEFAULT: Lightbox image with customizable scaling - uses Elementor controls */
.agg-lightbox-image {
    max-width: 90%; /* Default - can be overridden by Elementor */
    max-height: 85vh; /* Default - can be overridden by Elementor */
    min-height: 0; /* Allow flex shrinking */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    background: transparent;
    transition: opacity 0.3s ease;
    flex-shrink: 1; /* Allow shrinking */
    position: absolute;
}

/* Text container for title, alt text, and category */
.agg-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 */
    position: absolute;
    bottom: 0;
}

/* Individual text elements - Enhanced styling */
.agg-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 */
}

.agg-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);
}

.agg-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 */
.agg-lightbox-title:empty,
.agg-lightbox-alt-text:empty,
.agg-lightbox-category:empty {
    display: none !important;
}

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

/* Mobile Responsive for Lightbox - Enhanced with Scalable Images */
@media (max-width: 768px) {
    .agg-lightbox-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    
    .agg-lightbox-header {
        padding: 12px 15px;
        border-radius: 0;
    }
    
    .agg-lightbox-counter {
        font-size: 14px;
    }
    
    .agg-lightbox-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .agg-lightbox-content {
        padding: 15px 10px;
    }
    
    .agg-lightbox-image-container {
        margin: 0 60px;
    }
    
    /* Mobile: Ensure image scales properly within available space */
    .agg-lightbox-image {
        max-height: 70vh; /* Mobile default - can be overridden by Elementor */
        max-width: 95%; /* Mobile default - can be overridden by Elementor */
        margin-bottom: 15px;
    }
    
    .agg-lightbox-text-container {
        padding: 0 15px;
        max-width: none;
    }
    
    .agg-lightbox-title {
        margin-bottom: 10px;
        padding: 8px 16px;
        font-size: 15px;
    }
    
    .agg-lightbox-alt-text {
        margin-bottom: 8px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .agg-lightbox-category {
        padding: 6px 14px;
        font-size: 13px;
    }
    
    .agg-lightbox-arrow {
        width: 50px; /* Increased from 45px */
        height: 50px;
        font-size: 26px; /* Increased from 24px */
    }
    
    .agg-lightbox-prev {
        left: 10px;
    }
    
    .agg-lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .agg-lightbox-image-container {
        margin: 0 55px; /* Increased from 50px */
    }
    
    /* Small mobile: Ensure image scales properly */
    .agg-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;
    }
    
    .agg-lightbox-text-container {
        padding: 0 10px;
    }
    
    .agg-lightbox-title {
        margin-bottom: 8px;
        padding: 7px 14px;
        font-size: 14px;
    }
    
    .agg-lightbox-alt-text {
        margin-bottom: 6px;
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .agg-lightbox-category {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .agg-lightbox-arrow {
        width: 45px; /* Slightly larger than before */
        height: 45px;
        font-size: 24px;
    }
}

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

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

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

/* Hidden Categories Data */
.agg-categories-data {
    display: none !important;
}

/* Accessibility Improvements */
.agg-filter-btn:focus,
.agg-load-more-btn:focus,
.agg-load-less-btn:focus,
.agg-gallery-item:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
}

.agg-gallery-item:focus {
    border-radius: 8px;
}

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

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .agg-gallery-item,
    .agg-filter-btn,
    .agg-load-more-btn,
    .agg-load-less-btn,
    .agg-overlay,
    .agg-gallery-item img,
    .agg-lightbox-arrow,
    .agg-lightbox-close {
        transition: none !important;
    }
    
    .agg-gallery-grid,
    .agg-gallery-item {
        animation: none;
    }
    
    /* Remove all hover animations regardless of settings */
    .agg-filter-btn:before,
    .agg-load-more-btn:before,
    .agg-load-less-btn:before {
        display: none !important;
    }
    
    .agg-lightbox-title,
    .agg-lightbox-alt-text,
    .agg-lightbox-category {
        animation: none !important;
        transition: none !important;
    }
    
    /* Disable mobile swipe smooth scrolling for reduced motion */
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid {
        scroll-behavior: auto !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .agg-gallery-item {
        background: #2a2a2a;
    }
    
    .agg-filter-btn {
        background: #3a3a3a;
        color: #ffffff;
    }
    
    .agg-no-items {
        background: #2a2a2a;
        color: #cccccc;
        border-color: #555555;
    }
    
    .agg-alt-text {
        color: #e0e0e0;
        background: rgba(0, 0, 0, 0.1);
    }
}

/* Print Styles */
@media print {
    .agg-filter-bar,
    .agg-load-more-container,
    .agg-overlay,
    .agg-custom-lightbox {
        display: none !important;
    }
    
    .agg-gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-gap: 10px !important;
    }
    
    .agg-gallery-item {
        break-inside: avoid;
        box-shadow: none !important;
        transform: none !important;
        border: 1px solid #ddd;
    }
    
    .agg-gallery-item img {
        transform: none !important;
    }
    
    .agg-alt-text {
        color: #000 !important;
        background: transparent !important;
        border-top: 1px solid #ddd;
    }
}

/* Performance Optimizations */
.agg-gallery-wrapper {
    contain: layout style;
}

.agg-gallery-grid {
    contain: layout;
}

.agg-gallery-item {
    contain: layout style;
    will-change: transform, opacity;
}

.agg-gallery-item img {
    contain: layout;
    will-change: transform;
}

/* Mobile Swipe Performance */
.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid {
    will-change: scroll-position;
}

/* Elementor Editor Specific Styles */
.elementor-editor-active .agg-gallery-item {
    pointer-events: none;
}

.elementor-editor-active .agg-filter-btn,
.elementor-editor-active .agg-load-more-btn,
.elementor-editor-active .agg-load-less-btn {
    pointer-events: none;
}

/* Ensure Elementor style controls work properly */
.elementor-widget-advanced-grid-gallery .agg-filter-btn,
.elementor-widget-advanced-grid-gallery .agg-load-more-btn,
.elementor-widget-advanced-grid-gallery .agg-load-less-btn,
.elementor-widget-advanced-grid-gallery .agg-gallery-item img,
.elementor-widget-advanced-grid-gallery .agg-overlay {
    /* Let Elementor handle these styles */
}

/* Screen Reader Only Utility */
.agg-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Mobile Swipe Indicators */
.agg-gallery-wrapper.agg-mobile-swipe::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ccc, transparent);
    border-radius: 2px;
    opacity: 0.5;
    pointer-events: none;
}

@media (max-width: 768px) {
    .agg-gallery-wrapper.agg-mobile-swipe::after {
        display: block;
    }
}

@media (min-width: 769px) {
    .agg-gallery-wrapper.agg-mobile-swipe::after {
        display: none;
    }
}

/* Enhanced Mobile Swipe Scrollbar Styling */
@media (max-width: 768px) {
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid::-webkit-scrollbar {
        height: 4px;
        display: block;
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 2px;
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 2px;
    }
    
    .agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.5);
    }
}

/* Mobile Swipe Visual Feedback */
.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid.dragging .agg-gallery-item {
    pointer-events: none;
    user-select: none;
}

.agg-gallery-wrapper.agg-mobile-swipe .agg-gallery-grid.prevent-click .agg-gallery-item {
    pointer-events: none;
}

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