/**
 * Mini cart (offcanvas) and header cart badges.
 */

/*
 * The header badges were invisible: .bg-unread points at --green-text-color
 * and .cart-badge at --primary-zero-color, neither of which the theme ever
 * defines, so both rendered white text on a transparent background.
 */

.cart .btn,
.bottom-nav .nav-items {
    position: relative;
}

.cart .badge.bg-unread,
.bottom-nav .cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    bottom: auto;
    /* Stays inside the button box: on mobile the cart sits flush against the
       container edge, and any overhang widens the document. */
    transform: translateY(-20%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: content-box;
    border: 2px solid #fff;
    border-radius: 999px;
    background-color: #136532;
    color: #fff;
    font-family: var(--hebd-font-body);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
}

.bottom-nav .cart-badge {
    top: -2px;
    right: 50%;
    transform: translate(140%, 0);
    border-color: #fff;
}

/* An empty cart shows no badge at all. */
.cart .badge.bg-unread.is-empty,
.bottom-nav .cart-badge.is-empty,
.cart .badge.bg-unread:has(.hebd-cart-count.is-empty),
.bottom-nav .cart-badge:has(.hebd-cart-count.is-empty) {
    display: none;
}

.hebd-cart-count {
    display: block;
    line-height: 1;
}

/* ------------------------------------------------------------------ */
/* Offcanvas shell                                                     */
/* ------------------------------------------------------------------ */

#cartOffCanvas {
    --hebd-green: #136532;
    --hebd-green-soft: #2e8b57;
    --hebd-ink: #1c2b21;
    --hebd-muted: #6b7c71;
    --hebd-line: #e2e8e4;

    width: 400px;
    max-width: 100%;
}

#cartOffCanvas .offcanvas-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--hebd-line);
}

#cartOffCanvas .widget_shopping_cart_content {
    height: 100%;
}

.hebd-mini-cart {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    font-family: var(--hebd-font-body);
}

.hebd-mini-cart.is-busy {
    pointer-events: none;
}

.hebd-mini-cart.is-busy::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .6);
    z-index: 4;
}

/* ------------------------------------------------------------------ */
/* Line items                                                          */
/* ------------------------------------------------------------------ */

.hebd-mini-cart__list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    overflow-y: auto;
    flex: 1 1 auto;
}

.hebd-mini-cart__item {
    display: grid;
    grid-template-columns: 68px 1fr 24px;
    gap: 12px;
    align-items: start;
    padding: 14px 20px;
    border-bottom: 1px solid var(--hebd-line);
    position: relative;
}

.hebd-mini-cart__item:last-child {
    border-bottom: 0;
}

.hebd-mini-cart__thumb {
    width: 68px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: #f7f9f8;
    flex: 0 0 auto;
}

.hebd-mini-cart__thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    margin: 0 !important;
    float: none !important;
}

.hebd-mini-cart__details {
    min-width: 0;
}

.hebd-mini-cart__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
}

.hebd-mini-cart__name a {
    color: var(--hebd-ink);
    text-decoration: none;
}

.hebd-mini-cart__name a:hover {
    color: var(--hebd-green);
}

.hebd-mini-cart__item .variation {
    margin: 0 0 6px;
    font-size: 12px;
    color: var(--hebd-muted);
}

.hebd-mini-cart__item .variation dt,
.hebd-mini-cart__item .variation dd {
    display: inline;
    margin: 0;
    font-weight: 400;
}

.hebd-mini-cart__item .variation dd::after {
    content: "";
    display: block;
}

.hebd-mini-cart__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.hebd-mini-cart__price {
    font-size: 14px;
    font-weight: 700;
    color: var(--hebd-green);
    white-space: nowrap;
}

.hebd-mini-cart__price del {
    color: var(--hebd-muted);
    font-weight: 500;
    margin-right: 4px;
}

.hebd-mini-cart__price ins {
    text-decoration: none;
}

/* Quantity stepper */

.hebd-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--hebd-line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.hebd-qty__btn {
    width: 28px;
    height: 30px;
    border: 0;
    background: #fff;
    color: var(--hebd-ink);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.hebd-qty__btn:hover {
    background: #eef5f0;
    color: var(--hebd-green);
}

.hebd-qty__input {
    width: 38px;
    height: 30px;
    border: 0;
    border-left: 1px solid var(--hebd-line);
    border-right: 1px solid var(--hebd-line);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--hebd-ink);
    background: #fff;
    -moz-appearance: textfield;
}

.hebd-qty__input::-webkit-outer-spin-button,
.hebd-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hebd-qty__input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(19, 101, 50, .15);
}

