/*
 * assets/css/carousel_imagenes.css
 * Versión mejorada con animaciones avanzadas
 */

/* ===== VARIABLES CSS ===== */
:root {
    --crsl-primary: #4169E1;
    --crsl-primary-light: #6B8BF5;
    --crsl-secondary: #1a1a2e;
    --crsl-white: #ffffff;
    --crsl-overlay: linear-gradient(135deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    --crsl-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    --crsl-transition-fast: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --crsl-transition-smooth: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    --crsl-transition-slow: 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== CONTENEDOR PRINCIPAL ===== */
#carousel-auto-wrapper {
    width: 100%;
    margin: 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--crsl-shadow);
    border-radius: 0;
    background: var(--crsl-secondary);
}

#carousel-auto-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.5) 100%);
    z-index: 2;
    pointer-events: none;
}

/* ===== CONTENEDOR DE SLIDES ===== */
#carousel-auto-wrapper .carousel-auto-container {
    width: 100%;
    position: relative;
}

/* ===== SLIDES ===== */
#carousel-auto-wrapper .crsl-auto-slide {
    display: none;
    opacity: 0;
    transition: opacity var(--crsl-transition-slow);
}

#carousel-auto-wrapper .crsl-auto-slide.crsl-auto-active {
    display: block;
    opacity: 1;
}

/* Animaciones de transición de slides */
@keyframes slideZoomIn {
    from {
        transform: scale(1.05);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#carousel-auto-wrapper .crsl-auto-slide.crsl-auto-active {
    display: block;
    animation: slideZoomIn 0.8s ease-out forwards;
}

#carousel-auto-wrapper .crsl-auto-slide.crsl-auto-active img {
    animation: slideFadeIn 0.6s ease-out;
}

/* Imágenes - altura natural */
#carousel-auto-wrapper .crsl-auto-slide img {
    width: 100%;
    height: auto;
    display: block;
}



/* ===== ANIMACIÓN DE ENTRADA ===== */
@keyframes carouselFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#carousel-auto-wrapper {
    animation: carouselFadeIn 0.8s ease-out;
}

/* ===== BARRA DE PROGRESO ===== */
#carousel-auto-wrapper .crsl-auto-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.2);
    z-index: 10;
}

#carousel-auto-wrapper .crsl-auto-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--crsl-primary), var(--crsl-primary-light));
    transition: width 0.1s linear;
}

#carousel-auto-wrapper.playing .crsl-auto-progress-bar {
    animation: progressBar 5s linear forwards;
}

@keyframes progressBar {
    from { width: 0%; }
    to { width: 100%; }
}

/* ===== INDICADORES (DOTS) ===== */
#carousel-auto-wrapper .carousel-auto-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

#carousel-auto-wrapper .crsl-auto-dot {
    width: 32px;
    height: 4px;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--crsl-transition-fast);
}

#carousel-auto-wrapper .crsl-auto-dot:hover {
    background: rgba(255,255,255,0.6);
}

#carousel-auto-wrapper .crsl-auto-dot.crsl-auto-active {
    width: 56px;
    background: rgba(255,255,255,0.3);
}

#carousel-auto-wrapper .crsl-auto-dot-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--crsl-primary);
    border-radius: 2px;
}

#carousel-auto-wrapper .crsl-auto-dot.crsl-auto-active .crsl-auto-dot-progress {
    animation: dotProgress 5s linear forwards;
}

@keyframes dotProgress {
    from { width: 0%; }
    to { width: 100%; }
}

/* ===== FLECHAS DE NAVEGACIÓN ===== */
#carousel-auto-wrapper .crsl-auto-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: var(--crsl-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--crsl-transition-fast);
    opacity: 0;
}

#carousel-auto-wrapper:hover .crsl-auto-arrow {
    opacity: 1;
}

#carousel-auto-wrapper .crsl-auto-arrow svg {
    width: 20px;
    height: 20px;
    transition: transform var(--crsl-transition-fast);
}

#carousel-auto-wrapper .crsl-auto-arrow:hover {
    background: var(--crsl-primary);
    transform: translateY(-50%) scale(1.1);
}

#carousel-auto-wrapper .crsl-auto-arrow.prev:hover svg {
    transform: translateX(-2px);
}

