/**
 * Estilos para productos y botones de agregar al carrito
 * 
 * @package YeshuaTech
 */

/* ============================================
   BOTÓN AGREGAR AL CARRITO
   ============================================ */

.yeshua-btn-add-to-cart {
    position: relative;
    overflow: hidden;
}

.yeshua-btn-add-to-cart.adding {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.yeshua-btn-add-to-cart.added {
    background: linear-gradient(to right, #10b981, #059669) !important;
    animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.yeshua-btn-add-to-cart .button-text {
    transition: all 0.3s ease;
}

/* Estado de carga */
.yeshua-btn-add-to-cart.adding .button-text {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Botón agotado */
.yeshua-btn-out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(to right, #9ca3af, #6b7280) !important;
}

.yeshua-btn-out-of-stock:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   TARJETA DE PRODUCTO
   ============================================ */

.product {
    transition: all 0.3s ease;
}

.product:hover {
    transform: translateY(-4px);
}

/* Botón de agregar al carrito en la tarjeta */
.product .yeshua-btn-add-to-cart {
    min-height: 40px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Mejorar accesibilidad táctil en móviles */
@media (max-width: 768px) {
    .yeshua-btn-add-to-cart {
        min-height: 44px;
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    .product .yeshua-btn-add-to-cart {
        min-height: 44px;
    }
}

/* ============================================
   PÁGINA INDIVIDUAL DEL PRODUCTO
   ============================================ */

.yeshua-product-add-to-cart {
    margin-top: 2rem;
}

.yeshua-product-add-to-cart .single_add_to_cart_button {
    min-height: 50px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(to right, #f97316, #ea580c);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.yeshua-product-add-to-cart .single_add_to_cart_button:hover {
    background: linear-gradient(to right, #ea580c, #c2410c);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.yeshua-product-add-to-cart .single_add_to_cart_button:active {
    transform: translateY(0);
}

.yeshua-product-add-to-cart .single_add_to_cart_button.adding {
    opacity: 0.7;
    cursor: wait;
}

.yeshua-product-add-to-cart .single_add_to_cart_button.added {
    background: linear-gradient(to right, #10b981, #059669);
}

/* ============================================
   FEEDBACK VISUAL
   ============================================ */

/* Animación de éxito al agregar */
@keyframes addToCartSuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.product .yeshua-btn-add-to-cart.added {
    animation: addToCartSuccess 0.5s ease-out;
}

/* Indicador de cantidad en el botón (opcional) */
.yeshua-btn-add-to-cart .quantity-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    animation: bounceIn 0.3s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* ============================================
   PRODUCTOS RELACIONADOS
   ============================================ */

.yeshua-related-products-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    width: 100%;
}

.yeshua-related-products-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.yeshua-related-products-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .yeshua-related-products-title {
        font-size: 2rem;
        text-align: left;
        margin-bottom: 2rem;
    }
}

.yeshua-related-products-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
    padding-bottom: 1rem;
}

.yeshua-related-products-wrapper::-webkit-scrollbar {
    height: 6px;
}

.yeshua-related-products-wrapper::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 10px;
}

.yeshua-related-products-wrapper::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.yeshua-related-products-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Contenedor del loop de productos relacionados */
.yeshua-related-products-section .products,
.yeshua-related-products-section ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* En móvil: scroll horizontal con tarjetas de ancho fijo */
@media (max-width: 768px) {
    .yeshua-related-products-container {
        padding: 0;
    }
    
    .yeshua-related-products-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0 1rem 1rem;
        margin: 0 -1rem;
    }
    
    .yeshua-related-products-section .products,
    .yeshua-related-products-section ul.products {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        grid-template-columns: none !important;
        gap: 1rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 0.5rem;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    .yeshua-related-products-section .products li.product,
    .yeshua-related-products-section ul.products li.product {
        flex: 0 0 260px !important;
        max-width: 260px !important;
        width: 260px !important;
        scroll-snap-align: start;
        min-width: 0;
        margin: 0 !important;
    }
    
    /* Scrollbar personalizado */
    .yeshua-related-products-section .products::-webkit-scrollbar,
    .yeshua-related-products-section ul.products::-webkit-scrollbar {
        height: 4px;
    }
    
    .yeshua-related-products-section .products::-webkit-scrollbar-track,
    .yeshua-related-products-section ul.products::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 10px;
    }
    
    .yeshua-related-products-section .products::-webkit-scrollbar-thumb,
    .yeshua-related-products-section ul.products::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 10px;
    }
}

/* En tablets: 2 columnas */
@media (min-width: 769px) and (max-width: 1024px) {
    .yeshua-related-products-section .products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

/* En desktop: 3-4 columnas */
@media (min-width: 1025px) {
    .yeshua-related-products-section .products {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

/* Título de productos relacionados */
.yeshua-related-products-section h2 {
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

/* Mejorar las tarjetas de productos en el contexto de relacionados */
.yeshua-related-products-section .product {
    width: 100%;
    margin-bottom: 0;
}

/* Asegurar que las imágenes se vean bien */
.yeshua-related-products-section .product img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Botones en productos relacionados */
.yeshua-related-products-section .yeshua-btn-add-to-cart {
    font-size: 0.75rem;
    padding: 0.625rem 1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .yeshua-product-add-to-cart .single_add_to_cart_button {
        width: 100%;
        justify-content: center;
    }
    
    .yeshua-related-products-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
    
    .yeshua-related-products-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .yeshua-related-products-section .products {
        gap: 0.75rem;
    }
    
    .yeshua-related-products-section .products li.product {
        flex: 0 0 260px;
        max-width: 260px;
    }
}

