/* filepath: website_sale_aplicoop/static/src/css/components/product-card.css */

/**
 * Product card component styles
 */

.product-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s, transform 0.2s;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    height: 100%;
    overflow: hidden;
    outline: none;
}

.product-card:hover,
.product-card:focus-within {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 2px;
}

.product-card .product-image {
    height: 120px;
    width: 100%;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    background: #f3f3f3;
    display: block;
}

.product-img-cover {
    max-height: 120px;
    width: 100%;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 8px rgba(40, 39, 39, 0.09);
    background: #f3f3f3;
    display: block;
}

.product-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-grow: 1;
    padding: 0.6rem 0.7rem 0.7rem 0.7rem;
    position: relative;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.07) 0%, rgba(0, 123, 255, 0.04) 100%);
    transition: background 0.3s;
}

.product-card:hover .card-body,
.product-card:focus-within .card-body {
    background: linear-gradient(
        135deg,
        rgba(108, 117, 125, 0.13) 0%,
        rgba(108, 117, 125, 0.09) 100%
    );
}

.product-card .card-title {
    flex-grow: 1;
    margin: 0 0 0.15rem 0;
    min-height: auto;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 1.08rem !important;
    line-height: 1.1;
    text-align: center;
    font-weight: 600;
    color: #1a202c;
    letter-spacing: 0.01em;
}

.product-card .card-text {
    margin-bottom: 0.12rem;
    text-align: center;
    font-size: 1rem;
}

.product-card .card-text strong {
    display: block;
    margin-bottom: 0.1rem;
    font-size: 1.15rem;
    color: #3b82f6;
}

.product-card .product-supplier {
    text-align: center;
    color: #4a5568;
    font-weight: 400;
    margin-bottom: 0.12rem;
    font-size: 0.92rem !important;
}

.product-tags {
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.18rem;
    justify-content: center;
    font-weight: 400;
    font-size: 1.1rem !important;
    margin: 0;
    padding: 0;
}

.badge-km {
    background-color: var(--primary-color, #007bff) !important;
    color: #fff !important;
    font-weight: 600 !important;
    padding: 0.18rem 0.32rem !important;
    font-size: 0.68rem !important;
    border-radius: 0.22rem;
    display: inline-block;
    border: 1px solid #007bff;
    white-space: nowrap;
    margin-right: 0.08rem;
    margin-bottom: 0.08rem;
}

.card-body p.card-text {
    text-align: center;
    margin-bottom: 0.6rem;
    min-height: 1.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color, #007bff);
    color: #fff;
    border-radius: 0.18rem;
    font-size: 1.05rem;
}

.card-body p.card-text strong {
    display: inline;
    font-size: 1.18rem !important;
    color: var(--primary-color, #007bff);
    margin-bottom: 0;
    white-space: nowrap;
}

.product-img-fixed {
    object-fit: cover;
    height: 120px;
    width: 100%;
    border-radius: 8px 8px 0 0;
    background: #f3f3f3;
    display: block;
}

.product-img-placeholder {
    height: 120px;
    width: 100%;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    background: #f3f3f3
        url('data:image/svg+xml;utf8,<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg"><rect width="100%25" height="100%25" fill="%23f3f3f3"/><text x="50%25" y="50%25" dominant-baseline="middle" text-anchor="middle" fill="%23cccccc" font-size="16">Sin imagen</text></svg>')
        no-repeat center center;
    display: block;
}

/* Responsive: mejorar altura y espaciado en móvil */
@media (max-width: 600px) {
    .product-card {
        padding: 0.25rem;
        border-radius: 8px;
    }
    .product-card .product-image,
    .product-img-cover,
    .product-img-fixed,
    .product-img-placeholder {
        height: 70px;
        max-height: 70px;
        min-height: 70px;
        border-radius: 6px 6px 0 0;
    }
    .product-card .card-body {
        padding: 0.4rem 0.4rem 0.5rem 0.4rem;
    }
    .product-card .card-title {
        font-size: 0.98rem !important;
        margin-bottom: 0.08rem;
    }
    .product-card .card-text {
        font-size: 0.92rem;
    }
    .badge-km {
        font-size: 0.58rem !important;
        padding: 0.13rem 0.22rem !important;
    }
    .product-tags {
        font-size: 0.95rem !important;
    }
    .card-body p.card-text {
        min-height: 1.1rem;
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }
    .product-card .product-supplier {
        font-size: 0.82rem !important;
    }
}

/* Accesibilidad: focus visible */
.product-card:focus-visible {
    outline: 2.5px solid var(--primary-color, #007bff);
    outline-offset: 2px;
}
