/* --- B2B PRODUCT CARD SYSTEM v2.0 (Desktop Default + Mobile Grid Override) --- */
/* Extracted/Consolidated for Global Use (Home, Search, Wishlist) */

/* 1. DESKTOP STYLES (Premium, Spacious, Hover Effects) */
.products-grid-custom {
    display: grid;
    /* FORZAMOS 4 COLUMNAS EN DESKTOP PARA QUE OCUPEN TODO EL ANCHO */
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 0;
}

/* RESPONSIVE BREAKPOINTS PARA GRID DE ESCRITORIO/TABLET */
@media (max-width: 1200px) {
    .products-grid-custom {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid-custom {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Neutralizar borde exterior para evitar "tarjeta dentro de otra tarjeta" */
.product-miniature {
    height: 100%;
    position: relative;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Inner Card Styling - ÚNICO BORDE VISIBLE */
.p-card-inner {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 12px !important;
    padding: 15px !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Hover Effects - LEVANTAR LA TARJETA */
.p-card-inner:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12) !important;
    border-color: #d0d0d0 !important;
    z-index: 2;
}

.thumbnail-container {
    width: 100%;
    height: 200px;
    /* Reducido de 250px para ser más compacto */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.thumbnail-container a {
    display: block;
    width: 100%;
    height: 100%;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}

.p-card-inner:hover .thumbnail-container img {
    transform: scale(1.15);
}

.product-description {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* NUEVO: Línea Meta Unificada (Marca | Ref) */
.product-meta-line {
    font-size: 0.75rem;
    color: #aaa;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.meta-separator {
    color: #ddd;
    font-weight: 300;
}

.product-brand {
    color: #888;
}

.product-reference {
    color: #999;
    font-weight: 600;
}

.product-title {
    margin: 0 0 8px 0;
    min-height: unset;
    line-height: 1.25;
}

.product-title a {
    color: #333 !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.product-title a:hover {
    color: #008AC9 !important;
}

/* Precios más compactos y con color correcto */
.product-pricing-block {
    margin-top: auto !important;
    margin-bottom: 5px !important;
    width: 100% !important;
}

.custom-pricing-pvp {
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    color: #28a745 !important;
    line-height: 1 !important;
    margin-bottom: 2px !important;
}

.custom-pricing-client {
    font-size: 0.9rem !important;
    color: #555 !important;
    margin-top: 0 !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

.product-stock-status {
    margin-top: 5px;
    font-size: 0.8rem;
    font-weight: 600;
}

.stock-ok {
    color: #28a745;
}

.stock-warning {
    color: #ff9800;
}

.stock-backorder {
    color: #008AC9;
}

.stock-ko {
    color: #dc3545;
}

.btn-add {
    width: 100%;
    margin-top: 10px;
    padding: 10px 0;
    font-size: 0.9rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #ddd;
    color: #444;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add:hover {
    background: #333;
    color: #fff;
    border-color: #333;
}

.btn-add.added {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.badge-new {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #008AC9;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.badge-offer {
    background: #dc3545;
    position: absolute;
    top: 12px;
    left: 12px;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.customer-price-val {
    color: #008AC9;
    font-weight: 700;
}

/* NUEVOS ESTILOS PARA PRECIOS (Migrados de inline) */
.main-price-v2 {
    color: #28a745;
    font-size: 1.5rem;
    /* Ajustado de 1.7rem para ser más equilibrado */
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2px;
}

.customer-price-line {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

/* --- MOBILE OVERRIDES (Ultra Compact) --- */
@media (max-width: 768px) {
    .products-grid-custom {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        row-gap: 15px !important;
        /* SIGNIFICATIVAMENTE MENOS ESPACIO ENTRE FILAS */
        padding: 5px !important;
        grid-auto-rows: auto !important;
    }

    .product-miniature {
        height: auto !important;
        /* Dejar que la tarjeta sea tan corta como su contenido */
        min-height: auto !important;
        /* ELIMINAR EL HUECO GIGANTE DE 450PX */
    }

    .p-card-inner {
        padding: 8px !important;
        /* Menos padding interno */
        border-radius: 10px !important;
        height: auto !important;
        /* Evitar estiramiento vertical */
        justify-content: flex-start !important;
        display: block !important;
        /* Layout más simple para móvil */
        text-align: center;
    }

    .thumbnail-container {
        height: 130px !important;
        /* Un pelín más corto */
        margin-bottom: 5px !important;
    }

    .product-description {
        display: block !important;
        /* Evitar gap de flexbox */
        padding: 0 !important;
    }

    .product-meta-line {
        font-size: 0.6rem !important;
        margin-bottom: 0px !important;
        display: flex;
        justify-content: center;
        gap: 3px;
    }

    .product-title {
        margin: 2px 0 4px 0 !important;
        min-height: auto !important;
    }

    .product-title a {
        font-size: 0.8rem !important;
        line-height: 1.1 !important;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        display: -webkit-box;
    }

    .product-pricing-block {
        margin-top: 4px !important;
        margin-bottom: 0 !important;
        /* IMPORTANTE: Quitar el margin-top: auto que empuja hacia abajo en desktop */
        display: block !important;
    }

    .main-price-v2 {
        font-size: 1.1rem !important;
        margin: 0 !important;
        line-height: 1 !important;
    }

    .customer-price-line {
        font-size: 0.7rem !important;
        margin: 2px 0 !important;
    }

    .product-stock-status {
        font-size: 0.65rem !important;
        margin: 2px 0 !important;
    }

    .btn-add {
        margin-top: 6px !important;
        margin-bottom: 0 !important;
        padding: 5px 0 !important;
        font-size: 0.75rem !important;
        height: auto !important;
        border-radius: 6px !important;
    }

    .badge-new,
    .badge-offer {
        padding: 2px 5px !important;
        font-size: 0.6rem !important;
        top: 6px !important;
        left: 6px !important;
    }

    .btn-wishlist-toggle {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.8rem !important;
        top: 6px !important;
        right: 6px !important;
    }
}

/* [STOCK_VISIBILITY_START] */

.availability, .availability-list, .product-availability, 
.product-quantities, .out-of-stock, .available-now, .available-later,
.stock-notification, [class*='availability'], .card-availability,
.label-availability, .product-flags .availability,
.warning_inline, span.warning, .alert-warning,
.product-last-items, .last-items, .product-unavailable,
/* CLASES ESPECÍFICAS DE B2BHelper: */
.product-stock-status, .stock-ok, .stock-warning, .stock-backorder, .stock-ko {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0 !important;
    content: '' !important;
}
.availability span, .product-availability span, .product-stock-status span { display:none !important; }
/* [STOCK_VISIBILITY_END] */