/*
 * Parts Finder 0.3.42 product result cards.
 * Loaded after the existing public styles.
 */

.dou-parts-finder .dou-product-results {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 18px;
}

.dou-parts-finder .dou-product-card {
    display: flex;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #dfe5ee;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(20, 33, 66, 0.045);
    transition:
        border-color 170ms ease,
        box-shadow 170ms ease,
        transform 170ms ease;
}

.dou-parts-finder .dou-product-card:hover {
    border-color: #c7d1df;
    box-shadow: 0 15px 34px rgba(20, 33, 66, 0.1);
    transform: translateY(-2px);
}

/* Existing markup: image, title, code badge, price. CSS Grid keeps the footer aligned. */
.dou-parts-finder .dou-product-card > a {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) 98px;
    grid-template-rows: auto auto 1fr auto;
    column-gap: 12px;
    min-width: 0;
    height: 100%;
    padding: 16px;
    color: inherit;
    text-decoration: none;
}

.dou-parts-finder .dou-product-card > a > img {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 0 14px;
    border-radius: 12px;
    background: #f5f7fa;
    object-fit: contain;
    object-position: center;
}

.dou-parts-finder .dou-product-card h3 {
    display: -webkit-box;
    grid-column: 1 / -1;
    align-self: start;
    min-height: 2.8em;
    max-height: 2.8em;
    margin: 0 0 12px;
    overflow: hidden;
    color: #142142;
    font-size: 16px;
    font-weight: 760;
    letter-spacing: -0.01em;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.dou-parts-finder .dou-card-part-code {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1;
    grid-row: 4;
    align-self: end;
    align-items: center;
    align-content: center;
    justify-content: flex-start;
    gap: 0 4px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    max-width: 100%;
    margin: 0;
    padding: 7px 12px;
    overflow: hidden;
    border-radius: 16px;
    background: #142142;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.dou-parts-finder .dou-card-part-code strong {
    flex: 0 0 auto;
    margin-right: 4px;
    font-weight: 800;
    white-space: nowrap;
}

.dou-parts-finder .dou-product-card > a > span:last-child {
    display: flex;
    grid-column: 2;
    grid-row: 4;
    align-self: end;
    align-items: flex-end;
    justify-content: flex-end;
    flex-direction: column;
    width: 98px;
    min-width: 98px;
    margin: 0;
    color: #ef8b00;
    font-size: 17px;
    box-sizing: border-box;
    font-weight: 850;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
}

.dou-parts-finder .dou-product-card > a > span:last-child .amount,
.dou-parts-finder .dou-product-card > a > span:last-child bdi {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

/* WooCommerce sale price: old price above, current price below. */
.dou-parts-finder .dou-product-card > a > span:last-child del {
    display: block;
    margin: 0 0 4px;
    color: #8a94a6;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.1;
    opacity: 1;
    text-decoration-color: #8a94a6;
    text-decoration-thickness: 1px;
}

.dou-parts-finder .dou-product-card > a > span:last-child ins {
    display: block;
    margin: 0;
    color: #ef8b00;
    font-size: 18px;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
}

/* When no primary code exists, keep the price aligned to the same footer row. */
.dou-parts-finder .dou-product-card > a > h3 + span:last-child {
    grid-column: 1 / -1;
}

@media (max-width: 1180px) {
    .dou-parts-finder .dou-product-results {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .dou-parts-finder .dou-product-results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }
}

@media (max-width: 560px) {
    .dou-parts-finder .dou-product-results {
        grid-template-columns: 1fr;
    }

    .dou-parts-finder .dou-product-card > a {
        padding: 14px;
    }

    .dou-parts-finder .dou-card-part-code {
        max-width: 100%;
    }
}
@media (max-width: 640px) {
    .dou-parts-finder .dou-product-card > a {
        grid-template-columns: minmax(0, 1fr) 90px;
    }

    .dou-parts-finder .dou-product-card > a > span:last-child {
        width: 90px;
        min-width: 90px;
    }
}
