/* =========================================================
   GLOPI - PRODUCTOS RECIENTES PRO
   Solo afecta la sección .products-recent de la Home
   ========================================================= */


/* =========================================================
   CONTENEDOR GENERAL
   ========================================================= */

body.home .products-recent {
    width: 100%;
    max-width: 1280px;
    margin-left: auto !important;
    margin-right: auto !important;
}


/* =========================================================
   GRID
   ========================================================= */

body.home .products-recent .wc-block-grid__products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;

    margin: 0 !important;
    padding: 0 !important;
}


/* =========================================================
   TARJETA
   ========================================================= */

body.home .products-recent .wc-block-grid__product {
    position: relative !important;

    display: flex !important;
    flex-direction: column !important;

    width: 100% !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 0 16px !important;

    overflow: hidden !important;

    border: 1px solid #e8e8e8 !important;
    border-radius: 14px !important;

    background: #fff !important;

    box-shadow: 0 2px 8px rgba(0,0,0,.035) !important;

    transition:
        transform .25s ease,
        box-shadow .25s ease,
        border-color .25s ease !important;
}


body.home .products-recent .wc-block-grid__product:hover {
    transform: translateY(-4px) !important;

    border-color: #dddddd !important;

    box-shadow: 0 12px 28px rgba(0,0,0,.09) !important;
}


/* =========================================================
   ENLACE DEL PRODUCTO
   ========================================================= */

body.home .products-recent .wc-block-grid__product-link {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;

    text-decoration: none !important;
}


/* =========================================================
   IMAGEN
   ========================================================= */

body.home .products-recent .wc-block-grid__product-image {
    position: relative !important;

    width: 100% !important;
    aspect-ratio: 1 / 1 !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: hidden !important;

    background: #fff !important;
}


body.home .products-recent .wc-block-grid__product-image img {
    display: block !important;

    width: 100% !important;
    height: 100% !important;

    margin: 0 !important;

    object-fit: contain !important;
    object-position: center !important;

    transition: transform .35s ease !important;
}


body.home .products-recent .wc-block-grid__product:hover
.wc-block-grid__product-image img {
    transform: scale(1.025) !important;
}


/* =========================================================
   ETIQUETA OFERTA
   ========================================================= */

body.home .products-recent .wc-block-grid__product-onsale {
    position: absolute !important;
    z-index: 5 !important;

    top: 12px !important;
    left: 12px !important;

    margin: 0 !important;
    padding: 5px 10px !important;

    border: 0 !important;
    border-radius: 5px !important;

    background: #f12f3c !important;
    color: #fff !important;

    font-size: 10px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    letter-spacing: .2px !important;
}


/* =========================================================
   TÍTULO
   ========================================================= */

body.home .products-recent .wc-block-grid__product-title {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;

    min-height: 56px !important;

    margin: 16px 16px 8px !important;

    color: #171717 !important;

    font-size: 15px !important;
    line-height: 1.28 !important;
    font-weight: 650 !important;

    text-align: center !important;

    text-decoration: none !important;
}


/* =========================================================
   PRECIO
   ========================================================= */

body.home .products-recent .wc-block-grid__product-price {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;

    min-height: 30px !important;

    margin: 4px 15px 16px !important;

    font-size: 16px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;

    color: #e00000 !important;
}


/* Precio anterior */
body.home .products-recent .wc-block-grid__product-price del {
    color: #aaa !important;

    font-size: 12px !important;
    font-weight: 400 !important;

    opacity: 1 !important;
}


/* Precio oferta */
body.home .products-recent .wc-block-grid__product-price ins {
    color: #e00000 !important;

    font-weight: 750 !important;

    text-decoration: none !important;
}


/* =========================================================
   BOTÓN AÑADIR AL CARRITO
   ========================================================= */

body.home .products-recent .wc-block-grid__product-add-to-cart {
    width: auto !important;

    margin: auto 15px 0 !important;
    padding: 0 !important;
}


body.home .products-recent
.wc-block-grid__product-add-to-cart
.wp-block-button__link,

body.home .products-recent
.wc-block-grid__product-add-to-cart
a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    min-height: 44px !important;

    padding: 0 14px !important;

    border: 1px solid #111 !important;
    border-radius: 7px !important;

    background: #111 !important;
    color: #fff !important;

    font-size: 11px !important;
    line-height: 1 !important;
    font-weight: 700 !important;

    text-align: center !important;
    text-decoration: none !important;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease !important;
}


