/* Carousel Styles */
.carousel-container {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    background-color: #f8fafc; /* Fondo claro por defecto */
}

.dark .carousel-container {
    background-color: #1e293b; /* Fondo oscuro para modo oscuro */
}

.carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: inherit;
}

.carousel-slide {
    position: relative;
    overflow: hidden;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center; /* valor base, se sobreescribe abajo si hay clase */
    transition: transform 0.3s ease;
    transform: scale(1.1); /* Zoom inicial */
}

/* Permitir recorte lateral personalizado en servicios (modelamiento, etc.) */
.carousel-slide img.object-left { object-position: left center !important; }
.carousel-slide img.object-right { object-position: right center !important; }

.carousel-container:hover .carousel-slide img {
    transform: scale(1.15); /* Efecto de zoom al pasar el mouse */
}

/* Hover effects */
.carousel-container:hover .carousel-slide img {
    transform: scale(1.05);
    cursor: zoom-in;
}

/* Dark mode adjustments */
.dark .carousel-container {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Estilos para el modal de vista previa */
.image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.image-preview-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.image-preview-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: block;
    object-fit: contain;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal close button */
.modal-close {
    position: absolute;
    top: 40px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
    transition: all 0.3s ease;
    opacity: 0.7;
    color: white;
    padding: 0;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

/* Modal navigation arrows */
.modal-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    opacity: 0.7;
    color: white;
}

.modal-nav-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.modal-nav-arrow.prev {
    left: 20px;
}

.modal-nav-arrow.next {
    right: 20px;
}

.modal-nav-arrow svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Carousel navigation arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    display: none; /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.carousel-container:hover .carousel-arrow {
    display: flex; /* Mostrar solo al hacer hover */
    opacity: 0.7;
    pointer-events: auto;
}

.carousel-arrow:hover {
    background-color: rgba(255, 255, 255, 0.9);
    opacity: 1 !important;
}

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

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

.carousel-arrow svg {
    width: 20px;
    height: 20px;
    fill: #1e40af;
}

/* Dark mode styles for carousel arrows */
.dark .carousel-arrow {
    background-color: rgba(0, 0, 0, 0.5);
}

.dark .carousel-arrow:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.dark .carousel-arrow svg {
    fill: #ffffff;
}

/* Navigation dots - ocultos por defecto */
.carousel-dots {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.carousel-container:hover .carousel-dots {
    opacity: 1;
    pointer-events: auto;
}

/* Specific adjustments for Diseño Geotécnico carousel */
#diseno-geotecnico-carousel .carousel-slide:nth-child(1) img,
#diseno-geotecnico-carousel .carousel-slide:nth-child(2) img {
    object-position: left center; /* Cambiado de right a left */
}

/* Navigation dots */
.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    z-index: 10;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background-color: #fff;
    transform: scale(1.2);
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .carousel-container {
        height: 350px;
    }
}
