/* Carrusel M2Estudio - Frontend Styles */

.carrusel-m2-wrapper {
    width: 100%;
    margin: 0 auto;
    position: relative;
    line-height: 0;
    display: block;
    clear: both;
    z-index: 1;
    height: 100%;
}

.carrusel-m2-wrapper::after {
    content: "";
    display: table;
    clear: both;
}

.carrusel-m2-wrapper + * {
    position: relative;
    z-index: 10;
}

.carrusel-m2-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent;
    line-height: 0;
    display: block;
    clear: both;
}

.carrusel-m2-slides {
    position: relative;
    width: 100%;
    height: 100%;
    padding-bottom: 0;
    overflow: hidden;
    line-height: 0;
    display: block;
    clear: both;
}

/* Fallback para cuando no hay altura definida por el contenedor */
.carrusel-m2-slides:not([style*="height"]) {
    height: 0;
    padding-bottom: 41.67%;
}

.carrusel-slide {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.carrusel-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.carrusel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carrusel-slide a {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.carrusel-slide a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* En móviles, usar altura automática y contain para mostrar imagen completa */
@media (max-width: 768px) {
    .carrusel-slide img,
    .carrusel-slide a img {
        object-fit: contain;
        height: auto !important;
        max-height: 600px;
    }
}

/* Navegación */
.carrusel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    margin: 0;
    padding: 0;
}

.carrusel-nav:hover {
    background: rgba(0, 0, 0, 0.6);
}

.carrusel-nav:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.carrusel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.carrusel-prev {
    left: 15px;
}

.carrusel-next {
    right: 15px;
}

.carrusel-nav svg {
    width: 26px;
    height: 26px;
    display: block;
    stroke-width: 2.5;
}

/* Responsive */
@media (max-width: 768px) {
    .carrusel-m2-slides {
        height: auto;
        padding-bottom: 0;
    }
    
    .carrusel-slide {
        position: relative !important;
        height: auto !important;
    }
    
    .carrusel-slide:not(.active) {
        display: none;
    }
    
    .carrusel-slide.active {
        display: block;
    }
    
    .carrusel-m2-wrapper {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .carrusel-m2-slides {
        height: auto;
        padding-bottom: 0;
    }
    
    .carrusel-slide {
        position: relative !important;
        height: auto !important;
    }
    
    .carrusel-slide:not(.active) {
        display: none;
    }
    
    .carrusel-slide.active {
        display: block;
    }
    
    .carrusel-m2-wrapper {
        margin-bottom: 0;
    }
}

/* Animaciones suaves */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Accesibilidad */
.carrusel-nav:focus-visible {
    outline: 3px solid #2271b1;
    outline-offset: 3px;
}

/* Loading state */
.carrusel-m2-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: rgba(0, 0, 0, 0.4);
    animation: spin 0.8s linear infinite;
    z-index: 50;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
