/*History page styles*/

    .history-list-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .history-list-card {
        display: flex;
        flex-direction: row;
        background: white;
        border-right: 1px solid var(--border-light);
        border-radius: 10px;
        overflow: hidden;
        text-decoration: none;
        color: inherit;
        transition: box-shadow 0.2s ease, transform 0.2s ease;
        height: 110px; /* Fixed height to keep grids perfectly aligned */
    }

    .history-list-card:hover {
        text-decoration: none;
        color: inherit;
    }

    .history-list-img {
        flex-shrink: 0;
        background: var(--industrial-gray);
        display: flex;
        align-items: center;
        justify-content: center;
        border-right: 1px solid var(--border-light);
    }

    .history-list-img img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* Ensures the whole product is visible without cropping */
    }

    .history-list-info {
        padding: 8px 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1;
        overflow: hidden;
        min-width: 0; /* CRITICAL: Prevents flex-child from blowing past mobile screen width */
    }


    /* ========================================= */
    /* RESPONSIVE DESIGN (Including Mobile Swipe)  */
    /* ========================================= */
    @media (max-width: 1200px) {
        .history-list-grid { grid-template-columns: repeat(2, 1fr); }
    }
    
    @media (max-width: 768px) {
        .history-list-grid { 
            display: flex; /* Switch from grid to flex for horizontal scrolling */
            flex-wrap: nowrap; /* Forces elements into a single line */
            overflow-x: auto; /* Enable swiping */
            scroll-snap-type: x mandatory; /* Smooth snapping to cards */
            -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
            padding-bottom: 12px; /* Breathing room for shadow and scrollbar */
            gap: 5px;
        }
        
        .history-list-card { 
            flex: 0 0 85%; /* NOW TAKES EXACTLY 100% OF THE SCREEN (No right side gap) */
            scroll-snap-align: start;
        }
        
        .history-list-img {
            width: 100px; /* Slightly narrower image area on small screens */
        }
        
        /* Hide the scrollbar for a cleaner app-like look */
        .history-list-grid::-webkit-scrollbar {
            display: none;
        }
        .history-list-grid {
            -ms-overflow-style: none;
            scrollbar-width: none;
        }
    }


/* index page and product display page styles */

:root {
    --primary-blue:#003FC2;
    --bg-white: white;
    --industrial-gray: #f4f6f9;
    --text-dark: black;
    --border-light: #e5e7eb;
}

html{
    scroll-behavior: smooth;
}
body{
    background: #F4F4F4;
    scroll-behavior: smooth;
}
/* --- SKELETON LOADING ANIMATION --- */
@keyframes paicoShimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* Add this to the image container */
.paico-skeleton-bg {
    background: #f6f7f8;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: paicoShimmer 2s infinite linear;
    position: relative;
    overflow: hidden;
}

/* Image fade-in effect */
.paico-img-reveal {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.paico-img-reveal.loaded {
    opacity: 1;
}
/* SECTION */
.home-container{
    width: 95vw;
    margin: 0 auto;
    background: #F4F4F4;
}
.infinite-scroll-section {
    margin-bottom: 20px;
    padding:0 0 0 0;
    border-radius: 10px;
}

/* Container holding the two sections */
.both-section1 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0; /* Adds space between Popular and Latest sections */
    width: 100%;
}

/* Ensure the flex children don't overflow the container */
.both-section1 > .infinite-scroll-section {
    flex: 1; /* Takes up 50% width each */
    min-width: 0; /* Critical: allows inner content to scroll */
}

/* Convert the grid inside both-section1 into a horizontal slider */
.both-section1 .infinite-product-grid {
    display: flex !important; /* Overrides the default grid */
    flex-wrap: nowrap;
    overflow-x: auto; /* Enables horizontal scrolling */
    gap: 5px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile devices */
    border-radius: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

/* Give the cards a fixed width so they NEVER squish */
.both-section1 .infinite-product-card {
    flex: 0 0 auto; /* Prevents shrinking */
}

/* Custom minimal scrollbar for a clean look */
.both-section1 .infinite-product-grid::-webkit-scrollbar {
    height: 6px;
}
.both-section1 .infinite-product-grid::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 10px;
}
.both-section1 .infinite-product-grid::-webkit-scrollbar-thumb {
    background: #a1a1aa;
    border-radius: 10px;
}
.both-section1 .infinite-product-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

