/**
 * Elementor Modern Carousel - Estilos
 * Carrusel con efecto peek, barra de progreso y galeria hover
 */

/* =============================================
   VARIABLES CSS
   ============================================= */
.emc-carousel {
    --peek-amount: 15%;
    --slide-gap: 20px;
    --transition-speed: 400ms;
}

/* =============================================
   ESTRUCTURA PRINCIPAL
   ============================================= */
.emc-carousel-wrapper {
    position: relative;
    width: 100%;
}

.emc-carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.emc-carousel-track {
    display: flex;
    transition: transform var(--transition-speed) cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

/* =============================================
   SLIDES
   ============================================= */
.emc-slide {
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 calc(var(--slide-gap) / 2);
}

/* Efecto peek habilitado - calculo de ancho */
.emc-peek-enabled .emc-slide {
    /* El JS calculara el ancho exacto */
}

.emc-slide-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    border-radius: inherit;
}

.emc-slide-image {
    position: relative;
    width: 100%;
    height: 450px;
    overflow: hidden;
    border-radius: inherit;
    background-color: #f5f5f5;
}

/* Imagen principal y de galeria - OBJECT-FIT para adaptarse */
.emc-slide-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease, transform 0.5s ease;
}

.emc-main-image {
    z-index: 1;
}

.emc-gallery-image {
    opacity: 0;
    z-index: 2;
}

.emc-gallery-image.active {
    opacity: 1;
}

/* Hover zoom suave */
.emc-slide-link:hover .emc-main-image,
.emc-slide-link:hover .emc-gallery-image.active {
    transform: scale(1.05);
}

/* =============================================
   GALERIA EN HOVER - TIPO FADE
   ============================================= */
.emc-slide.has-gallery[data-gallery-type="fade"] .emc-gallery-image {
    transition: opacity 0.4s ease;
}

/* =============================================
   GALERIA EN HOVER - TIPO SEGMENTOS
   ============================================= */
.emc-gallery-segments {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
}

.emc-segment {
    flex: 1;
    cursor: pointer;
}

/* =============================================
   GALERIA EN HOVER - TIPO DOTS
   ============================================= */
.emc-gallery-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 15;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.emc-slide:hover .emc-gallery-dots {
    opacity: 1;
}

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

.emc-gallery-dot:hover,
.emc-gallery-dot.active {
    background-color: #ffffff;
    transform: scale(1.2);
}

/* =============================================
   BADGE
   ============================================= */
.emc-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    z-index: 5;
}

.emc-badge-sale {
    background-color: #e53935;
    color: #ffffff;
}

.emc-badge-new {
    background-color: #43a047;
    color: #ffffff;
}

/* =============================================
   OVERLAY Y CONTENIDO
   ============================================= */
