/* Universal Gallery CSS */
* {
    box-sizing: border-box;
}


.image-container {
    /* max-width: 1200px; */
    margin: 0 auto;
    padding: 1rem;
}

/* Image Gallery Container Styles */
.imageGalleryContainer {
    margin-bottom: 3rem;
    cursor: pointer;
}

.imageGalleryContainer img {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border-radius: 8px;
    object-fit: cover;
}

.imageGalleryContainer img:hover {
    /* transform: scale(1.1); */
    filter: contrast(1.05);
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns for desktop */
    gap: 1rem;
}

.grid-layout img {
    width: 100%;
    height: 50vh;
    object-fit: cover; /* Ensures images fill the space without distortion */
}

/* Flex Layout */
.flex-layout {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.flex-layout img {
    flex: 1;
    min-width: 200px;
    height: 250px;
}

/* Single Column */
.single-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.single-column img {
    width: 100%;
    max-width: 600px;
    height: auto;
}

/* Gallery Modal Styles */
.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.gallery-modal.active {
    display: flex;
    animation: galleryFadeIn 0.3s ease-out;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gallery Controls */
.gallery-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    padding: 0.5rem;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ef4444;
}

.gallery-counter {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10001;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.8);
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 500;
}

.gallery-play-pause {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    padding: 0.75rem;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-play-pause:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.gallery-play-pause svg {
    width: 24px;
    height: 24px;
}

/* Fullscreen Button */
.gallery-fullscreen {
    position: absolute;
    top: 1rem;
    right: 5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10001;
    padding: 0.75rem;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-fullscreen:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.gallery-fullscreen svg {
    width: 24px;
    height: 24px;
}

/* Fullscreen Mode Styles */
.gallery-modal.fullscreen {
    background-color: black;
}

.gallery-modal.fullscreen .gallery-image {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 0;
}

.gallery-modal.fullscreen .gallery-image-container {
    max-width: 100vw;
    max-height: 100vh;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
    padding: 0.75rem;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
}

.gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-prev {
    left: 1rem;
}

.gallery-next {
    right: 1rem;
}

/* Gallery Image */
.gallery-image-container {
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: gallerySlideIn 0.3s ease-out;
}

/* Gallery Thumbnails */
.gallery-thumbnails {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    max-width: 90vw;
    overflow-x: auto;
    z-index: 10001;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.gallery-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.gallery-thumbnail:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.gallery-thumbnail.active {
    border-color: white;
    transform: scale(1.15);
}

/* Animations */
@keyframes galleryFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes gallerySlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .image-container {
        padding: 1rem;
    }

    /* Tablet and Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .grid-layout {
        grid-template-columns: repeat(1, 1fr); /* 2 columns for mobile/tablet */
    }
}

    .flex-layout img {
        min-width: 150px;
        height: 200px;
    }

    .gallery-nav {
        padding: 0.5rem;
    }

    .gallery-close {
        top: 0.5rem;
        right: 0.5rem;
    }

    .gallery-counter {
        top: 0.5rem;
        left: 0.5rem;
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }

    .gallery-thumbnail {
        width: 50px;
        height: 50px;
    }

    .gallery-image-container {
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    .gallery-prev {
        left: 0.5rem;
    }

    .gallery-next {
        right: 0.5rem;
    }
}

/* Hide extra images based on maxImages */
.imageGalleryContainer[data-max-images="1"] img:nth-child(n+2) { display: none; }
.imageGalleryContainer[data-max-images="2"] img:nth-child(n+3) { display: none; }
.imageGalleryContainer[data-max-images="3"] img:nth-child(n+4) { display: none; }
.imageGalleryContainer[data-max-images="4"] img:nth-child(n+5) { display: none; }
.imageGalleryContainer[data-max-images="5"] img:nth-child(n+6) { display: none; }
.imageGalleryContainer[data-max-images="6"] img:nth-child(n+7) { display: none; }
.imageGalleryContainer[data-max-images="7"] img:nth-child(n+8) { display: none; }
.imageGalleryContainer[data-max-images="8"] img:nth-child(n+9) { display: none; }
.imageGalleryContainer[data-max-images="9"] img:nth-child(n+10) { display: none; }
.imageGalleryContainer[data-max-images="10"] img:nth-child(n+11) { display: none; }