/* --- SCROLL BUTTONS & WRAPPER --- */
.scroll-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center; /* Centers buttons vertically */
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    color: var(--primary-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.scroll-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    
    /* When hovered, the button lifts up, so the shadow drops even further and diffuses */
    box-shadow: 0px 25px 20px -5px rgba(0, 0, 0, 0.1),
                0px 55px 40px -10px rgba(0, 63, 194, 0.25);
}

.scroll-btn.hidden-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Prevents clicking while invisible */
}

/* Position them slightly outside the grid so they don't cover the products */
.left-btn {
    left: 1px; 
}

.right-btn {
    right: 1px;
}
/*ends*/

.section-header{
    padding:0 0 5px 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.section-header-options-right{
    font-size: 30px !important;
    display: flex;
    flex-direction:row;
    gap: 20px;
    justify-content:space-between;
    align-items:center;
}
.material-symbols-outlined {
    vertical-align: middle;
}
.view-all-link{
    color:var(--primary-blue);
    font-size:17px;
    text-decoration:none;
    font-weight:650;
}
.view-all-link:hover{
    text-decoration:none;
}
.section-title {
    font-size: 2rem;
    font-weight: 800;
}

.section-subtitle{
    font-size: 16px;
    font-weight: 600;
}
.intro-section{
    background: white;
    border-radius: 10px;
}
/* GRID */
.infinite-product-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr); /* Maximum 6 columns */
    gap: 5px;
}

/* CARD */
.infinite-product-card {
    background: white;
    /*border: 1px solid var(--border-light);*/
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom:10px;
    padding:0;
    width:200px;
    height: max-content;
}


/* IMAGE */
.related-image {
    width: 100%;
    background: var(--bg-white) !important;
    display: flex;
    flex-shrink:0;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 10px;
}


.related-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.related-image img:hover{
    transform: scale(1.08);
}

/* BEST SELLER BADGE */
.badge-best {
    position: absolute;
    top: 12px;
    left: 12px;
    background:var(--primary-blue);
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 10px;
    z-index: 2;
}

/* INFO */
.infinite-product-info {
    padding: 4px 0 2px 5px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.infinite-product-title {
    font-size: 13px;
    font-weight: 500;
}

.short-description {
    font-size: 12px;
    color: #475569;
    font-weight: 580;
}

.infinite-current-price {
    font-size: 20px;
    font-weight: 600;
    color: #F85606;
    font-weight:700;
}

.infinite-old-price {
    font-size: 1rem;
    color: red;
    margin-left: 8px;
}

.stock-indicator {
    font-size: 12px;
    font-weight: 600;
}

.stock-available { color: green; }
.stock-low { color: red; }

.end-space{
    margin-bottom:100px;
}

/* Centers the content on the entire viewport */
    .title-container {
        margin-top:15px;
        margin-bottom:5px;
    }

/* Large screen: 6 */
@media (max-width: 1400px) {
    .infinite-product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Laptop */
@media (max-width: 1200px) {
    .infinite-product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet */
@media (max-width: 992px) {
    .infinite-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile */
@media (max-width: 1024px) {
    .home-container{
        width: 100vw;
    }
    .infinite-product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .infinite-product-card {
        width:auto;
    }
    /* --- NEW ADDITION FOR BOTH-SECTION1 ON MOBILE --- */
    .both-section1 {
        flex-direction: column; /* Stacks sections one under the other */
        gap: 0;
    }
    .both-section1 > .infinite-scroll-section {
        width: 100%; /* Take full width on mobile */
    }
    .both-section1 .infinite-product-card {
        width: 160px; /* Slightly smaller card width for mobile horizontal scrolling */
    }
    
    .intro-section{
        display:none;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .infinite-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /*.scroll-btn {
        display: none;
    }*/
}