/*
 * AlahaDeal Desktop Storefront Carousel V1
 *
 * Mobile <= 767.98px is intentionally untouched.
 * Responsive product counts:
 * 768-991      3 cards
 * 992-1199     4 cards
 * 1200-1439    5 cards
 * >=1440       6 cards
 *
 * Project rule: no custom visible text below 12px.
 */

/* Preserve the existing orange Ships From identity on wider screens. */
.alahadeal-home-category-section .ah-category-ships-from {
    max-width: 100%;
}

/* Tablet: 3 cards. */
@media (min-width: 768px) and (max-width: 991.98px) {
    .alahadeal-home-category-section .ah-category-product-slide {
        width: calc((100% - 40px) / 3) !important;
        min-width: calc((100% - 40px) / 3) !important;
        max-width: calc((100% - 40px) / 3) !important;
    }
}

/* Small desktop: 4 cards. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .alahadeal-home-category-section .ah-category-product-slide {
        width: calc((100% - 60px) / 4) !important;
        min-width: calc((100% - 60px) / 4) !important;
        max-width: calc((100% - 60px) / 4) !important;
    }
}

/* Standard desktop: 5 cards. */
@media (min-width: 1200px) and (max-width: 1439.98px) {
    .alahadeal-home-category-section .ah-category-product-slide {
        width: calc((100% - 80px) / 5) !important;
        min-width: calc((100% - 80px) / 5) !important;
        max-width: calc((100% - 80px) / 5) !important;
    }
}

/* Large desktop: 6 readable cards rather than 7-8 compressed cards. */
@media (min-width: 1440px) {
    .alahadeal-home-category-section .ah-category-product-slide {
        width: calc((100% - 100px) / 6) !important;
        min-width: calc((100% - 100px) / 6) !important;
        max-width: calc((100% - 100px) / 6) !important;
    }
}

@media (min-width: 768px) {
    /* --------------------------------------------------------------
       Section/card shell
       -------------------------------------------------------------- */
    .alahadeal-home-category-section {
        overflow: visible;
    }

    .alahadeal-home-category-section .ah-home-category-card,
    .alahadeal-home-category-section .ah-home-category-card-body,
    .alahadeal-home-category-section .ah-desktop-category-swiper {
        overflow: visible !important;
    }

    .alahadeal-home-category-section .ah-home-category-card {
        border-radius: 15px;
    }

    .alahadeal-home-category-section .ah-home-category-card-body {
        padding: 18px 18px 20px;
    }

    /* --------------------------------------------------------------
       Full category heading on tablet/desktop
       -------------------------------------------------------------- */
    .alahadeal-home-category-section .ah-home-category-heading {
        min-height: 44px;
        margin-bottom: 18px !important;
        align-items: center !important;
    }

    .alahadeal-home-category-section .ah-home-category-heading .styled-title {
        min-width: 0;
        max-width: calc(100% - 120px) !important;
        margin: 0;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        font-size: 20px !important;
        line-height: 1.25;
        font-weight: 700;
    }

    .alahadeal-home-category-section .ah-home-category-heading .btn-link {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        min-height: 36px;
        font-size: 14px !important;
        white-space: nowrap;
    }

    /* --------------------------------------------------------------
       Equal-height carousel track/cards
       -------------------------------------------------------------- */
    .alahadeal-home-category-section .ah-home-category-swiper .swiper {
        overflow: hidden;
    }

    .alahadeal-home-category-section .ah-home-category-swiper .swiper-wrapper {
        align-items: stretch !important;
    }

    .alahadeal-home-category-section .ah-category-product-slide {
        height: auto !important;
    }

    .alahadeal-home-category-section .ah-category-product-card {
        display: flex;
        width: 100%;
        height: 100%;
        min-height: 100%;
        padding: 9px !important;
        border: 1px solid rgba(15, 23, 42, .07);
        border-radius: 13px !important;
        box-shadow: 0 4px 14px rgba(15, 23, 42, .045);
    }

    .alahadeal-home-category-section .ah-category-product-inner {
        width: 100%;
        min-width: 0;
    }

    /* Consistent square image area. */
    .alahadeal-home-category-section .store-product__top {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 4px !important;
        border-radius: 11px !important;
        background: #fff;
    }

    .alahadeal-home-category-section .store-product__top img {
        width: 100%;
        height: 100%;
        padding: 5px;
        object-fit: contain !important;
    }

    /* --------------------------------------------------------------
       Product title: maximum 2 lines
       -------------------------------------------------------------- */
    .alahadeal-home-category-section .ah-category-product-title {
        display: -webkit-box !important;
        width: 100%;
        min-height: 40px;
        max-height: 40px;
        margin: 0;
        overflow: hidden !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        white-space: normal !important;
        text-overflow: initial !important;
        color: var(--title-color);
        font-size: 14px !important;
        font-weight: 700 !important;
        line-height: 1.4;
        text-align: start;
    }

    /* --------------------------------------------------------------
       Price block: reserve equal vertical space on every card
       -------------------------------------------------------------- */
    .alahadeal-home-category-section .ah-category-product-price {
        display: flex !important;
        flex: 0 0 auto;
        align-content: flex-start;
        justify-content: flex-start;
        width: 100%;
        min-height: 39px;
        row-gap: 4px;
        text-align: start;
    }

    .alahadeal-home-category-section .product__old-price {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px !important;
        line-height: 1.25 !important;
    }

    .alahadeal-home-category-section .product__new-price {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 16px !important;
        line-height: 1.25 !important;
    }

    /* Ships From stays aligned toward the bottom across the row. */
    .alahadeal-home-category-section .ah-category-ships-from {
        align-self: flex-start;
        margin-top: auto;
        padding: 5px 9px;
        font-size: 12px !important;
        line-height: 1.2;
        white-space: nowrap;
    }

    .alahadeal-home-category-section .ah-category-ships-from > span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* --------------------------------------------------------------
       Carousel arrows: outside product content, not over first/last card
       -------------------------------------------------------------- */
    .alahadeal-home-category-section .ah-desktop-category-swiper {
        position: relative;
    }

    .alahadeal-home-category-section .ah-desktop-category-swiper .swiper-button-prev,
    .alahadeal-home-category-section .ah-desktop-category-swiper .swiper-button-next {
        display: flex !important;
        width: 38px;
        height: 38px;
        margin-top: -19px;
        border: 1px solid rgba(15, 23, 42, .08);
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 5px 16px rgba(15, 23, 42, .10);
        color: var(--bs-primary);
        z-index: 6;
    }

    .alahadeal-home-category-section .ah-desktop-category-swiper .swiper-button-prev {
        inset-inline-start: -15px !important;
    }

    .alahadeal-home-category-section .ah-desktop-category-swiper .swiper-button-next {
        inset-inline-end: -15px !important;
    }

    .alahadeal-home-category-section .ah-desktop-category-swiper .swiper-button-prev::after,
    .alahadeal-home-category-section .ah-desktop-category-swiper .swiper-button-next::after {
        font-size: 14px !important;
        font-weight: 800;
    }
}

/* --------------------------------------------------------------
   Desktop sticky navigation
   Prevent products/content showing faintly through the sticky header.
   -------------------------------------------------------------- */
@media (min-width: 1200px) {
    .header .love-sticky.sticky,
    .header .header-main.sticky {
        background: #fff !important;
        background-color: #fff !important;
        opacity: 1 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: 0 6px 18px rgba(15, 23, 42, .09) !important;
        border-bottom: 1px solid rgba(15, 23, 42, .06);
    }

    .header .love-sticky.sticky::before,
    .header .header-main.sticky::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: #fff;
        opacity: 1;
    }
}
