/**
 * Elementor Modern Carousel - Product Gallery Styles
 */

/* =============================================
   VARIABLES CSS
   ============================================= */
.emc-product-gallery {
    --peek-amount: 10%;
    --slide-gap: 10px;
    --transition-speed: 400ms;
}

/* =============================================
   WRAPPER PRINCIPAL
   ============================================= */
.emc-product-gallery-wrapper {
    position: relative;
    width: 100%;
}

/* Layout con thumbnails a los lados */
.emc-thumbs-left,
.emc-thumbs-right {
    display: flex;
    gap: 15px;
}

.emc-thumbs-left {
    flex-direction: row-reverse;
}

.emc-thumbs-left .emc-product-gallery-main,
.emc-thumbs-right .emc-product-gallery-main {
    flex: 1;
    min-width: 0;
}

.emc-thumbs-left .emc-thumbs-container,
.emc-thumbs-right .emc-thumbs-container {
    width: auto;
    flex-shrink: 0;
}

.emc-thumbs-left .emc-thumbs-track,
.emc-thumbs-right .emc-thumbs-track {
    flex-direction: column;
}

/* Layout con thumbnails abajo */
.emc-thumbs-bottom {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* =============================================
   GALERIA PRINCIPAL (CAROUSEL)
   ============================================= */
.emc-product-gallery-main {
    position: relative;
}

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

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

.emc-gallery-slide {
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
    padding: 0 calc(var(--slide-gap) / 2);
    cursor: pointer;
}

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

.emc-gallery-slide-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
}

/* =============================================
   ZOOM ON HOVER
   ============================================= */
.emc-zoom-enabled {
    overflow: hidden;
}

.emc-zoom-enabled img {
    transition: transform 0.1s ease-out;
    transform-origin: center center;
}

.emc-zoom-enabled.zooming img {
    /* El scale se aplica via JS */
}

/* =============================================
   LAYOUT GRID
   ============================================= */
.emc-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.emc-gallery-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
    cursor: pointer;
    aspect-ratio: 1;
}

.emc-gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.emc-gallery-grid-item:hover img {
    transform: scale(1.05);
}

/* Primera imagen del grid mas grande */
.emc-gallery-grid-item:first-child {
    grid-column: span 2;
    aspect-ratio: 4/3;
}

/* =============================================
   THUMBNAILS
   ============================================= */
.emc-thumbs-container {
    position: relative;
    overflow: hidden;
}

.emc-thumbs-track {
    display: flex;
    gap: 8px;
    transition: transform 0.3s ease;
}

.emc-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    overflow: hidden;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.emc-thumb:hover {
    opacity: 0.9;
}

.emc-thumb.active {
    opacity: 1;
    border-color: #333333;
}

.emc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =============================================
   NAVEGACION - FLECHAS
   ============================================= */
.emc-gallery-nav-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333333;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.emc-gallery-nav-btn:hover {
    background-color: #ffffff;
    transform: scale(1.1);
}

.emc-gallery-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

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

/* Flechas a los lados */
.emc-gallery-prev {
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.emc-gallery-next {
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.emc-gallery-prev:hover,
.emc-gallery-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Navegacion abajo */
.emc-gallery-nav-bottom {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 0 calc(var(--slide-gap) / 2);
}

.emc-gallery-nav-bottom .emc-gallery-nav-btn {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    box-shadow: none;
    border: 1px solid #e0e0e0;
}

.emc-gallery-nav-bottom .emc-gallery-nav-btn:hover {
    transform: none;
    border-color: #333;
    background-color: #333;
    color: #fff;
}

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

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

.emc-gallery-progress-fill {
    height: 100%;
    background-color: #333333;
    border-radius: 3px;
    transition: width var(--transition-speed) ease;
    width: 0%;
}

/* =============================================
   CONTADOR
   ============================================= */
.emc-gallery-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 6px 12px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    z-index: 5;
}

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

/* =============================================
   LIGHTBOX
   ============================================= */
.emc-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.emc-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.emc-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emc-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.emc-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emc-lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.emc-lightbox-close svg {
    width: 24px;
    height: 24px;
}

.emc-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emc-lightbox-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.emc-lightbox-nav svg {
    width: 24px;
    height: 24px;
}

.emc-lightbox-prev {
    left: 20px;
}

.emc-lightbox-next {
    right: 20px;
}

.emc-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 14px;
}

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

.emc-product-gallery.dragging .emc-gallery-track {
    transition: none;
}

.emc-product-gallery.dragging .emc-gallery-slide {
    pointer-events: none;
}

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

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .emc-gallery-slide-image {
        height: 400px;
    }
    
    .emc-thumb {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 767px) {
    .emc-gallery-slide-image {
        height: 350px;
    }
    
    .emc-thumbs-left,
    .emc-thumbs-right {
        flex-direction: column;
    }
    
    .emc-thumbs-left .emc-thumbs-track,
    .emc-thumbs-right .emc-thumbs-track {
        flex-direction: row;
    }
    
    .emc-thumb {
        width: 50px;
        height: 50px;
    }
    
    .emc-gallery-nav-btn {
        width: 36px;
        height: 36px;
    }
    
    .emc-gallery-nav-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .emc-gallery-prev {
        left: 10px;
    }
    
    .emc-gallery-next {
        right: 10px;
    }
    
    .emc-lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .emc-lightbox-prev {
        left: 10px;
    }
    
    .emc-lightbox-next {
        right: 10px;
    }

    .emc-gallery-grid-item:first-child {
        grid-column: span 2;
    }
}

/* =============================================
   ACCESIBILIDAD
   ============================================= */
.emc-gallery-nav-btn:focus-visible,
.emc-thumb:focus-visible,
.emc-lightbox-close:focus-visible,
.emc-lightbox-nav:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    .emc-gallery-track,
    .emc-gallery-slide-image img,
    .emc-lightbox,
    .emc-thumbs-track {
        transition: none;
    }
}

/* =============================================
   INICIALIZACION
   ============================================= */
.emc-product-gallery:not(.initialized) .emc-gallery-track {
    opacity: 0;
}

.emc-product-gallery.initialized .emc-gallery-track {
    opacity: 1;
    transition: opacity 0.3s ease, transform var(--transition-speed) cubic-bezier(0.25, 0.1, 0.25, 1);
}