/* Remove button */

.hebd-mini-cart__item .hebd-mini-cart__remove.remove_from_cart_button {
    position: static;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    color: var(--hebd-muted);
    background: #f3f6f4;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.hebd-mini-cart__item .hebd-mini-cart__remove.remove_from_cart_button:hover {
    background: #f6dedd;
    color: #a3312b;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.hebd-mini-cart__footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--hebd-line);
    padding: 16px 20px 20px;
    background: #fff;
}

.hebd-mini-cart__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 14px;
    font-size: 15px;
    color: var(--hebd-muted);
}

.hebd-mini-cart__total strong {
    font-weight: 600;
    color: var(--hebd-ink);
}

.hebd-mini-cart__total .amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--hebd-green);
}

.hebd-mini-cart__buttons {
    display: flex;
    gap: 10px;
    margin: 0;
}

.hebd-cart-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.hebd-cart-btn--primary,
.hebd-cart-btn--primary:focus {
    background: var(--hebd-green, #136532);
    color: #fff;
}

.hebd-cart-btn--primary:hover {
    background: #0e4d26;
    color: #fff;
}

.hebd-cart-btn--ghost {
    background: #fff;
    color: var(--hebd-muted, #6b7c71);
    border-color: var(--hebd-line, #e2e8e4);
}

.hebd-cart-btn--ghost:hover {
    color: var(--hebd-green, #136532);
    border-color: var(--hebd-green-soft, #2e8b57);
    background: #eef5f0;
}

/* ------------------------------------------------------------------ */
/* Empty state                                                         */
/* ------------------------------------------------------------------ */

.hebd-mini-cart--empty {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    gap: 4px;
}

.hebd-mini-cart--empty .empty-message {
    margin: 16px 0 20px;
    font-size: 16px;
    font-weight: 700;
    color: var(--hebd-ink, #1c2b21);
}

.hebd-mini-cart--empty .hebd-cart-btn {
    flex: 0 0 auto;
    min-width: 200px;
}

/* ------------------------------------------------------------------ */
/* Add-to-cart feedback on the product form                            */
/* ------------------------------------------------------------------ */

.hebd-cart-message {
    display: none;
    flex-basis: 100%;
    margin-top: 10px;
    font-size: 13px;
    color: var(--hebd-green, #136532);
}

.hebd-cart-message.is-visible {
    display: block;
}

.hebd-cart-message.is-error {
    color: #a3312b;
}

form.cart .single_add_to_cart_button.loading {
    opacity: .65;
    cursor: progress;
}

@media (max-width: 575.98px) {
    #cartOffCanvas {
        width: 100%;
    }

    .hebd-mini-cart__item {
        grid-template-columns: 56px 1fr 24px;
        padding: 12px 16px;
    }

    .hebd-mini-cart__thumb {
        width: 56px;
        height: 56px;
    }

    .hebd-mini-cart__footer {
        padding: 14px 16px 18px;
    }
}

/* ------------------------------------------------------------------ */
/* Overrides for WooCommerce's product_list_widget styling             */
/*                                                                     */
/* Core adds clearfix ::before/::after to every cart_list li. On a grid */
/* container those count as grid items and push the real content one    */
/* cell along, so they have to be switched off here.                    */
/* ------------------------------------------------------------------ */

#cartOffCanvas .hebd-mini-cart__list.cart_list li.hebd-mini-cart__item::before,
#cartOffCanvas .hebd-mini-cart__list.cart_list li.hebd-mini-cart__item::after {
    content: none;
    display: none;
}

#cartOffCanvas .hebd-mini-cart__list.cart_list,
#cartOffCanvas .hebd-mini-cart__list.product_list_widget {
    margin: 0;
    padding: 8px 0;
}

#cartOffCanvas .hebd-mini-cart__list.cart_list li.hebd-mini-cart__item {
    padding: 14px 20px;
    margin: 0;
}

#cartOffCanvas .hebd-mini-cart__list.cart_list li.hebd-mini-cart__item img {
    float: none;
    margin: 0;
    width: 100%;
    height: 100%;
    box-shadow: none;
}

#cartOffCanvas .widget_shopping_cart .cart_list li a.remove,
#cartOffCanvas .hebd-mini-cart__list.cart_list li a.remove {
    position: static;
    top: auto;
    left: auto;
}

#cartOffCanvas .hebd-mini-cart__item .variation::before,
#cartOffCanvas .hebd-mini-cart__item .variation::after {
    content: none;
    display: none;
}

/* WooCommerce styles a.button with its own palette; these win it back. */

