* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

/* === CONTENEDOR PRINCIPAL DE LA GALERÍA === */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* === WRAPPER: clave para touch inteligente === */
.gallery-wrapper {
    position: relative;
    /* ✅ Ahora permite scroll vertical y horizontal */
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
}

/* === TRACK: contenedor de productos en fila === */
.gallery-track {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    cursor: grab;
    /* ✅ Igual que el wrapper */
    touch-action: pan-y pan-x;
}

.gallery-track.dragging {
    cursor: grabbing;
    transition: none; /* Sin transición durante el arrastre */
}

/* === CADA PRODUCTO (enlace) === */
.product-link {
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent; /* Elimina efecto gris al tocar */
    outline: none;
}

/* === TARJETA DE PRODUCTO === */
.product-card {
    padding: 20px 10px;
    text-align: center;
    background: white;
    width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === IMAGEN DEL PRODUCTO === */
.product-image {
    width: 100%;
    height: 230px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

/* Efecto hover solo en escritorio */
@media (hover: hover) and (pointer: fine) {
    .product-link:hover .product-image {
        transform: scale(1.03);
    }
}

/* === TÍTULO DEL PRODUCTO === */
.product-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* === PRECIO === */
.product-price {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
}

/* === BOTONES DE NAVEGACIÓN === */
.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    pointer-events: auto;
}

/* Mostrar botones solo al pasar el mouse (escritorio) */
.gallery-container:hover .nav-button {
    opacity: 1;
}

.nav-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

/* Botón deshabilitado */
.nav-button:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* Posición de botones */
.nav-button.prev {
    left: 10px;
}

.nav-button.next {
    right: 10px;
}

/* === BARRA DE PROGRESO === */
.progress-container {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2c3e50, #3498db);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Texto de progreso */
.scroll-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

/* === RESPUESTA EN DISPOSITIVOS === */

/* Tablets */
@media (min-width: 768px) and (max-width: 1023px) {
    .product-card {
        width: 220px;
    }
    .product-image {
        height: 300px;
    }
    .product-title {
        font-size: 15px;
    }
    .product-price {
        font-size: 17px;
    }
    .nav-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    .nav-button.prev {
        left: 15px;
    }
    .nav-button.next {
        right: 15px;
    }
}

/* Escritorio */
@media (min-width: 1024px) {
    .product-card {
        width: 280px;
    }
    .product-image {
        height: 380px;
    }
    .product-title {
        font-size: 16px;
    }
    .product-price {
        font-size: 19px;
    }
    .nav-button {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    .nav-button.prev {
        left: 20px;
    }
    .nav-button.next {
        right: 20px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .product-card {
        width: 160px;
        padding: 15px 8px;
    }
    .product-image {
        height: 200px;
    }
    .product-title {
        font-size: 13px;
    }
    .product-price {
        font-size: 15px;
    }
    .nav-button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .nav-button.prev,
    .nav-button.next {
        left: 8px;
        right: 8px;
    }
    .progress-container {
        padding: 12px 16px;
    }
}

/* === ANIMACIONES === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeIn 0.4s ease forwards;
}

/* === TOQUE Y SCROLL NATURAL (CLAVE) === */
.gallery-wrapper,
.gallery-track {
    -webkit-overflow-scrolling: touch;
}

/* Evitar selección de texto al deslizar */
* {
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Evitar que imágenes sean arrastradas */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    user-drag: none;
}
