.card-product .card-title {
    height: 2em;
}

/* Clamp a long product name to 2 lines with an ellipsis so it can't overflow the
   fixed-height title box and collide with the price/description below. Covers the
   standard cards (.card-product) AND the category "Featured Products" section,
   whose related-product cards are .card-blog (name in h4.card-title, not the
   sibling .price-container.card-title). The full name still shows on the detail page. */
.card-product .card-title a,
.related-product h4.card-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Uniform product-card image box ----------------------------------------
   The card <img> is served through Broadleaf's ?browse operation (fit within
   400x400, aspect ratio preserved), so source images of differing ratios
   yielded differing card heights. Constrain every grid card image to a fixed
   square box and letterbox the image inside it on white: the whole product
   stays visible (no crop) and all cards share one height.
   Selector carries .card.product-list-item to override material-kit's
   `.card .card-image { height: 60% }`. */
.card.product-list-item .card-image {
    height: auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #fff;
}

.card.product-list-item .card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #fff;
}

div.products {
    align-content: space-evenly;
    flex-wrap: wrap;
    align-items: flex-start ;
}

.new-badge {
    width: 60px;
    height: 60px;
    background: url(../../img/badge-new.png) no-repeat;
    text-indent: -9999px;
    position: absolute;
    top: -10px;
    left: 2px;
    z-index: 20;
}

/* Coming-soon badge: image seal mirroring .new-badge, placed in the opposite
   (top-right) corner so the two never collide. The inline text is hidden
   (text-indent) and the SVG seal is shown as the background. */
.coming-soon-badge {
    width: 60px;
    height: 60px;
    background: url(../../img/badge-coming-soon.svg) no-repeat;
    background-size: 60px 60px;
    text-indent: -9999px;
    overflow: hidden;
    position: absolute;
    top: -10px;
    right: 2px;
    z-index: 20;
}

.product-card .footer .btn {
    margin-bottom: 4px;
    padding: 6px;
    border-radius: 50%;
    margin-left: auto;
}

.product-card .footer {
    display: table;
    width: 100%;
}

.product-card .footer > div {
    display: inline-block;
}

.in-cart-link-container {
    float: right;
    text-align: right;
}

.in-cart-link-container .btn {
    margin-top: 1px;
    color: #4caf50;
}
.in-cart-link-container .btn:hover {
    color: #4caf50;
}

.card-content .footer div.add-to-cart {
    margin: 1em;
    border: none;
    background-color: transparent;
    color: transparent;
}

.related-product .card-title {
    margin-top: 1em;
    margin-bottom: 0;
    height: 3em;
    line-height: 1.5em;
    padding-left: 1em;
    padding-right: 1em;
    text-align: center;
}

.text-right {
    text-align: right;
}

.card-less-raised {
    box-shadow: 0 12px 34px -12px rgba(0, 0, 0, 0.4), 0 4px 20px 0 rgba(0, 0, 0, 0.3), 0 8px 10px -5px rgba(0, 0, 0, 0.4);
}

.related-product .card-description {
    color: rgba(0,0,0, 0.87);
}

.related-product .card-content .footer {
    display: table;
    width: 100%;
}

.related-product .card-content .footer div {
    display: table-cell;
}

.related-price-old {
    color: #AAAAAA;
    text-decoration: line-through;
    padding-left: 5px;
}

.related-product .card-content .footer .price-container {
    text-align: left;
    font-size: 18px;
    padding: 0;
    margin: 0;
    height: auto;
}

.related-product .card-content .footer .button-container {
    text-align: right;
}

.related-product .card-content .card-description {
    text-align: left;
    height: 7.5em;
    line-height: 1.5em;
    margin-bottom: 0;
    overflow: hidden;
}

.related-products .title {
    margin-bottom: 30px;
}

.product-list-item .card-content .product-title {
    height: 2em;
    line-height: 1em;
    margin-bottom: .5em;
}

.card .card-image .card-title {
    text-shadow: none;
    font-family: "Roboto", "Helvetica", "Arial", sans-serif;
    font-weight: 300;
}

.out-of-stock-overlay {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
}