body.home .products-recent
.wc-block-grid__product-add-to-cart
.wp-block-button__link:hover,

body.home .products-recent
.wc-block-grid__product-add-to-cart
a:hover {
    background: #fff !important;
    color: #111 !important;

    transform: translateY(-1px) !important;
}


/* =========================================================
   AJUSTE FINAL - ESCRITORIO
   Más presencia sin hacer las tarjetas gigantes
   ========================================================= */

@media (min-width: 901px) {

    body.home .products-recent {
        max-width: 1420px !important;
        width: calc(100% - 60px) !important;
    }

    body.home .products-recent .wc-block-grid__products {
        gap: 22px !important;
    }

    body.home .products-recent .wc-block-grid__product-title {
        font-size: 16px !important;
        line-height: 1.3 !important;
        min-height: 60px !important;

        margin-left: 17px !important;
        margin-right: 17px !important;
    }

    body.home .products-recent .wc-block-grid__product-price {
        font-size: 17px !important;
    }

    body.home .products-recent .wc-block-grid__product-price del {
        font-size: 12px !important;
    }

    body.home .products-recent
    .wc-block-grid__product-add-to-cart
    .wp-block-button__link,

    body.home .products-recent
    .wc-block-grid__product-add-to-cart
    a {
        min-height: 46px !important;
        font-size: 11px !important;
    }
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    body.home .products-recent .wc-block-grid__products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

}


/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 600px) {

    body.home .products-recent {
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box !important;
    }


    body.home .products-recent .wc-block-grid__products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }


    body.home .products-recent .wc-block-grid__product {
        border-radius: 12px !important;
        padding-bottom: 12px !important;
    }


    body.home .products-recent .wc-block-grid__product-title {
        min-height: 58px !important;

        margin: 12px 10px 7px !important;

        font-size: 13px !important;
        line-height: 1.25 !important;
    }


    body.home .products-recent .wc-block-grid__product-price {
        margin: 2px 8px 12px !important;

        gap: 6px !important;

        font-size: 15px !important;
    }


    body.home .products-recent .wc-block-grid__product-price del {
        font-size: 10px !important;
    }


    body.home .products-recent .wc-block-grid__product-onsale {
        top: 9px !important;
        left: 9px !important;

        padding: 5px 8px !important;

        font-size: 9px !important;
    }


    body.home .products-recent .wc-block-grid__product-add-to-cart {
        margin: auto 10px 0 !important;
    }


    body.home .products-recent
    .wc-block-grid__product-add-to-cart
    .wp-block-button__link,

    body.home .products-recent
    .wc-block-grid__product-add-to-cart
    a {
        min-height: 40px !important;

        padding: 0 8px !important;

        font-size: 9px !important;

        border-radius: 6px !important;
    }


    /* En teléfono quitamos el movimiento */
    body.home .products-recent .wc-block-grid__product:hover {
        transform: none !important;
    }

}

/* =========================================================
   GLOPI 0.6.4 — AJAX ADD TO CART SIN DEFORMAR LA TARJETA
   WooCommerce inserta .added_to_cart después del botón.
   El contenedor apila ambas acciones y cada una conserva altura propia.
   ========================================================= */
body.home .products-recent .wc-block-grid__product-add-to-cart {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    height: auto !important;
}

body.home .products-recent .wc-block-grid__product-add-to-cart > a {
    flex: 0 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

body.home .products-recent .wc-block-grid__product-add-to-cart > .add_to_cart_button {
    height: 46px !important;
    min-height: 46px !important;
}

body.home .products-recent .wc-block-grid__product-add-to-cart > .add_to_cart_button.added::after {
    content: " ✓";
    margin-left: 5px;
}

body.home .products-recent .wc-block-grid__product-add-to-cart > .added_to_cart.wc-forward {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 14px !important;
    border: 1px solid #111 !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: #111 !important;
    font-size: 11px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
}

body.home .products-recent .wc-block-grid__product-add-to-cart > .added_to_cart.wc-forward:hover {
    background: #111 !important;
    color: #fff !important;
}

@media (max-width: 600px) {
    body.home .products-recent .wc-block-grid__product-add-to-cart {
        gap: 6px !important;
    }
    body.home .products-recent .wc-block-grid__product-add-to-cart > .add_to_cart_button {
        height: 40px !important;
        min-height: 40px !important;
    }
    body.home .products-recent .wc-block-grid__product-add-to-cart > .added_to_cart.wc-forward {
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 8px !important;
        font-size: 9px !important;
        border-radius: 6px !important;
    }
}
