/* Carrusel principal optimizado */
.carousel-inner {
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    min-height: 400px;
    background-color: #f8f9fa; /* Fondo para evitar imágenes en blanco */
}

.carousel-item {
    transition: transform 0.6s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: block !important;
}

.carousel-item.active {
    opacity: 1;
    position: relative;
    z-index: 1;
}

.carousel-item-next,
.carousel-item-prev {
    z-index: 1;
    opacity: 1;
}

.carousel-item-next:not(.carousel-item-start),
.active.carousel-item-end {
    transform: translateX(100%);
}

.carousel-item-prev:not(.carousel-item-end),
.active.carousel-item-start {
    transform: translateX(-100%);
}

/* Imágenes del carrusel optimizadas */
.property-image {
    width: 100%;
    max-height: 500px;
    min-height: 400px;
    object-fit: contain; /* Cambiado de cover a contain para ver imágenes completas */
    background-color: #f8f9fa; /* Fondo para imágenes no cuadradas */
    display: block;
    margin: 0 auto;
}

/* Para mantener proporción en imágenes alargadas */
.image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    min-height: 400px;
    max-height: 500px;
    width: 100%;
}

/* Controles del carrusel mejorados */
.carousel-control-prev,
.carousel-control-next {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev {
    left: 15px;
}

.carousel-control-next {
    right: 15px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
    background-size: 100% 100%;
}

/* Miniaturas mejoradas */
.carousel-indicators.thumbnails {
    position: static;
    margin: 15px 0 0 0;
    padding: 0;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
}

.carousel-indicators.thumbnails::-webkit-scrollbar {
    height: 4px;
}

.carousel-indicators.thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.carousel-indicators.thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.carousel-indicators.thumbnails button {
    width: 90px;
    height: 70px;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0.6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: none;
    padding: 0;
    flex-shrink: 0;
}

.carousel-indicators.thumbnails button:hover {
    opacity: 0.9;
    border-color: var(--bs-primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.carousel-indicators.thumbnails button.active {
    opacity: 1;
    border-color: var(--bs-primary);
    border-width: 3px;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

.carousel-indicators.thumbnails button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.carousel-indicators.thumbnails button:hover img {
    transform: scale(1.05);
}

/* Contador de imágenes */
.carousel-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2;
}

/* Preloader para imágenes */
.carousel-item img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel-item.active img,
.carousel-item img.loaded {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .carousel-inner {
        min-height: 350px;
    }
    
    .property-image {
        min-height: 350px;
        max-height: 400px;
    }
    
    .image-container {
        min-height: 350px;
        max-height: 400px;
    }
    
    .carousel-indicators.thumbnails button {
        width: 75px;
        height: 60px;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 576px) {
    .carousel-inner {
        min-height: 300px;
    }
    
    .property-image {
        min-height: 300px;
        max-height: 350px;
    }
    
    .image-container {
        min-height: 300px;
        max-height: 350px;
    }
    
    .carousel-indicators.thumbnails button {
        width: 65px;
        height: 50px;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 35px;
        height: 35px;
    }
    
    .carousel-control-prev {
        left: 10px;
    }
    
    .carousel-control-next {
        right: 10px;
    }
}