/* Mobile Horizontal Product Scrolling - Custom Implementation
   Only for index.php homepage product sections (Popular & Featured)
   No Bootstrap Grid - Pure CSS Responsive Design
   ========================================================== */

/* Base Container Styles */
.product-scroll-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 10px 5px 20px 5px;
}

/* Hide scrollbar for clean UI */
.product-scroll-container::-webkit-scrollbar {
    display: none;
}

.product-scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Product Item Wrapper */
.product-scroll-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* Mobile: Show 1 full + 0.5 product (max-width: 568px) */
@media (max-width: 568px) {
    .product-scroll-item {
        width: calc(100% - 50% / 1.5);
    }
}

/* Tablet: Show 2 full + 0.5 product (569px - 991px) */
@media (min-width: 569px) and (max-width: 991px) {
    .product-scroll-item {
        width: calc((100% - 30px) / 2 - 10% / 2);
    }
}

/* Desktop Small: Show 3 full + 0.5 product (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .product-scroll-item {
        width: calc((100% - 45px) / 3 - 16.666% / 2);
        /* 3 full + half */
    }
}

/* Desktop Large: Show all 4 products, no scroll (≥1200px) */
@media (min-width: 1200px) {
    .product-scroll-container {
        overflow-x: visible;
        /* Disable scroll */
        flex-wrap: wrap;
        justify-content: center;
    }

    .product-scroll-item {
        width: calc((100% - 45px) / 4);
        /* 4 equal products */
        max-width: 280px;
    }
}

/* Product Card Styling */
.product-scroll-item .product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
    height: 100%;
    width: 100%;
    transform: translateY(0px);
    transition: all 0.4s ease;
}

.product-scroll-item .product-card:hover {
    transform: translateY(-5px);
}

/* Product Image */
.product-scroll-item .product-image {
    height: 220px;
    background: var(--light-green, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .product-scroll-item .product-image {
        height: 200px;
    }
}

.product-scroll-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s;
}

/* Image hover effect */
.product-scroll-item .product-image .product-main-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    z-index: 1;
}

.product-scroll-item .product-image .product-hover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 2;
}

.product-scroll-item .product-card:hover .product-main-img {
    opacity: 0;
}

.product-scroll-item .product-card:hover .product-hover-img {
    opacity: 1;
}

/* Product Badge */
.product-scroll-item .product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e1ffbe;
    color: #005360;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 3;
}

/* Product Info */
.product-scroll-item .product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-scroll-item .product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark, #333);
    margin-bottom: 8px;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .product-scroll-item .product-name {
        font-size: 0.8rem;
    }
}

.product-scroll-item .product-info .text-muted {
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* Product Price */
.product-scroll-item .product-price {
    font-weight: 700;
    color: var(--primary-green, #0b5b63);
    margin-bottom: 12px;
}

.product-scroll-item .price-old {
    color: #6c757d !important;
    text-decoration: line-through;
    font-size: 0.9rem;
    margin-left: 5px;
}

/* Add to Cart Button */
.product-scroll-item .add-to-cart-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    border-radius: 8px;
    font-weight: 600;
}

/* Disable hover transform on mobile for better touch */
@media (max-width: 768px) {
    .product-scroll-item .product-card:hover {
        transform: none;
    }
}