/* Custom Image Slider Styles */

.custom-image-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.custom-image-slider {
    width: 100%;
    height: auto !important;
    min-height: 200px;
    border-radius: 0;
    overflow: hidden;
    padding-bottom: 40px !important;
}

.custom-image-slider .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f5f5;
    height: auto;
    width: 100%;
}

.custom-image-slider .swiper-slide img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    transition: transform 0.3s ease;
}

.custom-image-slider .swiper-slide a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: auto;
    line-height: 0;
}

.custom-image-slider .swiper-slide:hover img {
    transform: scale(1.02);
}

/* Asegurar altura uniforme entre slides cuando sea necesario */
.custom-image-slider.uniform-height {
    height: auto;
}

.custom-image-slider.uniform-height .swiper-wrapper {
    align-items: stretch;
}

.custom-image-slider.uniform-height .swiper-slide {
    height: auto;
    display: flex;
    flex-direction: column;
}

.custom-image-slider.uniform-height .swiper-slide img {
    flex: 1;
    object-fit: cover;
    min-height: 200px;
    width: 100%;
    height: auto;
}

/* Centrar imágenes verticalmente cuando tengan diferentes alturas */
.custom-image-slider .swiper-slide {
    align-items: center;
    justify-content: center;
}

/* Modo de altura fija */
.custom-image-slider.fixed-height {
    height: 400px; /* será sobrescrito por Elementor */
}

.custom-image-slider.fixed-height .swiper-slide {
    height: 100%;
}

.custom-image-slider.fixed-height .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-image-slider.fixed-height .swiper-slide a {
    height: 100%;
}

/* Transición suave para cambios de altura automática */
.custom-image-slider:not(.uniform-height):not(.fixed-height) {
    transition: height 0.3s ease;
}

/* Evitar que las imágenes muy altas rompan el layout */
.custom-image-slider .swiper-slide img {
    max-height: auto;
    width: 100%;
    max-width: 100%;
}

/* Asegurar que las imágenes mantengan su aspecto */
.custom-image-slider:not(.uniform-height):not(.fixed-height) .swiper-slide img {
    height: auto;
    width: 100%;
    max-width: 100%;
}

/* Loading state mejorado */
.custom-image-slider .swiper-slide img[loading] {
    min-height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@media (max-width: 768px) {
    .custom-image-slider .swiper-slide img {
        max-height: 60vh;
    }
    
    .custom-image-slider .swiper-slide img[loading] {
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .custom-image-slider .swiper-slide img {
        max-height: 50vh;
    }
    
    .custom-image-slider .swiper-slide img[loading] {
        min-height: 120px;
    }
}

/* Navigation Arrows */
.custom-image-slider .swiper-button-next,
.custom-image-slider .swiper-button-prev {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.custom-image-slider .swiper-button-next:hover,
.custom-image-slider .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    transform: scale(1.1);
}

.custom-image-slider .swiper-button-next::after,
.custom-image-slider .swiper-button-prev::after {
    font-size: 20px;
    font-weight: bold;
}

/* Pagination Dots */
.custom-image-slider .swiper-pagination {
    bottom: 20px !important;
    text-align: center;
}

.custom-image-slider .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.7);
    opacity: 1;
    margin: 0 5px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.custom-image-slider .swiper-pagination-bullet-active {
    background: #007cba !important;
    transform: scale(1.2);
}

.custom-image-slider .swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-image-slider {
        min-height: 150px;
    }
    
    .custom-image-slider .swiper-button-next,
    .custom-image-slider .swiper-button-prev {
        width: 40px;
        height: 40px;
    }
    
    .custom-image-slider .swiper-button-next::after,
    .custom-image-slider .swiper-button-prev::after {
        font-size: 16px;
    }
    
    .custom-image-slider .swiper-pagination-bullet {
        width: 10px;
        height: 10px;
        margin: 0 3px;
    }
}

@media (max-width: 480px) {
    .custom-image-slider {
        min-height: 120px;
    }
    
    .custom-image-slider .swiper-button-next,
    .custom-image-slider .swiper-button-prev {
        width: 35px;
        height: 35px;
    }
    
    .custom-image-slider .swiper-button-next::after,
    .custom-image-slider .swiper-button-prev::after {
        font-size: 14px;
    }
}

/* Loading Animation */
.custom-image-slider .swiper-slide.swiper-slide-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;
    }
}

/* Smooth transitions */
.custom-image-slider .swiper-slide-active img {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Focus styles for accessibility */
.custom-image-slider .swiper-button-next:focus,
.custom-image-slider .swiper-button-prev:focus,
.custom-image-slider .swiper-pagination-bullet:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-image-slider .swiper-button-next,
    .custom-image-slider .swiper-button-prev {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .custom-image-slider .swiper-pagination-bullet {
        background: #000;
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .custom-image-slider .swiper-slide img {
        transition: none;
    }
    
    .custom-image-slider .swiper-slide:hover img {
        transform: none;
    }
    
    .custom-image-slider .swiper-button-next,
    .custom-image-slider .swiper-button-prev,
    .custom-image-slider .swiper-pagination-bullet {
        transition: none;
    }
    
    .custom-image-slider .swiper-slide-active img {
        animation: none;
    }
}