﻿/* Product card border */
.product-card {
    border-color: #f6d4cb !important;
}

/* Text Editor Color Support for Product Cards */
.product-card p:not(.product-detail-title) {
    color: inherit !important;
}

/* ── Product card entrance animation ── */
@keyframes productSlideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Only animate columns inside the product content area */
.product-content .row.g-4 > [class*="col-"] {
    animation: productSlideInUp 0.45s ease both;
}

/* xl: 4 columns — stagger by column */
.product-content .row.g-4 > [class*="col-"]:nth-child(4n+1) { animation-delay: 0ms; }
.product-content .row.g-4 > [class*="col-"]:nth-child(4n+2) { animation-delay: 80ms; }
.product-content .row.g-4 > [class*="col-"]:nth-child(4n+3) { animation-delay: 160ms; }
.product-content .row.g-4 > [class*="col-"]:nth-child(4n+4) { animation-delay: 240ms; }

@media (max-width: 1199.98px) {
    /* lg: 3 columns */
    .product-content .row.g-4 > [class*="col-"]:nth-child(4n+1),
    .product-content .row.g-4 > [class*="col-"]:nth-child(4n+2),
    .product-content .row.g-4 > [class*="col-"]:nth-child(4n+3),
    .product-content .row.g-4 > [class*="col-"]:nth-child(4n+4) { animation-delay: 0ms; }

    .product-content .row.g-4 > [class*="col-"]:nth-child(3n+1) { animation-delay: 0ms; }
    .product-content .row.g-4 > [class*="col-"]:nth-child(3n+2) { animation-delay: 80ms; }
    .product-content .row.g-4 > [class*="col-"]:nth-child(3n+3) { animation-delay: 160ms; }
}

@media (max-width: 767.98px) {
    /* md/sm: 2 columns */
    .product-content .row.g-4 > [class*="col-"]:nth-child(3n+1),
    .product-content .row.g-4 > [class*="col-"]:nth-child(3n+2),
    .product-content .row.g-4 > [class*="col-"]:nth-child(3n+3) { animation-delay: 0ms; }

    .product-content .row.g-4 > [class*="col-"]:nth-child(2n+1) { animation-delay: 0ms; }
    .product-content .row.g-4 > [class*="col-"]:nth-child(2n+2) { animation-delay: 80ms; }
}

.product-card p:not(.product-detail-title) * {
    color: inherit !important;
}

.product-card p font[color],
.product-card p span[style*="color"] {
    color: inherit !important;
}

.product-card p strong, .product-card p b { font-weight: bold; }
.product-card p em, .product-card p i { font-style: italic; }
.product-card p u { text-decoration: underline; }

.product-card p [style*="font-size"] {
    font-size: inherit !important;
}

/* ---- Reduce gap between image and product name ---- */
.product-content .product-card .rounded-bottom {
    padding-top: 0.5rem !important;
}

/* ---- Compact card body: less padding on xl, smaller title ---- */
.product-content .product-card .rounded-bottom.p-xl-4 {
    padding: 0.5rem 0.75rem 0.75rem !important;
}
.product-content .product-card p.fw-bold.text-capitalize {
    font-size: 0.82rem !important;
    line-height: 1.3;
    margin-bottom: 0.35rem !important;
}

/* ---- Desktop: equal-height cards with button pinned at bottom ---- */
@media (min-width: 768px) {
    .product-content .row.g-4 > [class*="col-"] {
        display: flex;
    }

    .product-content .row.g-4 .product-card {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .product-content .row.g-4 .product-card .rounded-bottom {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }

    .product-content .row.g-4 .product-card .rounded-bottom > .d-flex {
        margin-top: auto;
    }
}

/* ── Mobile screens (< 768px): scale down product title slightly ── */
@media (max-width: 767.98px) {
    .product-card p.fw-bold.text-capitalize {
        font-size: .78rem !important;
        line-height: 1.3;
    }
}

/* ── Very small screens (< 400px): 2-col cards are ~150px wide ── */
@media (max-width: 399.98px) {

    /* 1. Badge: allow wrap so long category names don't overflow the card */
    .product-card .featured-cat-badge {
        white-space: normal;
        word-break: break-word;
        width: auto;
        max-width: 86%;
        font-size: .46rem;
        padding: 3px 6px;
        line-height: 1.35;
        text-align: center;
    }

    /* 2. Product title: tighter so fewer wrap lines */
    .product-card p.fw-bold.text-capitalize {
        font-size: .75rem !important;
        line-height: 1.3;
    }

    /* 3. Barcode: scale down */
    .product-card p.small {
        font-size: .65rem !important;
        margin-bottom: .4rem !important;
    }

    /* 4. Button: smaller text + tighter padding to fit in narrow column */
    .product-card .btn.custom-button {
        font-size: .65rem !important;
        padding: 0.28rem 0.35rem !important;
        letter-spacing: 0;
        white-space: nowrap;
    }

    /* 5. Hide button icon on very small screens to save space */
    .product-card .btn.custom-button .fa {
        display: none;
    }

    /* 6. Reduce bottom padding of card body */
    .product-card .rounded-bottom {
        padding: 0.35rem !important;
    }
}