.emc-slide-overlay {
    --overlay-color: rgba(0, 0, 0, 0.5);
    --gradient-size: 60%;
    
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 25px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.emc-title-overlay-bottom {
    bottom: 0;
    background: linear-gradient(to top, var(--overlay-color) 0%, transparent var(--gradient-size));
    justify-content: flex-end;
}

.emc-title-overlay-center {
    top: 0;
    bottom: 0;
    height: 100%;
    background: linear-gradient(to top, var(--overlay-color) 0%, transparent var(--gradient-size));
    justify-content: center;
    text-align: center;
}

.emc-title-below {
    position: relative;
    padding: 15px 5px;
    background: transparent;
}

.emc-slide-content {
    pointer-events: auto;
}

.emc-slide-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.emc-title-below .emc-slide-title {
    color: #333333;
    text-shadow: none;
}

/* =============================================
   PRECIOS - ESTILOS BASE Y WOOCOMMERCE
   ============================================= */
.emc-slide-price {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

/* Asegurar que todos los elementos hijos hereden el color */
.emc-slide-price,
.emc-slide-price span,
.emc-slide-price bdi,
.emc-slide-price .woocommerce-Price-amount,
.emc-slide-price .woocommerce-Price-currencySymbol,
.emc-slide-price .amount {
    color: inherit;
}

/* Titulo debajo de la imagen */
.emc-title-below .emc-slide-price,
.emc-title-below .emc-slide-price span,
.emc-title-below .emc-slide-price bdi {
    color: #333333;
}

/* Precio tachado (precio original en oferta) */
.emc-slide-price del {
    opacity: 0.7;
    margin-right: 8px;
    text-decoration: line-through;
}

.emc-slide-price del,
.emc-slide-price del span,
.emc-slide-price del bdi,
.emc-slide-price del .woocommerce-Price-amount,
.emc-slide-price del .woocommerce-Price-currencySymbol,
.emc-slide-price del .amount {
    color: inherit;
    opacity: 0.7;
}

/* Precio en oferta (nuevo precio) */
.emc-slide-price ins {
    text-decoration: none;
    background: transparent;
}

.emc-slide-price ins,
.emc-slide-price ins span,
.emc-slide-price ins bdi,
.emc-slide-price ins .woocommerce-Price-amount,
.emc-slide-price ins .woocommerce-Price-currencySymbol,
.emc-slide-price ins .amount {
    color: #e53935;
    text-decoration: none;
    background: transparent;
}

/* =============================================
   NAVEGACION
   ============================================= */
.emc-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
    padding: 0 calc(var(--slide-gap) / 2);
}

.emc-nav-bottom {
    flex-direction: row;
}

.emc-nav-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.emc-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background-color: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emc-nav-btn:hover:not(:disabled) {
    border-color: #333333;
    background-color: #333333;
    color: #ffffff;
}

.emc-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.emc-nav-btn svg {
    width: 20px;
    height: 20px;
}

/* =============================================
   BARRA DE PROGRESO
   ============================================= */
.emc-progress-bar {
    flex-grow: 1;
    height: 3px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.emc-progress-fill {
    height: 100%;
    background-color: #333333;
    border-radius: 3px;
    transition: width var(--transition-speed) cubic-bezier(0.25, 0.1, 0.25, 1);
    width: 0%;
}

/* =============================================
   DOTS DE NAVEGACION
   ============================================= */
.emc-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.emc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emc-dot:hover,
.emc-dot.active {
    background-color: #333333;
}

/* =============================================
   POSICIONES ALTERNATIVAS DE FLECHAS
   ============================================= */

/* Flechas a los lados */
.emc-nav-sides .emc-nav-buttons {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
    z-index: 10;
}

.emc-nav-sides .emc-nav-btn {
    pointer-events: auto;
}

.emc-nav-sides .emc-progress-bar {
    width: 100%;
}

/* Flechas abajo en esquinas */
.emc-nav-bottom-sides {
    justify-content: space-between;
}

.emc-nav-bottom-sides .emc-progress-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .emc-slide-image {
        height: 380px;
    }
    
    .emc-slide-title {
        font-size: 16px;
    }
    
    .emc-navigation {
        gap: 15px;
    }
}

@media (max-width: 767px) {
    .emc-slide-image {
        height: 320px;
    }
    
    .emc-slide-title {
        font-size: 15px;
    }
    
    .emc-slide-overlay {
        padding: 20px 15px;
    }
    
    .emc-nav-btn {
        width: 36px;
        height: 36px;
    }
    
    .emc-nav-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .emc-gallery-dots {
        bottom: 10px;
        padding: 6px 10px;
    }
    
    .emc-gallery-dot {
        width: 6px;
        height: 6px;
    }
}

/* =============================================
   ANIMACIONES
   ============================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.emc-slide {
    animation: fadeIn 0.5s ease forwards;
}

/* Transicion suave al cargar */
.emc-carousel:not(.initialized) .emc-carousel-track {
    opacity: 0;
}

.emc-carousel.initialized .emc-carousel-track {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* =============================================
   DRAGGING
   ============================================= */
.emc-carousel.dragging {
    cursor: grabbing;
}

.emc-carousel.dragging .emc-carousel-track {
    transition: none;
}

.emc-carousel.dragging .emc-slide-link {
    pointer-events: none;
}

/* Mejorar clicks en móvil */
@media (max-width: 1024px) {
    .emc-slide-link {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .emc-carousel:not(.dragging) .emc-slide-link {
        pointer-events: auto;
    }
}

/* =============================================
   ACCESIBILIDAD
   ============================================= */
.emc-nav-btn:focus-visible {
    outline: 2px solid #333333;
    outline-offset: 2px;
}

.emc-slide-link:focus-visible {
    outline: 2px solid #333333;
    outline-offset: 4px;
}

/* Reducir movimiento para usuarios que lo prefieran */
@media (prefers-reduced-motion: reduce) {
    .emc-carousel-track,
    .emc-slide-image img,
    .emc-gallery-image,
    .emc-progress-fill {
        transition: none;
    }
    
    .emc-slide {
        animation: none;
    }
}
