/**
 * Shopify Carousel Styles
 * Responsive carousel con scroll horizontal nativo y barra personalizada de 360px
 */

/* Wrapper principal */
.shopify-carousel-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 40px auto;
    padding: 0 20px;
    padding-bottom: 20px;
}

/* Contenedor del carrusel */
.shopify-carousel {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    position: relative;
    cursor: grab;
    user-select: none;
    scroll-behavior: auto;
    /* Cambiado de smooth a auto para drag fluido */
    /* Ocultar scrollbar nativo */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding-bottom: 20px;
    /* Desactivar scroll snap */
    scroll-snap-type: none !important;
}

.shopify-carousel::-webkit-scrollbar {
    display: none !important;
}

.shopify-carousel:active {
    cursor: grabbing;
}

/* Variables CSS para el scrollbar */
.shopify-carousel-wrapper {
    --thumb-width: 100px;
    --thumb-position: 0px;
    --track-width: 360px;
}

/* Track de la barra de scroll (fondo gris) */
.shopify-carousel-wrapper::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--track-width);
    height: 10px;
    background: #00000026;
    border-radius: 0px;
    z-index: 1;
    pointer-events: none;
}

/* Thumb de la barra de scroll (naranja) */
.shopify-carousel-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    /* Posicionamiento corregido */
    left: calc(50% - var(--track-width) / 2);
    transform: translateX(var(--thumb-position));
    width: var(--thumb-width);
    height: 10px;
    background: #F29F05;
    border-radius: 0px;
    z-index: 2;
    pointer-events: none;
    transition: none;
}

/* Estado de arrastre */
.shopify-carousel.dragging,
.shopify-carousel.dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

.shopify-carousel.dragging .product-link {
    pointer-events: none !important;
}

/* Track del carrusel */
.carousel-track {
    display: flex;
    gap: 20px;
    width: fit-content;
}

/* Asegurar que los items no tengan snap */
.carousel-item {
    flex: 0 0 350px;
    width: 350px;
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    scroll-snap-align: none !important;
}

/* Link del producto */
.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Imagen del producto */
.product-image {
    width: 100%;
    height: 350px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    pointer-events: none;
    padding: 20px !important;
}

.carousel-item:hover .product-image img {
    transform: scale(1.05);
}

/* Título del producto */
.product-title {
    font-size: 18px;
    font-weight: 400;
    color: #000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0px !important;
}

/* Precio del producto */
.product-price {
    font-size: 18px;
    font-weight: 700;
    color: #000;
}

/* Botones de navegación */
.carousel-nav {
    display: none !important;
}

/* Error message */
.shopify-error {
    padding: 20px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    text-align: center;
}

/* RESPONSIVE - Móvil */
@media (max-width: 768px) {
    .shopify-carousel-wrapper {
        padding: 0 10px;
        margin: 20px auto;
        padding-bottom: 20px;
        --track-width: 280px;
    }

    .carousel-track {
        gap: 15px;
    }

    .carousel-item {
        flex: 0 0 280px;
        width: 280px;
    }

    .product-image {
        height: 280px;
    }

    .product-title {
        font-size: 14px;
        margin: 12px 12px 6px;
        min-height: 40px;
    }

    .product-price {
        font-size: 16px;
        margin: 0 12px 12px;
    }
}

/* Móvil pequeño */
@media (max-width: 480px) {
    .shopify-carousel-wrapper {
        --track-width: 250px;
    }

    .carousel-item {
        flex: 0 0 250px;
        width: 250px;
    }

    .product-image {
        height: 250px;
    }
}



/* Animación de carga */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }

    100% {
        background-position: 468px 0;
    }
}

.carousel-item.loading {
    background: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-size: 800px 104px;
    animation: shimmer 1.5s infinite linear;
}

/* Accesibilidad */
.product-link:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Prevenir selección de texto durante drag */
.shopify-carousel * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}