/*============================================================================================
   Start Top Selling Product
==============================================================================================*/

.top-selling-product .section-head.style-6 {
    margin-bottom: 32px;
}

.tp-product-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/*============================================================================================
   Top Selling image sizing — medium & large screens
   --------------------------------------------------------------------------------------------
   The homepage Top Selling section renders the canonical .product.style-6 card. Its inherited
   image rule (`.product.style-6 .product-media img { width: 100%; height: auto }`) makes the
   image fill the whole card. Inside the 1-column (768-1199px) and 2-column (>=1200px)
   .tp-product-wrapper grid the card is ~600-720px wide, so the image grew to ~592-703px and
   dominated the card. The original GhorerBazar card (index.html .tp-product-card) sized its
   image area at 300px (.tp-product-img), so cap the media box to 300px and centre it. The
   inherited `width: 100%` + `height: auto` keep the aspect ratio (no crop / stretch).
   Scoped to .top-selling-product and >=768px only: the mobile Top Selling layout (<768px)
   and every other card / product section are untouched.
=============================================================================================*/
@media only screen and (min-width: 768px) {
    .top-selling-product .product.style-6 .product-media {
        width: 100%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }
}

.tp-product-card {
    display: flex;
    align-items: center;
    gap: 24px;
    border-radius: 8px;
    position: relative;
    background: #f5f5f5;
}

.tp-product-badge {
    border-radius: 2px 8px;
    background: #ff3f33;
    color: var(--white-color);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 120%;
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 8px;
}

.tp-product-badge i {
    position: relative;
    top: 2px;
}

.tp-product-img {
    display: block;
    width: 300px;
    min-width: 300px;
    overflow: hidden;
    border-radius: 8px;
}

.tp-product-img img {
    border-radius: 8px;
    width: 100%;
    transition: all 0.4s ease;
}

.tp-product-card:hover img {
    transform: scale(1.06);
}

.tp-product-content {
    width: 100%;
    padding: 12px 12px 12px 0px;
}

