/**
 * Woo Products Carousel Lite - Estilos del Carrusel
 *
 * Estilos CSS optimizados para el carrusel de productos.
 * Diseño minimalista, moderno y responsive.
 *
 * Variables CSS utilizadas:
 * --wpcl-gap: Espacio entre productos
 * --wpcl-desktop: Productos visibles en desktop
 * --wpcl-tablet: Productos visibles en tablet
 * --wpcl-mobile: Productos visibles en mobile
 *
 * @package Woo_Products_Carousel_Lite
 * @since 1.0.0
 */

/* ==========================================================================
   Reset y Variables por Defecto
   ========================================================================== */

.wpcl-carousel-wrapper {
    --wpcl-gap: 20px;
    --wpcl-desktop: 4;
    --wpcl-tablet: 3;
    --wpcl-mobile: 1;
    
    position: relative;
    width: 100%;
    padding: 20px 50px;
    box-sizing: border-box;
    background-color: #fff;
}

.wpcl-carousel-wrapper *,
.wpcl-carousel-wrapper *::before,
.wpcl-carousel-wrapper *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Contenedor del Carrusel
   ========================================================================== */

.wpcl-carousel-container {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.wpcl-carousel-track {
    display: flex;
    gap: var(--wpcl-gap);
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
    cursor: grab;
}

.wpcl-carousel-track.is-dragging {
    cursor: grabbing;
    transition: none;
}

/* ==========================================================================
   Items del Carrusel (Productos)
   ========================================================================== */

.wpcl-carousel-item {
    /* Cálculo del ancho basado en productos visibles y gap */
    flex: 0 0 calc((100% - (var(--wpcl-desktop) - 1) * var(--wpcl-gap)) / var(--wpcl-desktop));
    min-width: 0;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wpcl-carousel-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Link del producto */
.wpcl-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wpcl-product-link:hover,
.wpcl-product-link:focus {
    text-decoration: none;
    outline: none;
}

.wpcl-product-link:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==========================================================================
   Imagen del Producto
   ========================================================================== */

.wpcl-product-image {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Aspect ratio 1:1 */
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f5f5f5;
}

.wpcl-product-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.4s ease;
}

/* Placeholder durante lazy load */
.wpcl-product-image img.wpcl-lazy:not(.wpcl-loaded) {
    opacity: 0.5;
}

.wpcl-product-image img.wpcl-loaded {
    opacity: 1;
}

/* Efecto hover en imagen */
.wpcl-carousel-item:hover .wpcl-product-image img {
    transform: scale(1.05);
}

/* ==========================================================================
   Título del Producto
   ========================================================================== */

.wpcl-product-title {
    margin: 0 0 8px 0;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #333;
    text-align: center;
    
    /* Limitar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em;
}

/* ==========================================================================
   Precio del Producto
   ========================================================================== */

.wpcl-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    text-align: center;
}

/* Soporte para precios tachados y de oferta (WooCommerce) */
.wpcl-product-price del {
    color: #999;
    font-weight: 400;
    font-size: 0.85em;
    margin-right: 4px;
}

.wpcl-product-price ins {
    text-decoration: none;
    color: #e63946;
}

.wpcl-product-price .woocommerce-Price-amount {
    color: inherit;
}

/* ==========================================================================
   Flechas de Navegación
   ========================================================================== */

.wpcl-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    width: 40px;
    height: 40px;
    padding: 0;
    
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    
    color: #333;
    cursor: pointer;
    
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wpcl-arrow:hover {
    background: #333;
    color: #fff;
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wpcl-arrow:focus {
    outline: none;
}

.wpcl-arrow:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.wpcl-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.wpcl-arrow:disabled:hover {
    background: #fff;
    color: #333;
    border-color: #e0e0e0;
}

.wpcl-arrow svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Posición de las flechas */
.wpcl-arrow-prev {
    left: 0;
}

.wpcl-arrow-next {
    right: 0;
}

/* ==========================================================================
   Botón "Ver Todas"
   ========================================================================== */

.wpcl-view-all-wrapper {
    text-align: center;
    margin-top: 24px;
    padding-top: 8px;
}

.wpcl-view-all-btn {
    display: inline-block;
    padding: 12px 24px;
    
    background: #333;
    color: #fff;
    
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-transform: none;
    
    border: none;
    border-radius: 4px;
    
    cursor: pointer;
    transition: all 0.2s ease;
}

.wpcl-view-all-btn:hover {
    background: #555;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wpcl-view-all-btn:focus {
    outline: none;
}

.wpcl-view-all-btn:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ==========================================================================
   Mensaje sin productos
   ========================================================================== */

.wpcl-no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Responsive - Tablet
   ========================================================================== */

@media (max-width: 1024px) {
    .wpcl-carousel-wrapper {
        padding: 16px 45px;
    }
    
    .wpcl-carousel-item {
        flex: 0 0 calc((100% - (var(--wpcl-tablet) - 1) * var(--wpcl-gap)) / var(--wpcl-tablet));
    }
    
    .wpcl-arrow {
        width: 36px;
        height: 36px;
    }
    
    .wpcl-arrow svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   Responsive - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .wpcl-carousel-wrapper {
        padding: 12px 40px;
    }
    
    .wpcl-carousel-item {
        flex: 0 0 calc((100% - (var(--wpcl-mobile) - 1) * var(--wpcl-gap)) / var(--wpcl-mobile));
        padding: 12px;
    }
    
    .wpcl-product-title {
        font-size: 13px;
        min-height: 2.6em;
    }
    
    .wpcl-product-price {
        font-size: 15px;
    }
    
    .wpcl-arrow {
        width: 32px;
        height: 32px;
    }
    
    .wpcl-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .wpcl-arrow-prev {
        left: 4px;
    }
    
    .wpcl-arrow-next {
        right: 4px;
    }
    
    .wpcl-view-all-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Responsive - Mobile Pequeño
   ========================================================================== */

@media (max-width: 480px) {
    .wpcl-carousel-wrapper {
        padding: 10px 35px;
    }
    
    .wpcl-carousel-item {
        padding: 10px;
    }
    
    .wpcl-product-image {
        margin-bottom: 12px;
    }
    
    .wpcl-product-title {
        font-size: 12px;
    }
    
    .wpcl-product-price {
        font-size: 14px;
    }
}

/* ==========================================================================
   Accesibilidad - Reducir Movimiento
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .wpcl-carousel-track {
        transition: none;
    }
    
    .wpcl-carousel-item,
    .wpcl-carousel-item:hover,
    .wpcl-product-image img,
    .wpcl-arrow,
    .wpcl-view-all-btn {
        transition: none;
        transform: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wpcl-carousel-wrapper {
        padding: 0;
    }
    
    .wpcl-carousel-track {
        flex-wrap: wrap;
    }
    
    .wpcl-carousel-item {
        flex: 0 0 calc(25% - 10px);
        page-break-inside: avoid;
    }
    
    .wpcl-arrow,
    .wpcl-view-all-wrapper {
        display: none;
    }
}
