/* Mobile grid improvements — compact 2-col product grid, horizontal scroll sections */

/* 2-line name clamp for compact product cards */
.product-item h3.h6 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

/* Tighter card info block on mobile */
@media (max-width: 575px) {
    .product-item .text-center.py-4 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    .product-item .px-3 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    .product-item .mt-3 {
        margin-top: 0.5rem !important;
    }
    /* Tighter gap between product grid cards */
    #products-grid > [class*="col-"],
    #featured-products-container > [class*="col-"],
    #recent-products-container > [class*="col-"] {
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* Horizontal scroll product rows on homepage (mobile + tablet) */
@media (max-width: 767px) {
    .product-scroll-container {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        /* hide scrollbar but keep functionality */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .product-scroll-container::-webkit-scrollbar {
        display: none;
    }
    .product-scroll-container > [class*="col-"] {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}

/* Category icon grid — clamp long names */
.cat-item small.cat-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Store badge must not run under the wishlist heart (top-right 34px circle) */
.product-item .card-badge-stack {
    max-width: calc(100% - 50px);
}
.product-item .card-store-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sticky mobile filter bar — add padding at bottom of grid so bar doesn't cover last row */
@media (max-width: 991px) {
    #products-grid {
        padding-bottom: 72px;
    }
}

/* Colored section headers */
.section-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2F8F61;
    padding: 8px 14px;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.section-header-bar span {
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}
.section-header-bar a {
    color: rgba(255,255,255,0.9);
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
}
.section-header-bar a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Homepage hero — fit content on phones so the heading isn't clipped.
   Inline height:430px + Bootstrap's absolute .carousel-caption made the
   centered text overflow the top edge on narrow screens. On mobile we let
   the slide grow to its content and shrink the display heading. */
@media (max-width: 767px) {
    #header-carousel .carousel-item {
        height: auto !important;
        min-height: 320px;
    }
    #header-carousel .carousel-caption {
        position: absolute;
        padding: 2rem 1rem;
    }
    #header-carousel .carousel-caption .display-4 {
        font-size: 1.85rem;
    }
    #header-carousel .carousel-caption p {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        font-size: 0.95rem;
    }
    #header-carousel .carousel-caption > div { max-width: 100% !important; }
    #header-carousel .carousel-caption > div {
        width: 100%;
        min-width: 0;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    #header-carousel .carousel-caption .display-4 {
        max-width: 100%;
        white-space: normal !important;
        overflow-wrap: anywhere;
        line-height: 1.12;
    }
    #header-carousel .carousel-caption .btn { margin-bottom: 2.25rem; }
    #header-carousel .hero-live-badge { bottom: 12px; left: 12px; }
}
