/* =========================================================
   FIX TARJETAS DE PRODUCTOS - LIBRERÍA WOODY
   Corrige textos encima de las imágenes en home y catálogo.
   Este archivo puede cargarse al final del head para sobreescribir estilos anteriores.
   ========================================================= */

.product-card,
.card-product,
.producto-card,
.product-card-home,
.catalog-card {
    position: relative !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    background: #fff !important;
    border-radius: 22px !important;
}

/* Contenedor superior de imagen */
.product-card .product-img,
.product-card .product-image,
.product-card .producto-img,
.product-card figure,
.card-product .product-img,
.card-product .product-image,
.card-product .producto-img,
.card-product figure,
.producto-card .product-img,
.producto-card .product-image,
.producto-card .producto-img,
.producto-card figure,
.catalog-card .product-img,
.catalog-card .product-image,
.catalog-card .producto-img,
.catalog-card figure {
    position: relative !important;
    width: 100% !important;
    height: 260px !important;
    min-height: 260px !important;
    max-height: 260px !important;
    overflow: hidden !important;
    margin: 0 !important;
    background: #f6f0e7 !important;
    display: block !important;
    flex: 0 0 260px !important;
}

/* Imagen siempre contenida en su caja */
.product-card img,
.card-product img,
.producto-card img,
.catalog-card img {
    width: 100% !important;
    height: 260px !important;
    min-height: 260px !important;
    max-height: 260px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Si existe badge de categoría, queda sobre la imagen pero controlado */
.product-card .badge,
.product-card .category-badge,
.product-card .categoria-badge,
.product-card .product-badge,
.card-product .badge,
.card-product .category-badge,
.card-product .categoria-badge,
.card-product .product-badge,
.producto-card .badge,
.producto-card .category-badge,
.producto-card .categoria-badge,
.producto-card .product-badge,
.catalog-card .badge,
.catalog-card .category-badge,
.catalog-card .categoria-badge,
.catalog-card .product-badge {
    position: absolute !important;
    left: 16px !important;
    top: 214px !important;
    z-index: 3 !important;
    max-width: calc(100% - 32px) !important;
    white-space: nowrap !important;
}

/* Contenido separado de la imagen */
.product-card .product-body,
.product-card .card-body,
.product-card .producto-info,
.product-card .product-info,
.card-product .product-body,
.card-product .card-body,
.card-product .producto-info,
.card-product .product-info,
.producto-card .product-body,
.producto-card .card-body,
.producto-card .producto-info,
.producto-card .product-info,
.catalog-card .product-body,
.catalog-card .card-body,
.catalog-card .producto-info,
.catalog-card .product-info {
    position: relative !important;
    z-index: 2 !important;
    background: #fff !important;
    padding: 18px 18px 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    flex: 1 1 auto !important;
}

/* Por si tu HTML no tiene product-body y el texto va directo dentro de la tarjeta */
.product-card > h3,
.product-card > h4,
.product-card > p,
.product-card > .price,
.product-card > .precio,
.card-product > h3,
.card-product > h4,
.card-product > p,
.card-product > .price,
.card-product > .precio,
.producto-card > h3,
.producto-card > h4,
.producto-card > p,
.producto-card > .price,
.producto-card > .precio,
.catalog-card > h3,
.catalog-card > h4,
.catalog-card > p,
.catalog-card > .price,
.catalog-card > .precio {
    position: relative !important;
    z-index: 2 !important;
    background: #fff !important;
    margin-left: 18px !important;
    margin-right: 18px !important;
}

/* Títulos con altura controlada para que no invadan la foto */
.product-card h3,
.product-card h4,
.card-product h3,
.card-product h4,
.producto-card h3,
.producto-card h4,
.catalog-card h3,
.catalog-card h4 {
    position: relative !important;
    z-index: 2 !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    color: #0e2740 !important;
    line-height: 1.22 !important;
    min-height: auto !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Descripciones */
.product-card p,
.card-product p,
.producto-card p,
.catalog-card p {
    position: relative !important;
    z-index: 2 !important;
    margin-top: 0 !important;
    color: #5f6f7f !important;
    line-height: 1.5 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Precio */
.product-card .price,
.product-card .precio,
.product-card .product-price,
.card-product .price,
.card-product .precio,
.card-product .product-price,
.producto-card .price,
.producto-card .precio,
.producto-card .product-price,
.catalog-card .price,
.catalog-card .precio,
.catalog-card .product-price {
    position: relative !important;
    z-index: 2 !important;
    display: block !important;
    font-size: 1.42rem !important;
    font-weight: 900 !important;
    color: #285d50 !important;
    line-height: 1.1 !important;
    margin: 4px 0 12px !important;
}

/* Botonera siempre abajo */
.product-card .product-actions,
.product-card .card-actions,
.product-card .acciones,
.card-product .product-actions,
.card-product .card-actions,
.card-product .acciones,
.producto-card .product-actions,
.producto-card .card-actions,
.producto-card .acciones,
.catalog-card .product-actions,
.catalog-card .card-actions,
.catalog-card .acciones {
    position: relative !important;
    z-index: 2 !important;
    margin-top: auto !important;
    display: grid !important;
    gap: 9px !important;
}

/* Botones no se suben sobre la imagen */
.product-card button,
.product-card .btn,
.card-product button,
.card-product .btn,
.producto-card button,
.producto-card .btn,
.catalog-card button,
.catalog-card .btn {
    position: relative !important;
    z-index: 2 !important;
}

/* Ajuste para imágenes verticales de libros: si prefieres ver portada completa cambia cover por contain aquí */
.product-card img.product-contain,
.card-product img.product-contain,
.producto-card img.product-contain,
.catalog-card img.product-contain {
    object-fit: contain !important;
    background: #f8f1e7 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .product-card .product-img,
    .product-card .product-image,
    .product-card .producto-img,
    .product-card figure,
    .card-product .product-img,
    .card-product .product-image,
    .card-product .producto-img,
    .card-product figure,
    .producto-card .product-img,
    .producto-card .product-image,
    .producto-card .producto-img,
    .producto-card figure,
    .catalog-card .product-img,
    .catalog-card .product-image,
    .catalog-card .producto-img,
    .catalog-card figure {
        height: 210px !important;
        min-height: 210px !important;
        max-height: 210px !important;
        flex-basis: 210px !important;
    }

    .product-card img,
    .card-product img,
    .producto-card img,
    .catalog-card img {
        height: 210px !important;
        min-height: 210px !important;
        max-height: 210px !important;
    }

    .product-card .badge,
    .product-card .category-badge,
    .product-card .categoria-badge,
    .product-card .product-badge,
    .card-product .badge,
    .card-product .category-badge,
    .card-product .categoria-badge,
    .card-product .product-badge,
    .producto-card .badge,
    .producto-card .category-badge,
    .producto-card .categoria-badge,
    .producto-card .product-badge,
    .catalog-card .badge,
    .catalog-card .category-badge,
    .catalog-card .categoria-badge,
    .catalog-card .product-badge {
        top: 166px !important;
    }
}