.product-list-item .is-out-of-stock img {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.product-list-item .is-out-of-stock .out-of-stock {
    position: absolute;
    z-index: 4;
    vertical-align: bottom;
    left: 0;
    padding-left: 10px !important;
    padding-right: 10px !important;
    height: auto;
    background-color: #f44336;
    box-shadow: 1px 1px 3px black;
    border-radius: 0 5px 5px 0;
}

.product-list-item .is-out-of-stock .out-of-stock .material-icons {
    margin-bottom: 3px;
}

.product-list-item .footer.product-actions .stats {
    display: inline-flex;
}

.product-list-item .footer.product-actions .stats a .material-icons {
    vertical-align: initial;
}

.row-centered {
    text-align: center;
}

.col-centered {
    display: inline-block;
    float: none;
    text-align: left;
    margin-right: -4px;
    vertical-align: top;
}

.product-list-item .btn-quickview,
.product-list-item .btn-add-to-cart {
    transform: translateY(-150%);
    margin: 0 0.5em;
    visibility: hidden;
}

.product-list-item:hover .btn-quickview,
.product-list-item:hover .btn-add-to-cart{
    visibility: visible;
}

.quick-view-media,
.nav > li > .quick-view-media {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
}

/* --- Mobile (xs): persistent Add to Cart overlay ---------------------------
   On desktop the action buttons are revealed on hover, which touch devices
   can't trigger, so the template hides them with hidden-xs. On mobile we
   surface Add to Cart only (quick view stays hidden — tapping the card opens
   the full product page) as an always-visible overlay at the image's
   bottom-centre. */
@media (max-width: 767px) {
    .product-list-item .cntr-abs-horz {
        /* Keep the template's horizontal centring (left:50% + width:100% +
           text-align:center); just lift the row up to sit near the image's
           bottom with some breathing room below it. */
        transform: translateX(-50%) translateY(-145%);
        z-index: 2;
    }
    .product-list-item .cntr-abs-horz .js-addToCartContainer,
    .product-list-item .cntr-abs-horz .js-addToCartContainer form,
    .product-list-item .cntr-abs-horz .js-inCartLinkContainer {
        display: inline-block;
        margin: 0;
    }

    /* Quick view stays hidden on mobile. */
    .product-list-item .btn-quickview {
        display: none !important;
    }

    /* Reveal Add to Cart / In Cart: beat hidden-xs, the hover visibility gate,
       and the -150% slide-up transform. */
    .product-list-item .btn-add-to-cart {
        display: inline-block !important;
        visibility: visible;
        transform: none;
        margin: 0;
    }

    /* Long names are common; a smaller title on the tight 2-up mobile tiles fits
       more of the name before the 2-line ellipsis clamps it. */
    .product-list-item .card-content .product-title {
        font-size: 14px;
    }

    /* Two-up tiles are tighter on mobile: shrink the price to save space, but make
       it bolder and darker so it stays legible. The struck-through original price
       stays smaller and muted. */
    .product-list-item .price {
        font-size: 13px;
    }
    .product-list-item .price span {
        font-weight: 700;
        color: #1a1a1a;
    }
    .product-list-item .price .price-old {
        font-size: 0.85em;
        font-weight: 400;
        color: #999;
    }

    /* Smaller name on the category "Featured Products" related tiles too, so more
       of a long name fits before the 2-line ellipsis. */
    .related-product h4.card-title {
        font-size: 14px;
    }

    /* Featured/related tiles (also 2-up on mobile): same price treatment —
       smaller but bolder/darker. */
    .related-product .card-content .footer .price-container {
        font-size: 13px;
        text-align: center;
    }
    .related-product .price,
    .related-product .price div {
        font-weight: 700;
        color: #1a1a1a;
        text-align: center;
        white-space: nowrap; /* keep the price on one line (no unit/amount split) */
    }
    .related-product .price .related-price-old {
        font-size: 0.85em;
        font-weight: 400;
        color: #999;
    }
    /* Stack the footer: the price gets its own full-width line (so it can't wrap
       unit-above / amount-below), with the More button beneath it rather than
       squeezed alongside. */
    .related-product .card-content .footer div {
        display: block;
    }
    .related-product .card-content .footer .button-container {
        text-align: center;
        margin-top: 8px;
    }
    .related-product .card-content .footer .btn.btn-sm {
        min-width: 0;
    }
}