/* ============================================================
 * Product card — shared chrome, lifted from pages/index.css so
 * search, subcategory, originals, deals etc. render the same
 * polished card the homepage uses.
 * ============================================================ */

/* Outer product card — compact, dense */
.product-slider .slideItem .product-slider-box,
.product-slider-box.active {
    background: var(--rd-card-bg) !important;
    border: 1px solid var(--rd-border) !important;
    border-radius: var(--rd-radius-md) !important;
    box-shadow: var(--rd-shadow);
    padding: 0 !important;
    overflow: hidden;
    position: relative;
    transition: transform 0.25s var(--rd-easing), box-shadow 0.25s var(--rd-easing), border-color 0.25s var(--rd-easing);
    display: flex; flex-direction: column;
    font-family: var(--rd-sans);
}
.product-slider .slideItem:hover .product-slider-box,
.product-slider-box.active:hover {
    transform: translateY(-3px);
    box-shadow: var(--rd-shadow-md);
    border-color: rgba(31,61,46,0.18) !important;
}

/* Image area — 4:3 aspect, less padding */
.product-slider-box .product-slider-img {
    background: var(--rd-cream-3);
    padding: 8px;
    aspect-ratio: 4 / 3;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid var(--rd-border);
}
.product-slider-box .product-slider-img img {
    max-width: 92%; max-height: 92%; object-fit: contain;
    transition: transform 0.35s var(--rd-easing);
}
.product-slider-box:hover .product-slider-img img { transform: scale(1.05); }