#cartOffCanvas .hebd-mini-cart__buttons a.hebd-cart-btn,
#cartOffCanvas .hebd-mini-cart--empty a.hebd-cart-btn {
    font-family: var(--hebd-font-body);
    line-height: 1.2;
}

#cartOffCanvas .hebd-mini-cart__buttons a.hebd-cart-btn--primary,
#cartOffCanvas .hebd-mini-cart--empty a.hebd-cart-btn--primary,
#cartOffCanvas a.hebd-cart-btn--primary:focus {
    background-color: #136532;
    color: #fff;
}

#cartOffCanvas .hebd-mini-cart__buttons a.hebd-cart-btn--primary:hover,
#cartOffCanvas .hebd-mini-cart--empty a.hebd-cart-btn--primary:hover {
    background-color: #0e4d26;
    color: #fff;
}

#cartOffCanvas .hebd-mini-cart__buttons a.hebd-cart-btn--ghost {
    background-color: #fff;
    color: #6b7c71;
    border-color: #e2e8e4;
}

#cartOffCanvas .hebd-mini-cart__buttons a.hebd-cart-btn--ghost:hover {
    background-color: #eef5f0;
    color: #136532;
    border-color: #2e8b57;
}

/* ------------------------------------------------------------------ */
/* Add-to-cart button state on the single product page                 */
/* ------------------------------------------------------------------ */

/* WooCommerce injects this link after a successful add. It lands inside the
   theme's inline quantity/button row and pushes Buy Now out of line. */
form.cart a.added_to_cart,
.woocommerce form.cart a.added_to_cart.wc-forward {
    display: none !important;
}

/* Core marks the button .added and hangs a tick on it through its icon font. */
form.cart .single_add_to_cart_button.added::after,
.woocommerce form.cart .single_add_to_cart_button.added::after {
    content: none !important;
    display: none !important;
}

form.cart .single_add_to_cart_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: background-color .18s ease;
}

/*
 * Quantity + Add to cart + Buy Now is wider than a tablet column, which pushed
 * the page a few pixels sideways at 768. The row wraps instead.
 */
@media (max-width: 991.98px) {

    form.cart,
    form.cart .woocommerce-variation-add-to-cart {
        flex-wrap: wrap;
        gap: 10px;
    }
}

form.cart .single_add_to_cart_button .hebd-in-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

form.cart .single_add_to_cart_button.is-added {
    background-color: #2e8b57;
}

form.cart .single_add_to_cart_button.is-added::before {
    content: "✓";
    font-size: 14px;
    line-height: 1;
}

/* The theme lays the quantity box and both buttons out in one flex row. With
   the button text kept on a single line that row cannot fit a phone, so let it
   wrap rather than push the page wider. */
@media (max-width: 575.98px) {

    form.cart,
    form.cart .woocommerce-variation-add-to-cart {
        flex-wrap: wrap;
        gap: 8px;
    }

    form.cart .single_add_to_cart_button {
        flex: 1 1 auto;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    form.cart .quantity-wrapper {
        flex: 0 0 auto;
        margin-right: 0 !important;
    }
}

/* ------------------------------------------------------------------ */
/* Product card: variation picker + add to cart                        */
/* ------------------------------------------------------------------ */

.hebd-card-buy {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 0 10px 4px;
    /* Lets the title/price row decide from the card's own width whether it has
       room to sit side by side, independent of the viewport. */
    container: hebd-card / inline-size;
}

/* ---- Title + price row ---- */

.hebd-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
}

.hebd-card-head .product-title {
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0;
    font-family: var(--hebd-font-body);
    font-size: 15px;
    font-weight: 500;
    /* Generous enough that Bengali vowel signs above and below the line are not
       cut off by the line clamp. */
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--hebd-text);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    /* Reserve three lines so cards with short and long titles stay aligned. */
    min-height: calc(3em * 1.5);
    overflow-wrap: anywhere;
}

.hebd-card-head .product-title a {
    color: inherit;
    text-decoration: none;
    transition: color .16s ease;
}

.hebd-card-head .product-title a:hover {
    color: var(--hebd-primary);
}

/* ---- Price ---- */

.hebd-card-head .price {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 0;
    padding: 5px 10px;
    border: 1px solid rgba(46, 112, 70, .20);
    border-radius: 10px;
    background: rgba(53, 162, 75, .06);
    font-family: var(--hebd-font-body);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.01em;
    color: var(--hebd-primary-dark);
    white-space: nowrap;
    text-align: right;
}

/* Regular price sits small and struck through above the current price. */
.hebd-card-head .price del {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--hebd-text-muted);
    text-decoration: line-through;
    opacity: 1;
}

