/* Gallery Complete Fix CSS */

/* Gallery section base styles */
#gallery {
    padding: 60px 0;
    background: #f8f8f8;
}

/* Ensure gallery title is visible */
#gallery .elementor-heading-title {
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeInUp 0.8s ease-out;
    text-align: center;
    font-size: 48px;
    font-weight: 700;
    color: #333;
    margin-bottom: 40px;
    position: relative;
    z-index: 5;
}

/* Fix for invisible heading widget */
#gallery .elementor-element-8419b72 {
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    text-align: center;
}

/* Ensure heading widget container is visible */
#gallery .elementor-widget-heading {
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 30px;
}

/* Remove invisible class effect in gallery section */
#gallery .elementor-invisible {
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeInUp 0.8s ease-out;
}

/* Add animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gallery carousel container - center it */
#gallery .elementor-image-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: visible !important; /* Allow center slide to grow */
}

/* Center the gallery carousel */
#gallery .swiper-wrapper {
    display: flex;
    align-items: center;
}

/* Gallery swiper container */
#gallery .swiper {
    overflow: visible !important;
    padding: 20px 0; /* Add vertical padding for scale effect */
}

/* Make center slide larger and focused */
#gallery .swiper-slide {
    transition: all 0.3s ease;
    opacity: 0.5;
    transform: scale(0.8);
    filter: blur(1px);
}

/* Highlight center slide - make it bigger and focused */
#gallery .swiper-slide-active {
    opacity: 1 !important;
    transform: scale(1.05) !important;
    z-index: 10;
    filter: blur(0) !important;
}

/* Adjacent slides */
#gallery .swiper-slide-prev,
#gallery .swiper-slide-next {
    opacity: 0.8;
    transform: scale(0.9);
    filter: blur(0);
}

/* Gallery grid layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Gallery items */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

/* Gallery carousel specific */
.gallery-carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-carousel .swiper-slide {
    height: auto;
}

.gallery-carousel img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Gallery navigation arrows */
#gallery .elementor-swiper-button-prev,
#gallery .elementor-swiper-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#gallery .elementor-swiper-button-prev:hover,
#gallery .elementor-swiper-button-next:hover {
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

#gallery .elementor-swiper-button-prev {
    left: 20px;
}

#gallery .elementor-swiper-button-next {
    right: 20px;
}

/* Ensure proper spacing for carousel */
#gallery .elementor-image-carousel {
    padding: 0 100px; /* Space for navigation arrows and scale effect */
}

/* Center the widget container */
#gallery .elementor-widget-image-carousel {
    max-width: 100%;
    margin: 0 auto;
}

/* Ensure images fill their containers */
#gallery .swiper-slide img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Lightbox overlay styles */
.gallery-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    cursor: pointer;
}

.gallery-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}

.gallery-lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.3s ease;
}

.gallery-lightbox-close:hover {
    color: #ddd;
}

/* Gallery navigation */
.gallery-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.gallery-nav button {
    padding: 8px 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.gallery-nav button.active,
.gallery-nav button:hover {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* Gallery title and description */
.gallery-header {
    text-align: center;
    margin-bottom: 40px;
}

.gallery-header h2 {
    font-size: 36px;
    margin-bottom: 10px;
    color: #333;
}

.gallery-header p {
    font-size: 16px;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Masonry layout option */
.gallery-masonry {
    column-count: 4;
    column-gap: 20px;
}

.gallery-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
}

/* Mobile responsive */
@media (max-width: 1024px) {
    .gallery-masonry {
        column-count: 3;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .gallery-masonry {
        column-count: 2;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .gallery-header h2 {
        font-size: 28px;
    }
    
    .gallery-nav {
        flex-wrap: wrap;
    }
    
    .gallery-nav button {
        padding: 6px 15px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-masonry {
        column-count: 1;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading state */
.gallery-loading {
    text-align: center;
    padding: 40px;
}

.gallery-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ensure gallery images are visible */
.gallery-item img,
.gallery-carousel img {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #gallery {
        padding: 40px 0;
    }
    
    #gallery .elementor-image-carousel-wrapper {
        padding: 0 15px;
    }
    
    #gallery .elementor-image-carousel {
        padding: 0 50px; /* Smaller padding for arrows on mobile */
    }
    
    /* Reset transforms for mobile - show single slide */
    #gallery .swiper-slide {
        opacity: 1;
        transform: scale(1);
    }
    
    #gallery .swiper-slide-active,
    #gallery .swiper-slide-prev,
    #gallery .swiper-slide-next {
        opacity: 1;
        transform: scale(1);
    }
    
    /* Smaller navigation buttons on mobile */
    #gallery .elementor-swiper-button-prev,
    #gallery .elementor-swiper-button-next {
        width: 40px;
        height: 40px;
    }
    
    #gallery .elementor-swiper-button-prev {
        left: 10px;
    }
    
    #gallery .elementor-swiper-button-next {
        right: 10px;
    }
    
    /* Gallery grid responsive */
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    #gallery .elementor-image-carousel {
        padding: 0 35px; /* Even smaller padding for very small screens */
    }
    
    #gallery .elementor-swiper-button-prev,
    #gallery .elementor-swiper-button-next {
        width: 35px;
        height: 35px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr; /* Single column on very small screens */
        gap: 10px;
        padding: 10px;
    }
}