/* =====================================================
   PRESTASHOP - FORZAR ALTURA EXACTA 550px
   ===================================================== */

/* ========================================
   MÓVIL (Menos de 768px)
   ======================================== */
@media (max-width: 767px) {

    /* 🔹 1. CONTENEDOR: gap entre columnas + flexwrap */
    #js-product-list .products,
    .products {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 12px !important;              /* ← SEPARACIÓN EXACTA ENTRE COLUMNAS */
        margin: 0 -6px !important;         /* ← Compensa padding si el tema usa .row */
    }

    /* 🔹 2. COLUMNAS: 50% real, sin encogerse ni pegarse */
    #js-product-list .products .col-xs-12,
    .products .col-xs-12,
    #js-product-list .products > *,
    .products > * {
        flex: 0 0 calc(50% - 6px) !important;
        max-width: calc(50% - 6px) !important;
        padding: 0 !important;
        margin: 0 !important;
        flex-shrink: 0 !important;         /* ← NO ENCOGER */
    }

    /* 🔹 3. TARJETA: altura fija aumentada para móvil */
    .product-miniature {
        height: 480px !important;          /* ← ALTURA AUMENTADA (ajustable) */
        display: flex !important;
        flex-direction: column !important;
        padding: 12px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        background: #fff !important;
    }

    /* 🔹 4. AJUSTES INTERNOS PARA QUE QUEPA TODO EN MÓVIL */
    .product-miniature .product-thumbnail img {
        height: 150px !important;
        width: 100% !important;
        object-fit: contain !important;
        margin-bottom: 8px !important;
    }

    .product-miniature .product-title {
        font-size: 14px !important;
        line-height: 1.3 !important;
        margin-bottom: 6px !important;
        max-height: 38px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .product-miniature .price,
    .product-miniature .product-price-and-shipping {
        font-size: 17px !important;
        font-weight: 700 !important;
        margin-bottom: 8px !important;
        line-height: 1.2 !important;
    }

    /* Si tu módulo de botón está activo, esto lo empuja al fondo */
    .product-miniature .add-to-cart,
    .product-miniature .ajax-add-to-cart,
    .product-miniature .product-actions {
        margin-top: auto !important;
        font-size: 13px !important;
        padding: 8px !important;
        width: 100% !important;
    }
}

/* ========================================
   ESCRITORIO (768px o más) - 3 COLUMNAS
   ======================================== */
@media (min-width: 768px) {

    /* 🔹 1. CONTENEDOR: gap entre columnas + flexwrap */
    #js-product-list .products,
    .products {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 20px !important;
        margin: 0 -10px !important;
    }

    /* 🔹 2. COLUMNAS: 33.33% real, sin encogerse ni pegarse */
    #js-product-list .products .col-md-4,
    #js-product-list .products .col-lg-4,
    #js-product-list .products .col-xs-12,
    .products .col-md-4,
    .products .col-lg-4,
    .products .col-xs-12,
    #js-product-list .products > *,
    .products > * {
        flex: 0 0 calc(33.333% - 14px) !important;
        max-width: calc(33.333% - 14px) !important;
        padding: 0 !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    /* 🔹 3. TARJETA: altura fija aumentada para escritorio */
    .product-miniature {
        height: 580px !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 16px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        background: #fff !important;
    }

    /* 🔹 4. IMAGEN */
    .product-miniature .product-thumbnail img {
        height: 220px !important;
        width: 100% !important;
        object-fit: contain !important;
        margin-bottom: 12px !important;
    }

    /* ✅ TÍTULO: 2 LÍNEAS EXACTAS (SOLUCIÓN DEFINITIVA) */
    .product-miniature .product-title,
    .product-miniature .product-title a,
    .product-miniature .product-title h3 {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: normal !important;      /* ← ROMPE el nowrap del tema */
        word-break: break-word !important;
        line-height: 1.35 !important;
        max-height: 2.7em !important;        /* ← 2 líneas exactas (1.35 × 2) */
        min-height: 2.7em !important;        /* ← Reserva espacio aunque sea corto */
        height: auto !important;
        margin-bottom: 8px !important;
    }

    /* 🔹 5. PRECIO */
    .product-miniature .price,
    .product-miniature .product-price-and-shipping {
        font-size: 20px !important;
        font-weight: 700 !important;
        margin-bottom: 10px !important;
        line-height: 1.2 !important;
    }

    /* 🔹 6. BOTÓN: al fondo */
    .product-miniature .add-to-cart,
    .product-miniature .ajax-add-to-cart,
    .product-miniature .product-actions {
        margin-top: auto !important;
        font-size: 14px !important;
        padding: 10px !important;
        width: 100% !important;
    }
}





/* ARREGLA ZOOM DE IMAGENES */
.product-cover,
#product-cover,
.product-images > .product-cover {
    max-width: none !important;
    width: 100% !important;
}

/* Evitar que la imagen se deforme al quitar el límite */
.product-cover img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Si usas zoom/lightbox, asegurar que el contenedor no recorte */
.fancybox-content,
.modal-body img,
.product-cover img.zoomImg {
    max-width: 1000px !important;
    max-height: 1000px !important;
}