#carousel-auto-wrapper .crsl-auto-arrow.next:hover svg {
    transform: translateX(2px);
}

#carousel-auto-wrapper .crsl-auto-arrow.prev { left: 12px; }
#carousel-auto-wrapper .crsl-auto-arrow.next { right: 12px; }

/* Efecto ripple al hacer clic */
#carousel-auto-wrapper .crsl-auto-arrow::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: scale(0);
    opacity: 0;
}

#carousel-auto-wrapper .crsl-auto-arrow:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* ===== CONTADOR ===== */
#carousel-auto-wrapper .crsl-auto-counter {
    position: absolute;
    bottom: 10px;
    right: 16px;
    display: flex;
    align-items: baseline;
    gap: 2px;
    font-family: 'Inter', sans-serif;
    z-index: 10;
    color: var(--crsl-white);
    font-size: 0.85rem;
}

#carousel-auto-wrapper .crsl-auto-current {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

#carousel-auto-wrapper .crsl-auto-separator {
    opacity: 0.5;
    margin: 0 2px;
}

#carousel-auto-wrapper .crsl-auto-total {
    opacity: 0.5;
}

/* ===== BOTÓN PLAY/PAUSE ===== */
#carousel-auto-wrapper .crsl-auto-playpause {
    position: absolute;
    bottom: 8px;
    left: 16px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: var(--crsl-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--crsl-transition-fast);
}

#carousel-auto-wrapper .crsl-auto-playpause:hover {
    background: var(--crsl-primary);
}

#carousel-auto-wrapper .crsl-auto-playpause svg {
    width: 14px;
    height: 14px;
}

#carousel-auto-wrapper.playing .crsl-auto-playpause .icon-play { display: none; }
#carousel-auto-wrapper.playing .crsl-auto-playpause .icon-pause { display: block; }
#carousel-auto-wrapper:not(.playing) .crsl-auto-playpause .icon-play { display: block; }
#carousel-auto-wrapper:not(.playing) .crsl-auto-playpause .icon-pause { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #carousel-auto-wrapper .crsl-auto-arrow {
        width: 36px;
        height: 36px;
        opacity: 1;
    }
    
    #carousel-auto-wrapper .crsl-auto-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    #carousel-auto-wrapper .crsl-auto-arrow.prev { left: 8px; }
    #carousel-auto-wrapper .crsl-auto-arrow.next { right: 8px; }
    
    #carousel-auto-wrapper .carousel-auto-dots {
        bottom: 10px;
    }
    
    #carousel-auto-wrapper .crsl-auto-dot {
        width: 24px;
    }
    
    #carousel-auto-wrapper .crsl-auto-dot.crsl-auto-active {
        width: 40px;
    }
}

@media (max-width: 480px) {
    #carousel-auto-wrapper .crsl-auto-arrow {
        width: 32px;
        height: 32px;
    }
    
    #carousel-auto-wrapper .crsl-auto-arrow svg {
        width: 16px;
        height: 16px;
    }
    
    #carousel-auto-wrapper .crsl-auto-playpause,
    #carousel-auto-wrapper .crsl-auto-counter {
        display: none;
    }
    
    /* Ocultar barra de progreso en móvil */
    #carousel-auto-wrapper .crsl-auto-progress {
        display: none;
    }
    
    #carousel-auto-wrapper .carousel-auto-dots {
        bottom: 8px;
    }
    
    #carousel-auto-wrapper .crsl-auto-dot {
        width: 20px;
        height: 3px;
    }
    
    #carousel-auto-wrapper .crsl-auto-dot.crsl-auto-active {
        width: 32px;
    }
}

/* ===== REDUCIR MOVIMIENTO (ACCESIBILIDAD) ===== */
@media (prefers-reduced-motion: reduce) {
    #carousel-auto-wrapper .crsl-auto-slide,
    #carousel-auto-wrapper .crsl-auto-slide img,
    #carousel-auto-wrapper .crsl-auto-content > *,
    #carousel-auto-wrapper .crsl-auto-arrow,
    #carousel-auto-wrapper .crsl-auto-btn {
        animation: none;
        transition: opacity 0.3s ease;
    }
    
    @keyframes kenBurns {
        0%, 100% { transform: scale(1); }
    }
}

.crsl-auto-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* Hace que el video llene el espacio sin deformarse */
    display: block;
}
