* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Gallery Container */
.gallery-container {
    width: 100vw;
    max-width: 100vw;
    margin: 0px 0px 20px 0;
    padding: 0;
    margin-left: 50%;
    transform: translateX(-50%);
}

/* Main Gallery */
.gallery {
    width: 100%;
    height: 70vh;
    position: relative;
    overflow: hidden;
    background-color: #000;
}

/* Grid Layout */
.carousel {
    display: grid;
    grid-gap: 2px;
    grid-template-columns: auto;
    height: 100%;
    width: 100%;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.carousel::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
}

.carousel {
    overflow: -moz-scrollbars-none;
    -ms-overflow-style: none;
}

/* Photo containers */
.photo {
    background-size: cover !important;
    background-position: center;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.photo:hover {
    opacity: 0.8;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-photo {
    width: 25vw;
    min-width: 200px;
}

.carousel-photo:first-child {
    width: 50vw;
    min-width: 400px;
}

/* Navigation Buttons */
.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 16px;
    cursor: pointer;
    font-size: 24px;
    z-index: 10;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.btn-left {
    left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.btn-right {
    right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

/* View Images Button */
.more-btn {
    position: absolute;
    bottom: -56px;
    left: 20px;
    background: #2D587A;
    color: white;
    border: none;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 900;
    text-transform: capitalize;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.more-btn:hover {
    background: #1D2F45;
}

/* Modal/Lightbox */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.close {
    position: absolute;
    top: -50px;
    right: 0;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ccc;
}

/* Modal Navigation */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 20px;
    cursor: pointer;
    font-size: 32px;
    z-index: 1001;
    transition: background-color 0.3s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.9);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

/* Modal Counter */
.modal-counter {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: bold;
}

/* Loading Placeholder */
.loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-placeholder.active {
    display: flex;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2D587A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Photo Loading State */
.photo .loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.photo .loading .spinner {
    width: 30px;
    height: 30px;
    border-width: 3px;
}

/* Mobile Counter */
.mobile-counter {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    z-index: 15;
    backdrop-filter: blur(10px);
    min-width: 60px;
    text-align: center;
    display: none; /* Escondido por padrão, só aparece no mobile */
}

/* Responsive Design - Desktop styles remain unchanged */

@media (max-width: 600px) {
    .gallery-container {
        padding: 0 8px;
        margin: 8px 0;
    }
    
    .gallery {
        height: 55vh;
        min-height: 250px;
        max-height: 400px;
    }
    
    .carousel {
        padding: 0 12px;
        gap: 6px;
    }
    
    .carousel-photo {
        width: 90vw;
        min-width: 250px;
        max-width: 350px;
    }
    
    .carousel-photo:first-child {
        width: 90vw;
        min-width: 250px;
        max-width: 350px;
    }
    
    .mobile-counter {
        bottom: 12px;
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .modal-nav {
        padding: 12px;
        font-size: 20px;
    }
    
    .modal-prev {
        left: 8px;
    }
    
    .modal-next {
        right: 8px;
    }
    
    .close {
        top: -35px;
        font-size: 24px;
    }
    
    .modal-counter {
        bottom: -40px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .gallery {
        height: 50vh;
        min-height: 200px;
        max-height: 350px;
    }
    
    .carousel {
        padding: 0 8px;
        gap: 4px;
    }
    
    .carousel-photo {
        width: 95vw;
        min-width: 220px;
        max-width: 300px;
    }
    
    .carousel-photo:first-child {
        width: 95vw;
        min-width: 220px;
        max-width: 300px;
    }
    
    .mobile-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 5px 10px;
        min-width: 50px;
    }
    
    .photo {
        border-radius: 6px;
    }
}

/* Hide buttons when not needed */
.gallery-btn.hidden {
    display: none;
}

/* Grid areas - dynamic based on number of images */
.carousel.grid-layout {
    display: grid;
    grid-gap: 2px;
    grid-template-rows: calc(50% - 1px) calc(50% - 1px);
}

/* Smooth scrolling for carousel */
.carousel {
    scroll-behavior: smooth;
}

/* Image fade-in effect */
.photo img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo img.loaded {
    opacity: 1;
}

/* Error state for images */
.photo.error {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.photo.error img {
    display: none;
}

/* Mobile-specific improvements */
@media (max-width: 960px) {
    .mobile-counter {
        display: block; /* Mostrar contador no mobile */
    }
    .gallery-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        transform: none;
        margin-left: 0;
        overflow: visible;
    }
    
    .gallery {
        height: 60vh;
        min-height: 300px;
        max-height: 500px;
        width: 100%;
        overflow: visible;
        position: relative;
    }
    
    .carousel {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        height: 100%;
        width: 100%;
        gap: 8px;
        padding: 0 16px;
        -webkit-overflow-scrolling: touch; /* Melhor scroll no iOS */
    }
    
    .carousel-photo {
        width: 85vw;
        min-width: 280px;
        max-width: 400px;
        height: 100%;
        flex-shrink: 0;
        scroll-snap-align: center;
    }
    
    .carousel-photo:first-child {
        width: 85vw;
        min-width: 280px;
        max-width: 400px;
    }
    
    .photo {
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        position: relative;
    }
    
    .gallery-btn {
        display: none;
    }
    
    .more-btn {
        display: none;
    }
    
    /* Melhorar scroll horizontal */
    .carousel::-webkit-scrollbar {
        height: 4px;
        width: auto;
    }
    
    .carousel::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    .carousel::-webkit-scrollbar-thumb {
        background: #2D587A;
        border-radius: 2px;
    }
    
    .carousel::-webkit-scrollbar-thumb:hover {
        background: #1D2F45;
    }
    

    
    /* Garantir que as imagens sejam clicáveis */
    .photo {
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* Melhorar feedback visual no toque */
    .photo:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}