.hebd-card-head .price ins {
    text-decoration: none;
    background: none;
}

/* WooCommerce appends screen-reader copy to price markup; keep it off the layout. */
.hebd-card-head .price .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* A variable product's price range ("৳500 – ৳1,000") is too wide to share the
   row with the title: stack it and keep the range on one line. */
.hebd-card-head:has(.price > .amount ~ .amount) {
    flex-direction: column;
    gap: 8px;
}

.hebd-card-head .price:has(> .amount ~ .amount) {
    align-self: flex-start;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
}

/* Too narrow for side by side: stack, price under the title. */
@container hebd-card (max-width: 250px) {
    .hebd-card-head {
        flex-direction: column;
        gap: 8px;
    }

    .hebd-card-head .price {
        align-self: flex-start;
        flex-direction: row;
        align-items: baseline;
        gap: 6px;
    }
}

/* Two cards side by side on a small phone: a sale price may not fit on one
   line, so the old and new prices wrap instead of spilling out of the card. */
@container hebd-card (max-width: 140px) {
    .hebd-card-head .price {
        flex-wrap: wrap;
        column-gap: 5px;
        row-gap: 0;
        max-width: 100%;
        white-space: normal;
    }

    .hebd-card-head .price del,
    .hebd-card-head .price ins {
        white-space: nowrap;
    }
}

.hebd-card-variation {
    width: 100%;
    padding: 8px 30px 8px 12px;
    /* Brand green, so the picker reads as something to click. */
    border: 1px solid var(--hebd-primary, #2E7046);
    border-radius: 6px;
    background-color: #fff;
    color: #1c2b21;
    font-family: var(--hebd-font-body);
    font-size: 13px;
    line-height: 1.3;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    /* Chevron, so the control keeps a consistent look across browsers. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7c71' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.hebd-card-variation:hover {
    border-color: var(--hebd-primary-dark, #1E5A34);
}

.hebd-card-variation:focus-visible {
    outline: none;
    border-color: var(--hebd-primary-dark, #1E5A34);
    box-shadow: 0 0 0 3px rgba(46, 112, 70, .22);
}

.hebd-card-variation option:disabled {
    color: #a5b1aa;
}

/* The theme pins .card-btn to a fixed 150px; inside a card it should fill it. */
.hebd-card-buy .card-btn.hebd-card-add,
.hebd-card-buy .card-btn.hebd-card-view,
.hebd-card-buy .simple-btn {
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .18s ease, opacity .18s ease;
}

/* Add to Cart and View Cart share the slot, one shown at a time. The theme's
   .card-btn is display: block !important, which beats the browser's [hidden],
   so hiding has to be stated here. */
.hebd-card-buy .card-btn[hidden] {
    display: none !important;
}

/* The theme slides an eye icon over .card-btn on hover, from when a card's
   button only linked to the product. These buttons buy, so the label has to
   stay readable. */
.hebd-card-buy .card-btn::before,
.hebd-card-buy .card-btn::after {
    content: none !important;
    display: none !important;
}

.hebd-card-buy .card-btn.hebd-card-view {
    background: #2e8b57;
}

.hebd-card-buy .card-btn.hebd-card-view:hover,
.hebd-card-buy .card-btn.hebd-card-view:focus-visible {
    background: var(--secondery-color);
    color: #fff;
}

.hebd-card-buy .card-btn.hebd-card-add.loading {
    opacity: .65;
    cursor: progress;
}

@media (max-width: 575.98px) {
    .hebd-card-buy {
        padding: 0 6px 4px;
        gap: 8px;
    }

    .hebd-card-head .product-title {
        font-size: 14px;
    }

    .hebd-card-head .price {
        font-size: 16px;
        padding: 4px 8px;
    }

    .hebd-card-variation {
        font-size: 12px;
        padding: 7px 26px 7px 10px;
    }

    .hebd-card-buy .card-btn.hebd-card-add,
    .hebd-card-buy .card-btn.hebd-card-view,
    .hebd-card-buy .simple-btn {
        font-size: 12px;
        padding: 10px 8px !important;
    }
}

/* Equal-height carousel cards with the buy controls pinned to the bottom, so
   the dropdown and button line up across cards with different title lengths. */
.slider-products .swiper-slide {
    height: auto;
}

.slider-products .swiper-slide > .card {
    height: 100%;
}

/* Title/price sit right under the image; the controls take the leftover
   height so buttons line up along the bottom of every card. */
.hebd-product-card .hebd-card-buy {
    flex: 1 1 auto;
    padding: 14px 2px 2px;
}

.hebd-product-card .hebd-card-head {
    margin-bottom: auto;
}
