/* ========================================
   GALERIA INTERATIVA - ESTILOS MODERNOS
   ======================================== */

/* Container principal da galeria */
.property-gallery-section {
    background: #f8f9fa;
}

/* Carrossel principal */
#propertyCarousel {
    position: relative;
    border-radius: 12px !important;
    overflow: hidden;
}

#propertyCarousel .carousel-item img {
    transition: transform 0.5s ease;
}

#propertyCarousel:hover .carousel-item img {
    transform: scale(1.02);
}

/* Controles do carrossel */
.carousel-control-prev,
.carousel-control-next {
    width: 60px;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}

.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next {
    opacity: 1;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: linear-gradient(90deg, rgba(0,0,0,0.5), transparent);
}

.carousel-control-next:hover {
    background: linear-gradient(-90deg, rgba(0,0,0,0.5), transparent);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 30px;
    height: 30px;
    background-size: 100%;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Grid de miniaturas */
.gallery-item {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.gallery-item img {
    transition: transform 0.3s ease, filter 0.3s ease;
    object-fit: cover;
}

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

.gallery-item:hover img {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Overlay ao hover nas miniaturas */
.gallery-item::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 32px;
    color: white;
    background: rgba(0,0,0,0.6);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Modal da galeria (lightbox) */
#galleryModal .modal-dialog {
    max-width: 95vw;
    margin: 1rem auto;
}

#galleryModal .modal-content {
    background: rgba(0, 0, 0, 0.95) !important;
    border: none !important;
}

#galleryModal .modal-body {
    padding: 0;
    position: relative;
}

#galleryModal .carousel-item img {
    max-height: 90vh;
    width: auto;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
}

/* Botão fechar do modal */
#galleryModal .btn-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1060;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

#galleryModal .btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Contador de imagens */
.carousel-counter {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.5px;
    user-select: none;
    animation: fadeIn 0.3s ease;
}

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

/* Botão fullscreen */
.btn-fullscreen {
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3) !important;
}

.btn-fullscreen:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.95) !important;
    border-color: rgba(0,0,0,0.2) !important;
}

/* Loading spinner para imagens */
.carousel-item img[style*="opacity: 0"] {
    position: relative;
}

.carousel-item img[style*="opacity: 0"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsivo - Mobile */
@media (max-width: 768px) {
    #propertyCarousel .carousel-item img {
        height: 300px !important;
    }
    
    .gallery-item img {
        height: 80px !important;
    }
    
    .carousel-counter {
        font-size: 12px;
        padding: 6px 12px;
        bottom: 10px;
        right: 10px;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 20px;
        height: 20px;
    }
    
    #galleryModal .carousel-item img {
        max-height: 70vh;
    }
    
    .btn-fullscreen {
        width: 35px !important;
        height: 35px !important;
        font-size: 14px;
        right: 50px !important;
        top: 15px !important;
    }
}

/* Animações suaves */
.carousel-item {
    transition: transform 0.6s ease-in-out;
}

/* Efeito de borda ao focar (acessibilidade) */
.gallery-item:focus,
.carousel-control-prev:focus,
.carousel-control-next:focus,
.btn-close:focus,
.btn-fullscreen:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* Melhorias visuais adicionais */
.property-gallery-section .container {
    position: relative;
}

/* Gradiente sutil no carrossel principal */
#propertyCarousel::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
    z-index: 1;
    pointer-events: none;
}

/* Indicador de carregamento global */
.carousel-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Scroll suave para miniaturas */
.row.g-2 {
    scroll-behavior: smooth;
}