.tp-product-title {
    color: var(--title-color);
    font-style: normal;
    font-size: 20px;
    font-weight: 600;
    line-height: 130%;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tp-product-price {
    display: inline-grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 6px;
    align-items: center;
}

.tp-product-price .disct-price {
    font-size: 18px;
    font-style: normal;
    font-weight: 700;
    line-height: 150%;
    color: var(--primary-color);
}

.tp-product-price .main-price {
    color: var(--hints-color);
    font-size: 18px;
    font-weight: 500;
    line-height: 120%;
    text-decoration-line: line-through;
}

.tp-product-price .save-price {
    border-radius: 99px;
    background: #bfdb38;
    font-size: 12px;
    font-weight: 600;
    line-height: 120%;
    color: var(--title-color);
    padding: 4px 8px;
    text-align: center;
}

.tp-product-action {
    margin-top: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-product-action .theme-btn {
    padding: 12px 16px;
    color: var(--white-color);
    font-size: 14px;
    font-weight: 600;
    line-height: 120%;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-color);
    border-radius: 6px;
    transition: all 0.3s ease;
    height: 40px;
}

.tp-product-action .theme-btn i {
    position: relative;
    top: 2px;
}

.tp-product-action .theme-btn:hover {
    background: var(--secondary-color);
}

.tp-product-action .open-quantity-btn.stock-out,
.tp-product-action .theme-btn.stock-out {
    border: 1px solid var(--alert-color) !important;
    color: var(--alert-color);
    background: transparent;
    cursor: no-drop;
    box-sizing: border-box;
}

.tp-product-action .open-quantity-btn.stock-out:hover,
.tp-product-action .theme-btn.stock-out:hover {
    border-color: var(--alert-color) !important;
    color: var(--alert-color);
    background: transparent;
}

.tp-product-action .theme-btn.secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.tp-product-action .theme-btn.secondary:hover {
    background: var(--primary-color);
    color: var(--white-color);
}

.product-section-button {
    text-align: center;
    margin-top: 24px;
}

.product-section-button .btn {
    margin: auto;
    text-transform: capitalize;
}

.top-selling-product .quantity-container {
    position: relative;
    display: inline-block;
    width: auto;
}

.top-selling-product .open-quantity-btn {
    font-family: var(--font-family);
    border: 1px solid var(--primary-color) !important;
    color: var(--primary-color);
    width: 100%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
    transition: all 0.4s ease;
    opacity: 1;
    visibility: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 16px;
    background: transparent;
    height: 40px;
    line-height: 120%;
}

.top-selling-product .open-quantity-btn:hover {
    background: var(--primary-color);
    color: var(--white-color);
    border: 1px solid transparent;
}

.top-selling-product .open-quantity-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.top-selling-product .open-quantity-btn i {
    position: relative;
    top: 1px;
}

.top-selling-product .quantity-box {
    display: flex;
    align-items: center;
    background-color: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 4px 0;
    gap: 10px;
    transition: all 0.4s ease;
    height: 40px;
    opacity: 1;
    visibility: visible;
    width: 100%;
    justify-content: space-between;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

.top-selling-product .quantity-box.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.top-selling-product .decrease-btn,
.top-selling-product .increase-btn {
    border: none;
    font-size: 16px;
    color: var(--white-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: var(--primary-color);
}

.top-selling-product .decrease-btn {
    border-radius: 4px 0px 0px 4px;
}

.top-selling-product .increase-btn {
    border-radius: 0px 4px 4px 0px;
}

.top-selling-product .decrease-btn:hover,
.top-selling-product .increase-btn:hover {
    background-color: var(--secondary-color);
    color: var(--white-color);
}

.top-selling-product .quantity {
    color: var(--title-color);
    font-size: 14px;
    font-weight: 700;
    line-height: 110%;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    text-align: center;
    min-width: 20px;
    transition: all 0.2s ease;
}

@media only screen and (min-width: 576px) {
    .tp-product-wrapper {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media only screen and (min-width: 576px) and (max-width: 767px) {
    .top-selling-product .product.style-6 .product-name {
        height: auto;
        min-height: 34px;
    }
}

@media only screen and (max-width: 767px) {
    .top-selling-product .section-head.style-6 {
        margin-bottom: 16px;
    }
    .tp-product-wrapper {
        gap: 12px;
    }
    .tp-product-card {
        gap: 0;
        flex-wrap: wrap;
    }
    .tp-product-badge {
        font-weight: 600;
    }
    .tp-product-img {
        width: 100%;
        min-width: 100%;
    }
    .tp-product-title {
        font-size: 14px;
        line-height: 120%;
    }
    .tp-product-action {
        margin-top: 12px;
        flex-wrap: wrap;
    }
    .tp-product-price .save-price {
        font-size: 12px;
        padding: 4px;
        text-align: center;
    }
    .tp-product-action .theme-btn {
        padding: 8px;
        font-size: 12px;
    }
    .tp-product-content {
        padding: 12px;
    }
    .tp-product-price {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .tp-product-price .disct-price,
    .tp-product-price .main-price {
        font-size: 14px;
    }
    .tp-product-price .save-price {
        font-size: 10px;
        padding: 2px 4px;
    }
    .tp-product-action .theme-btn i {
        font-size: 14px;
        display: block;
        top: 0;
    }
    .tp-product-action .theme-btn {
        padding: 0;
        width: 100%;
        height: 30px;
        text-align: center;
        justify-content: center;
    }
    .product-section-button .btn {
        padding: 8px 16px;
    }
    .d-sm-none {
        display: none !important;
    }
    .top-selling-product .open-quantity-btn {
        font-size: 12px;
        padding: 4px 16px;
        height: 30px;
    }
    .top-selling-product .quantity-container {
        width: 100%;
    }
    .top-selling-product .quantity-box {
        height: 30px;
    }
}

/*============================================================================================
   Category / Subcategory product cards — Add to Cart + Buy Now
   --------------------------------------------------------------------------------------------
   Category and subcategory listings reuse the .tp-product-card / .tp-product-action markup,
   but inside the 4-column .product-wrapper.category-product-all grid. The horizontal
   top-selling card (300px min-width image) does not fit that grid, so the action row is
   squeezed and the "Add To Cart" / "Buy now" labels wrap onto two lines / overflow.
   Stack the card vertically and keep both buttons at their natural (content) width inside a
   single non-wrapping action line - exactly like the homepage Top Selling card - so the
   labels stay on one line and never stretch or overflow the card. Scoped to
   .category-product-all so the homepage Top Selling section is not affected.
==============================================================================================*/
@media only screen and (min-width: 768px) {
    .category-product-all .tp-product-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .category-product-all .tp-product-img {
        width: 100%;
        min-width: 0;
    }

    .category-product-all .tp-product-content {
        padding: 12px;
    }

    .category-product-all .tp-product-action {
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 8px;
        margin-top: 12px;
    }

    .category-product-all .tp-product-action .quantity-container {
        flex: 0 0 auto;
        width: auto;
    }

    .category-product-all .tp-product-action .open-quantity-btn,
    .category-product-all .tp-product-action .theme-btn {
        white-space: nowrap;
    }

    .category-product-all .tp-product-action .theme-btn {
        flex: 0 0 auto;
    }
}

/*============================================================================================
   Homepage slider sections — canonical cards, Add to Cart + Buy Now stacked (R4.9)
   --------------------------------------------------------------------------------------------
   The honey / dates / cooking-essentials / organic / just-for-you homepage sections now render
   with the canonical storefront card (.tp-product-card). Inside a Swiper slide a card is only
   ~170-250px wide, so the horizontal top-selling layout (300px min-width image) would overflow.
   Force these cards vertical and let the action row wrap so "Add To Cart" and "Buy now" stack
   full-width at every screen size. Scoped to the slider / just-for-you card wrappers so the
   homepage Top Selling and category grids are untouched.
==============================================================================================*/
.swiper-wrapper.top-selling-product .tp-product-card,
.recommended_product_section.top-selling-product .tp-product-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.swiper-wrapper.top-selling-product .tp-product-img,
.recommended_product_section.top-selling-product .tp-product-img {
    width: 100%;
    min-width: 0;
}

.swiper-wrapper.top-selling-product .tp-product-content,
.recommended_product_section.top-selling-product .tp-product-content {
    padding: 12px;
}

.swiper-wrapper.top-selling-product .tp-product-action,
.recommended_product_section.top-selling-product .tp-product-action {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
}

.swiper-wrapper.top-selling-product .quantity-container,
.recommended_product_section.top-selling-product .quantity-container {
    width: 100%;
}

.swiper-wrapper.top-selling-product .tp-product-action .open-quantity-btn,
.swiper-wrapper.top-selling-product .tp-product-action .theme-btn,
.recommended_product_section.top-selling-product .tp-product-action .open-quantity-btn,
.recommended_product_section.top-selling-product .tp-product-action .theme-btn {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    padding: 0;
    height: 32px;
    font-size: 12px;
}

.swiper-wrapper.top-selling-product .tp-product-action .theme-btn i,
.recommended_product_section.top-selling-product .tp-product-action .theme-btn i {
    top: 0;
}

/*============================================================================================
   Homepage slider sections — Buy Now label + icon on one line, centred (R4.11)
   --------------------------------------------------------------------------------------------
   The honey / dates / cooking-essentials / organic / just-for-you sections render the canonical
   Buy Now anchor (.theme-btn.primary.buyNow-btn) inside the scoped wrappers below. The R4.9 rule
   above gives it width:100% with `padding: 0`, so the cart icon and the "Buy now" label sit flush
   against the left edge and the icon/label pair is only as safe as the current font metrics.
   Keep the label and icon on a single line, vertically centred and horizontally centred inside
   the card, with comfortable horizontal padding that never overflows the (border-box) button.
   Scoped to .buyNow-btn inside these five wrappers only, so Add to Cart, the homepage Top Selling
   card and the category / subcategory grids are untouched. Colour, font, radius, icon, href and
   click behaviour are inherited unchanged.
=============================================================================================*/
.swiper-wrapper.top-selling-product .tp-product-action .buyNow-btn,
.recommended_product_section.top-selling-product .tp-product-action .buyNow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    box-sizing: border-box;
}

/*============================================================================================
   Tiny-mobile hardening — Add to Cart + Buy Now labels (R4.10)
   --------------------------------------------------------------------------------------------
   On narrow phones (<=360px) a card column is only ~118-138px wide. The Top Selling / category
   Add to Cart button uses `padding: 4px 16px`, and its icon + "Add To Cart" label needs ~114px,
   leaving only ~4px of headroom at 320px — fragile once a device's real font metrics apply.
   Keep every card label on a single line (no wrap / clip / overflow) by:
     * forcing `white-space: nowrap` on the card action labels (all widths), and
     * trimming the Add to Cart horizontal padding and the icon gap on <=360px screens.
   Desktop/tablet (>=361px) and the slider cards' centred full-width buttons are unchanged.
==============================================================================================*/
.tp-product-card .tp-product-action .open-quantity-btn,
.tp-product-card .tp-product-action .theme-btn {
    white-space: nowrap;
}

@media only screen and (max-width: 360px) {
    .tp-product-card .tp-product-action .open-quantity-btn {
        padding-left: 8px;
        padding-right: 8px;
    }

    .tp-product-card .tp-product-action .open-quantity-btn,
    .tp-product-card .tp-product-action .theme-btn {
        gap: 4px;
    }
}

/*============================================================================================
   End Top Selling Product
==============================================================================================*/