/*
 Theme Name:   GeneratePress Child
 Theme URI:    
 Description:  Default GeneratePress child theme - Mobile Optimized
 Author:       Alba Digital Development
 Author URI:   https://albadigitaldevelopment.com
 Template:     generatepress
 Version:      0.4
*/

/* =========================================================================
   1. RESET GLOBAL & FIX DESBORDE (EVITA QUE SOBRESALGA)
   ========================================================================= */
*, *:before, *:after {
    box-sizing: border-box !important;
}

html, body {
    overflow-x: hidden; /* Evita el scroll horizontal */
    width: 100%;
    margin: 0;
    padding: 0;
}

/* =========================================================================
   2. REJILLA DE PRODUCTOS (2 COLUMNAS MÓVIL / 3 PC)
   ========================================================================= */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
    content: none !important;
    display: none !important;
}

.woocommerce ul.products {
    display: grid !important;
    grid-auto-flow: row dense !important; /* Fuerza a rellenar el primer hueco */
    margin-bottom: 50px !important;
}

@media (min-width: 769px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 10px !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .woocommerce ul.products li.product {
        width: 100% !important;
        margin: 0 !important;
        padding: 10px !important;
    }
}

/* =========================================================================
   3. FIX CHECKOUT MÓVIL (PÁGINA DE PAGO)
   ========================================================================= */
@media (max-width: 768px) {
    /* Forzar contenedores a no exceder el ancho de pantalla */
    .woocommerce-checkout, 
    .woocommerce-checkout form.checkout, 
    #order_review, 
    #customer_details {
        width: 100% !important;
        max-width: 100vw !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        margin: 0 !important;
    }

    /* Hacer que las tablas de pedido sean legibles */
    .woocommerce-checkout-review-order-table {
        display: block !important;
        width: 100% !important;
    }

    .woocommerce-checkout-review-order-table thead {
        display: none; /* Ocultar cabecera para ganar espacio */
    }

    .woocommerce-checkout-review-order-table tbody tr, 
    .woocommerce-checkout-review-order-table tfoot tr {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    /* Campos de formulario al 100% */
    .woocommerce-checkout .form-row {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Botón de pago fijo */
    .woocommerce-checkout #payment #place_order {
        font-size: 1rem !important;
        padding: 15px !important;
    }
}

/* Estilos visuales Checkout (PC y Móvil) */
#order_review {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 8px;
}

/* =========================================================================
   4. TARJETA DE PRODUCTO MODERNA
   ========================================================================= */
.woocommerce ul.products li.product {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    text-align: center;
    border: none !important;
    display: flex;
    flex-direction: column;
}

.woocommerce ul.products li.product a img {
    border-radius: 12px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.woocommerce ul.products li.product .button {
    background-color: #3498db !important;
    color: #fff !important;
    border-radius: 50px !important;
    padding: 10px !important;
    font-size: 0.8rem !important;
    margin-top: auto !important;
}

/* =========================================================================
   5. WHATSAPP FLOTANTE
   ========================================================================= */
.whatsapp-floating-button {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999;
    background-color: #25D366;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.whatsapp-floating-button svg { width: 28px; height: 28px; fill: #FFF; }

/* Ocultar campos innecesarios */
body.woocommerce-checkout #billing_last_name_field,
body.woocommerce-checkout #billing_address_1_field,
body.woocommerce-checkout #billing_city_field {
    display: none !important;
}

.woocommerce ul.products li.product .button.add_to_cart_button,
.woocommerce ul.products li.product .button.product_type_simple {
    background-color: #3498db !important;
    color: #ffffff !important;
    border-radius: 50px !important;
    padding: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 0.8rem !important;
    margin-top: auto !important; /* Lo empuja al final */
    margin-bottom: 8px !important; /* SEPARACIÓN CON EL SIGUIENTE BOTÓN */
    display: block !important;
}