/* Offer title overlay on image */
.product-slider-box .pThumb.aside-text,
.product-slider-box [id^="product_offer_"] {
    position: absolute; top: 8px; left: 8px;
    background: var(--rd-green); color: var(--rd-text-inv) !important;
    padding: 2px 8px; border-radius: var(--rd-radius-pill);
    font-size: 9px !important; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase;
    z-index: 2; max-width: calc(100% - 16px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-slider-box [id^="product_offer_"]:empty,
.product-slider-box .weight600.pThumb.aside-text:empty {
    display: none;
}
/* Whitespace-only fallback: when Django's |default:"" leaves leading/trailing
   spaces but no real content, hide via :has(text-only) approximation — we
   collapse the inline content with overflow:hidden + max width 0 if the
   first character is whitespace and there's no inner element. A pure CSS
   approximation: if the offer overlay has 0-1 chars of text, hide it. */
.product-slider-box [id^="product_offer_"]:not(:empty):not([data-has-offer]) {
    /* Re-show only when JS sets data-has-offer or content is non-blank.
       Until then the overlay would float above the image with stray whitespace.
       The template now emits content on one line, so most cards are :empty.
       Leave this rule documented but inert. */
}

/* ---- Defensive price visibility (failsafe in case page CSS overrides) ---- */
.product-slider-box label.text-grey {
    visibility: visible !important;
    opacity: 1 !important;
}
.product-slider-box label.text-grey > .strike,
.product-slider-box label.text-grey > .discount-price,
.product-slider-box [id^="package_price_"],
.product-slider-box [id^="discount_"],
.product-slider-box [id^="discounted_price_"] {
    visibility: visible !important;
    opacity: 1 !important;
    color: var(--rd-ink) !important;
}
.product-slider-box label.text-grey > .strike {
    color: var(--rd-muted) !important;
}

/* Discount badge (corner) — % OFF / Rs X OFF
   The legacy markup is <div id="product_discount_X" class="discount"
   style="display:none">. The inline JS calls .show() + .text("X% OFF") when
   there's a discount. We keep the inline display:none working via attribute
   selectors so no-discount cards stay invisible. */
.product-slider-box .discount {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    background: var(--rd-orange, #f08a3a);
    color: #fff !important;
    padding: 5px 11px !important;
    border-radius: 999px;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    line-height: 1.1 !important;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(230,113,43,0.30);
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    display: inline-block;
}
.product-slider-box .discount:empty { display: none !important; }
.product-slider-box .discount[style*="display:none"],
.product-slider-box .discount[style*="display: none"] { display: none !important; }

/* Body — tight padding, no wasted space */
.product-slider-box > .mt-2 {
    padding: 10px 12px 12px !important;
    margin-top: 0 !important;
    flex: 1; display: flex; flex-direction: column;
    background: var(--rd-card-bg);
    gap: 4px;
}

/* Veg / non-veg pill */
.product-slider-box .commonSymbol,
.product-slider-box .vegLogo,
.product-slider-box .nonvegLogo {
    width: 12px !important; height: 12px !important;
    display: inline-block; margin: 0 !important;
}

/* Brand label */
.product-slider-box label[style*="color:#27AE60"] {
    color: var(--rd-orange-2) !important;
    font-size: 10px !important;
    text-transform: uppercase;
    letter-spacing: 0.08em; font-weight: 600;
    line-height: 1.2 !important;
    margin: 0 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block;
}

/* Frugivore Originals / icon tag (green pill below brand) */
.product-slider-box h6[style*="background: #80956d"],
.product-slider-box h6[style*="background:#80956d"] {
    background: var(--rd-green) !important;
    color: var(--rd-text-inv) !important;
    border-radius: var(--rd-radius-pill) !important;
    padding: 2px 7px !important; font-size: 9px !important;
    text-transform: uppercase; letter-spacing: 0.06em;
    margin: 0 !important;
}

/* Product name — 2 lines, tight */
.product-slider-box .pLR10 > label.text-blackish,
.product-slider-box label.text-blackish.weight500 {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    color: var(--rd-ink) !important;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
}

/* "Sourced at 4am" / "X hrs old" pill */
.product-slider-box h6[style*="border: 1px solid grey"],
.product-slider-box h6[style*="border: 1px solid #D5F5E3"] {
    background: var(--rd-cream-2) !important;
    color: var(--rd-green) !important;
    border: 1px solid transparent !important;
    border-radius: var(--rd-radius-pill) !important;
    padding: 2px 8px !important;
    font-size: 9px !important; font-weight: 600;
    letter-spacing: 0.03em;
    margin: 0 !important; width: max-content;
}
.product-slider-box h6[style*="border: 1px solid grey"] i,
.product-slider-box h6[style*="border: 1px solid #D5F5E3"] i {
    color: var(--rd-green) !important; margin-right: 3px; font-size: 8px;
}

/* Package row — single line, horizontal scroll if many */
.product-slider-box .mr-2.piece-btn.w-100 { margin: 0 !important; }
.product-slider-box .donate-now {
    list-style: none; padding: 0; margin: 0;
    display: flex; gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.product-slider-box .donate-now::-webkit-scrollbar { display: none; }
.product-slider-box .package_button { margin: 0; flex-shrink: 0; }
.product-slider-box .package_button input[type="radio"] {
    position: absolute; opacity: 0; pointer-events: none;
}
.product-slider-box .package_button label.btn,
.product-slider-box .package_button label.btnGrey {
    background: var(--rd-cream-3) !important;
    border: 1px solid var(--rd-border) !important;
    color: var(--rd-ink) !important;
    border-radius: var(--rd-radius-md) !important;
    padding: 4px 12px !important;
    min-width: 56px;
    max-width: 110px;
    min-height: 28px;
    font-size: 12px !important; font-weight: 600;
    line-height: 1.15 !important;
    margin: 0; cursor: pointer;
    white-space: normal;                     /* allow wrap when text is long */
    word-break: break-word;
    text-align: center;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.2s var(--rd-easing), border-color 0.2s var(--rd-easing), color 0.2s var(--rd-easing), transform 0.15s var(--rd-easing);
}
.product-slider-box .package_button label.btn:hover {
    border-color: var(--rd-green) !important;
    color: var(--rd-green) !important;
}
.product-slider-box .package_button input[type="radio"]:checked + label {
    background: var(--rd-green) !important;
    border-color: var(--rd-green) !important;
    color: var(--rd-text-inv) !important;
}

/* The wrapper div that wraps veg + brand+icon + name in the legacy markup
   was previously expanding the card. Make it gap-free so our body's gap rule
   provides the spacing. */
.product-slider-box .pLR10 {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 !important;
}
.product-slider-box .pLR10 > .d-flex { margin: 0 !important; }

/* Price + action row — full-width: price stacked left, ADD button far right */
.product-slider-box > .mt-2 > .d-flex {
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;     /* pin label to left edge, button to right edge */
    gap: 6px;
    margin-top: 6px;
    flex-wrap: nowrap;
    width: 100% !important;
    max-width: 100%;
    overflow: hidden;                   /* clip safety — button never escapes the card */
    box-sizing: border-box;
}
.product-slider-box > .mt-2 > .d-flex label.text-grey {
    margin: 0 !important;
    min-height: 0 !important;
    color: var(--rd-ink) !important;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 3px;
    flex: 1 1 0;                        /* grow AND shrink, base 0 so it doesn't push */
    min-width: 0;                       /* allow text-overflow / ellipsis to kick in */
    overflow: hidden;
}
.product-slider-box .strike {
    text-decoration: line-through;
    color: var(--rd-muted) !important;
    font-size: 11px !important;
    line-height: 1 !important;
    display: block !important;
    margin: 0 !important;
    text-align: left;
    white-space: nowrap;
    order: 0;                           /* MRP on top */
    align-self: flex-start;
}
.product-slider-box .discount-price,
.product-slider-box .font17.discount-price,
.product-slider-box .d-block.discount-price,
.product-slider-box .d-block.font17.discount-price {
    color: var(--rd-ink) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    display: block !important;
    margin: 0 !important;
    text-align: left;
    white-space: nowrap;
    order: 1;                           /* Rs price below MRP */
    align-self: flex-start;
}
/* The INNER `<span class="discount-price">` (the number itself) must stay
   inline so "Rs. 234" renders on one line. */
.product-slider-box .discount-price .discount-price,
.product-slider-box [id^="discount_"] .discount-price,
.product-slider-box [id^="discounted_price_"] {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    line-height: 1 !important;
    text-align: inherit !important;
    align-self: auto !important;
    white-space: nowrap !important;
}
.product-slider-box .priceRight {
    margin-left: auto !important;       /* belt-and-braces — still pushes right */
    flex: 0 0 auto;                     /* don't grow, don't shrink */
    align-self: center;                 /* vertically center against the 2-line price stack */
}

/* Add / Pre-order / Notify-me buttons — compact, matched-size with stepper */
.product-slider-box .priceRight {
    margin-left: auto !important;
}
.product-slider-box .btn-pink,
.product-slider-box .btn-dark-green,
.product-slider-box .openCartActionBtn {
    background: var(--rd-green) !important;
    color: var(--rd-text-inv) !important;
    border: none !important;
    border-radius: var(--rd-radius-pill) !important;
    padding: 0 12px !important;
    font-size: 11px !important; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase;
    line-height: 1;
    min-width: 0;
    width: 72px;
    height: 32px;
    box-shadow: 0 3px 8px rgba(31,61,46,0.22);
    transition: background 0.2s var(--rd-easing), box-shadow 0.2s var(--rd-easing);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
}
.product-slider-box .btn-pink:hover,
.product-slider-box .btn-dark-green:hover,
.product-slider-box .openCartActionBtn:hover {
    background: var(--rd-green-2) !important;
    box-shadow: 0 5px 12px rgba(31,61,46,0.30);
}
.product-slider-box .btnNotifyMe {
    background: var(--rd-cream-2) !important;
    color: var(--rd-ink) !important;
    border-radius: var(--rd-radius-pill) !important;
    padding: 6px 12px !important;
    font-size: 10px !important; font-weight: 700;
    border: 1px solid var(--rd-border);
    line-height: 1.2;
}
.product-slider-box .btnNotForSale {
    background: var(--rd-cream-2) !important;
    color: var(--rd-muted) !important;
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-pill) !important;
    padding: 6px 10px !important;
    font-size: 9px !important; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    line-height: 1.2;
}

/* +/- quantity stepper when item is in cart — matches ADD button size */
.product-slider-box .cartIncrementBox {
    display: inline-block;
    flex-shrink: 0;
}
.product-slider-box .cartIncrementBox .increament_box {
    display: inline-flex; align-items: center; justify-content: space-between;
    background: var(--rd-green) !important;
    border-radius: var(--rd-radius-pill) !important;
    padding: 0 4px;
    gap: 2px;
    width: 72px;
    height: 32px;
    box-shadow: 0 3px 8px rgba(31,61,46,0.22);
    box-sizing: border-box;
    flex-shrink: 0;
}
.product-slider-box .cartIncrementBox .increament_box.green_box {
    background: var(--rd-orange) !important;
}
.product-slider-box .cartIncrementBox .increament_box i {
    color: var(--rd-text-inv) !important;
    background: rgba(255,255,255,0.16);
    width: 20px; height: 20px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px; cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s var(--rd-easing);
}
.product-slider-box .cartIncrementBox .increament_box i:hover {
    background: rgba(255,255,255,0.3);
}
.product-slider-box .cartIncrementBox .increament_box input {
    background: transparent !important;
    border: none !important; outline: none !important;
    color: var(--rd-text-inv) !important;
    text-align: center;
    width: 22px;
    font-size: 12px; font-weight: 700;
    padding: 0 !important; height: auto !important;
    line-height: 1;
    flex-shrink: 0;
    min-width: 0;
}
.product-slider-box .cartIncrementBox .increament_box input::-webkit-outer-spin-button,
.product-slider-box .cartIncrementBox .increament_box input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

/* "Bought on X" overlay (recent purchase) */
.product-slider-box > .mt-2 > div[style*="left: 15px !important"][style*="background: grey"] {
    background: rgba(31,61,46,0.85) !important;
    border-radius: var(--rd-radius-pill);
    width: auto !important;
    left: 12px !important; top: 12px !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
}

/* ============================================================
 * Price visibility — strongest possible override.
 *
 * Belt-and-braces against any cascade order issue:
 * - Force display so .hide/.d-none can't suppress
 * - Force visibility/opacity so accidental fade rules don't hide
 * - Drop overflow:hidden on the row+label so nothing gets clipped
 * - Collapse whitespace text nodes via font-size:0 on the label,
 *   then re-assert explicit font sizes on the spans inside.
 * - Explicit non-zero min-height on the label so the flex row
 *   always reserves vertical room for the two-line price.
 * ============================================================ */
.product-slider-box > .mt-2 > .d-flex {
    overflow: visible !important;
}
.product-slider-box > .mt-2 > .d-flex > label.text-grey,
.product-slider-box label.text-grey {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 36px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    font-size: 0 !important;          /* collapse stray whitespace text nodes */
    line-height: 1 !important;
    padding: 0 !important;
}
.product-slider-box label.text-grey > .strike,
.product-slider-box label.text-grey > [id^="package_price_"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
    color: #6b7568 !important;
    text-decoration: line-through;
    white-space: nowrap;
    margin: 0 0 2px 0 !important;
    order: 0;
}
.product-slider-box label.text-grey > .discount-price,
.product-slider-box label.text-grey > [id^="discount_"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 16px !important;
    line-height: 1.1 !important;
    font-weight: 700 !important;
    color: #1a2521 !important;
    white-space: nowrap;
    margin: 0 !important;
    order: 1;
}
/* The INNER number span must inherit and stay inline */
.product-slider-box label.text-grey [id^="discounted_price_"],
.product-slider-box label.text-grey .discount-price .discount-price {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: inherit !important;
    color: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
}
