/* ============================================================
   HOME PAGE — FULLY RESPONSIVE & FIXED LAYOUT
   ============================================================ */

/* --- Global Overflow Fix --- */
body, html { 
    overflow-x: clip; 
    max-width: 100vw; 
    width: 100%; 
}

/* ============================================================
   MAIN LAYOUT (DESKTOP)
   ============================================================ */
.home-layout {
    display: flex;
    align-items: flex-start; 
    gap: 24px;
    padding-top: 24px;
    padding-bottom: 40px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    overflow: visible !important; 
}

/* ===== LEFT SIDEBAR ===== */
.sidebar-left { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    width: 260px;
    flex-shrink: 0;
    position: -webkit-sticky;
    position: sticky; 
    top: 90px; 
    max-height: calc(100vh - 110px); 
    overflow-y: auto; 
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.sidebar-left::-webkit-scrollbar { display: none; }

.side-nav { list-style: none; padding: 0; margin: 0; background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.side-nav li a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-weight: 600; font-size: 14px; color: var(--ink-2); border-left: 3px solid transparent; text-decoration: none; }
.side-nav li a:hover, .side-nav li a.active { background: var(--primary-soft); color: var(--primary); border-left-color: var(--primary); }
.side-nav li a i { width: 16px; text-align: center; }

.side-section h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
.side-cats { list-style: none; padding: 0; margin: 0; }
.side-cats li a { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--ink-2); border-bottom: 1px solid #f1f5f9; text-decoration: none; }
.side-cats li a:hover { color: var(--primary); }
.side-cats li a i { color: var(--muted); font-size: 14px; width: 16px; }

.side-help { display: flex; align-items: center; gap: 12px; background: #f0f9ff; border: 1px solid #bae6fd; padding: 16px; border-radius: 12px; color: #0369a1; }
.side-help i { font-size: 24px; }
.side-help strong { display: block; font-size: 14px; }
.side-help span { font-size: 12px; opacity: 0.8; }

.side-promo { background: #0f172a; color: #fff; padding: 24px; border-radius: 12px; text-align: center; position: relative; overflow: hidden; }
.side-promo h3 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; z-index: 2; position: relative; }

/* ===== CENTER MAIN CONTENT ===== */
.main-content { 
    display: flex; 
    flex-direction: column; 
    gap: 24px; 
    flex: 1; 
    min-width: 0; 
}

/* FORCE 2 COLUMNS ON DESKTOP HOMEPAGE */
.main-content .product-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
}

.hero-carousel { position: relative; border-radius: 16px; overflow: hidden; height: 320px; width: 100%; background: #e2e8f0; }
.carousel-track { height: 100%; position: relative; }

.carousel-slide { 
    position: absolute; 
    inset: 0; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.5s ease, visibility 0.5s ease; 
    z-index: 1; 
}
.carousel-slide.active { 
    opacity: 1; 
    visibility: visible; 
    z-index: 2; 
}

.slide-inner { height: 100%; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; padding: 24px 40px; gap: 20px; }
.slide-content { min-width: 0; word-wrap: break-word; }
.slide-content h1 { font-size: 32px; line-height: 1.1; margin: 10px 0 12px; font-weight: 800; letter-spacing: -0.5px; }
.slide-content p { font-size: 14px; margin: 0 0 20px; max-width: 320px; line-height: 1.5; }
.slide-image img { max-width: 100%; max-height: 250px; object-fit: contain; border-radius: 12px; }
.slide-logo-img { border-radius: 50%; max-height: 180px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }

/* Carousel Arrows */
.carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.9); border: none;
    display: flex; justify-content: center; align-items: center;
    color: #333; font-size: 12px; cursor: pointer; z-index: 100; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); transition: background 0.2s;
}
.carousel-arrow:hover { background: #fff; color: var(--primary); }
.carousel-arrow.prev { left: 10px; }
.carousel-arrow.next { right: 10px; }

.carousel-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 100; }
.carousel-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(0,0,0,0.2); cursor: pointer; transition: all 0.2s; }
.carousel-dots .dot.active { background: #fff; width: 20px; border-radius: 4px; }

.cat-row-wrap { background: #fff; padding: 16px; border-radius: 16px; border: 1px solid var(--line); overflow: hidden; position: relative; min-height: 110px; width: 100%; max-width: 100%; }
.category-row { display: flex; gap: 16px; width: max-content; animation: scrollCategories 20s linear infinite; }
.category-row:hover { animation-play-state: paused; }
@keyframes scrollCategories {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.3333%); } 
}
.category-card { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 80px; text-decoration: none; transition: transform 0.2s; }
.category-card:hover { transform: scale(1.05); }
.category-card .cat-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--bg); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-size: 22px; border: 1px solid var(--line); }
.category-card .cat-name { font-weight: 600; font-size: 12px; color: var(--ink); text-align: center; }

.dual-banners { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
.dual-banner { position: relative; border-radius: 16px; padding: 24px; display: flex; justify-content: space-between; align-items: center; overflow: hidden; text-decoration: none; transition: transform 0.2s; }
.dual-banner:hover { transform: translateY(-2px); }
.dual-banner h3 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.dual-banner p { margin: 0 0 16px; font-size: 13px; opacity: 0.9; }
.dual-banner .btn { padding: 8px 16px; font-size: 12px; }
.dual-banner i { font-size: 80px; opacity: 0.15; position: absolute; right: 10px; bottom: 10px; transform: rotate(-15deg); }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.countdown { background: #fee2e2; color: #b91c1c; padding: 6px 12px; border-radius: 8px; font-weight: 800; font-size: 16px; letter-spacing: 1px; display: inline-flex; align-items: center; gap: 4px; line-height: 1; }
.countdown small { font-size: 9px; font-weight: 600; letter-spacing: 0; margin-left: 4px; opacity: 0.7; }

/* ===== RIGHT SIDEBAR ===== */
.sidebar-right { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    width: 300px;
    flex-shrink: 0;
    position: -webkit-sticky;
    position: sticky; 
    top: 90px; 
    /* Removed max-height and overflow to let it flow naturally */
}

.static-cart { 
    background: #fff; 
    border: 1px solid var(--line); 
    border-radius: 16px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    /* Removed max-height to prevent flex collapse */
}

.sc-head { 
    display: flex; 
    justify-content: space-between; 
    padding: 16px; 
    border-bottom: 1px solid var(--line); 
    align-items: center; 
    flex-shrink: 0; 
}
.sc-head h3 { margin: 0; font-size: 15px; }

.sc-items { 
    padding: 0 16px; 
    /* Fixed height for the items list so it scrolls internally, keeping footer visible */
    max-height: 350px; 
    overflow-y: auto; 
}

.sc-item { display: grid; grid-template-columns: 50px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; align-items: center; }
.sc-item img { width: 50px; height: 50px; object-fit: contain; background: var(--bg); border-radius: 8px; }
.sc-item-info h5 { margin: 0 0 2px; font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.sc-item-info span { font-size: 12px; font-weight: 700; color: var(--primary); }
.sc-qty { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.sc-qty button { border: none; background: var(--bg); width: 20px; height: 20px; border-radius: 4px; font-weight: bold; cursor: pointer; display: flex; justify-content: center; align-items: center; }

.sc-foot { padding: 16px; background: #f8fafc; border-top: 1px solid var(--line); flex-shrink: 0; }
.sc-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.sc-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 16px; margin: 12px 0; color: var(--ink); }
.w-100 { width: 100%; }

.side-widget { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; flex-shrink: 0; }
.side-widget h4 { margin: 0 0 16px; font-size: 15px; }
.mini-products { display: flex; flex-direction: column; gap: 12px; }
.mini-prod { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.mini-prod img { width: 48px; height: 48px; object-fit: contain; background: var(--bg); border-radius: 8px; }
.mini-prod-info h5 { margin: 0 0 2px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.mini-prod-info span { font-size: 12px; font-weight: 700; color: var(--ink); }

.why-list { display: flex; flex-direction: column; gap: 16px; }
.why-item { display: flex; gap: 12px; align-items: flex-start; }
.why-item i { color: var(--primary); font-size: 18px; margin-top: 2px; }
.why-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.why-item span { font-size: 12px; color: var(--muted); }

/* ===== BOTTOM BANNER ===== */
.bottom-banner { background: #0f172a; border-radius: 16px; padding: 32px; display: flex; justify-content: space-between; align-items: center; color: #fff; position: relative; overflow: hidden; margin-top: 24px; width: 100%; }
.bb-content { z-index: 2; max-width: 500px; }
.bb-content h2 { margin: 0 0 8px; font-size: 24px; font-weight: 800; }
.bb-content p { margin: 0 0 20px; font-size: 14px; color: #cbd5e1; }
.bb-icon i { font-size: 120px; color: rgba(255,255,255,0.05); position: absolute; right: 40px; top: 50%; transform: translateY(-50%); }

/* ============================================================
   MOBILE RESPONSIVE (3-COLUMN GRID WITH STICKY SIDEBARS)
   ============================================================ */
@media (max-width: 992px) {
    .home-layout {
        display: grid !important;
        grid-template-columns: 85px 1fr 115px !important; /* Slightly wider sidebars */
        gap: 6px !important;
        padding: 10px 4px !important;
        align-items: start; 
        width: 100%;
        max-width: 100vw;
    }

    /* --- 1. LEFT SIDEBAR (Column 1) --- */
    .sidebar-left {
        grid-column: 1 / 2;
        width: 100%;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 80px;
        align-self: start;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        gap: 10px;
    }
    /* Restored Icons */
    .side-nav li a { padding: 6px 4px; font-size: 8.5px; gap: 4px; justify-content: flex-start; line-height: 1.1; }
    .side-nav li a i { display: inline-block; font-size: 10px; width: 12px; text-align: center; }
    .side-section h4 { font-size: 8px; text-align: center; margin-bottom: 4px; }
    .side-cats li a { font-size: 8.5px; padding: 4px 0; justify-content: flex-start; gap: 4px; line-height: 1.1; }
    .side-cats li a i { display: inline-block; font-size: 10px; width: 12px; text-align: center; }
    
    .side-help { flex-direction: column; padding: 8px 4px; text-align: center; gap: 4px; }
    .side-help i { font-size: 16px; }
    .side-help strong { font-size: 9px; }
    .side-help span { font-size: 8px; }
    .side-promo { padding: 10px 5px; }
    .side-promo h3 { font-size: 9px; }

    /* --- 2. MAIN CONTENT (Column 2) --- */
    .main-content {
        grid-column: 2 / 3;
        width: 100%;
        min-width: 0;
        gap: 12px;
    }
    
    /* Force 2 columns for products */
    .main-content .product-grid { 
        display: grid !important; 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 5px !important; 
    }
    .product-card { border-radius: 6px; }
    .product-card img { height: 80px !important; padding: 2px; }
    .pc-name { font-size: 9px !important; }
    .pc-price { font-size: 10px !important; }
    .pc-actions { flex-direction: column !important; gap: 2px !important; }
    .pc-actions .btn { padding: 4px 2px !important; font-size: 8px !important; }
    
    /* Restored Carousel Image */
    .hero-carousel { height: 130px; }
    .slide-inner { 
        grid-template-columns: 1fr 45px; /* Text left, small image right */
        padding: 8px; 
        text-align: left; 
        gap: 4px; 
    }
    .slide-content h1 { font-size: 11px !important; margin: 2px 0; line-height: 1.1; }
    .slide-content p { display: none; }
    .slide-content .btn { font-size: 8px; padding: 3px 6px; margin-top: 2px; }
    .slide-image { display: flex; justify-content: center; align-items: center; }
    .slide-image img { max-height: 50px; max-width: 100%; border-radius: 4px; box-shadow: none; }
    .carousel-arrow { display: none; } 
    .carousel-dots { bottom: 4px; }
    .carousel-dots .dot { width: 4px; height: 4px; }
    .carousel-dots .dot.active { width: 8px; }

    .cat-row-wrap { padding: 6px; min-height: 70px; }
    .category-card { min-width: 45px; }
    .category-card .cat-icon { width: 28px; height: 28px; font-size: 12px; }
    .category-card .cat-name { font-size: 8px; }

    .dual-banners { grid-template-columns: 1fr; gap: 6px; }
    .dual-banner { padding: 8px; }
    .dual-banner h3 { font-size: 11px; }
    .dual-banner p { font-size: 8px; }
    .dual-banner .btn { font-size: 8px; padding: 4px 6px; }
    .dual-banner i { display: none; }

    .section-head h2 { font-size: 14px; }
    .section-head p { font-size: 9px; }
    .countdown { font-size: 9px; padding: 3px 4px; }

    /* --- 3. RIGHT SIDEBAR / CART (Column 3) --- */
    .sidebar-right {
        grid-column: 3 / 4;
        width: 100%;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 80px;
        align-self: start;
        /* Let the cart take almost full screen height so it shows items */
        max-height: calc(100vh - 90px); 
        overflow-y: auto;
        gap: 10px;
    }
    
    /* Cart Mobile Fixes - Showing 5 products & scroll */
    .static-cart { 
        max-height: calc(100vh - 100px); 
        display: flex; 
        flex-direction: column;
    }
    .sc-head { padding: 6px; }
    .sc-head h3 { font-size: 9px; }
    .sc-head i { display: none; }
    
    /* Make items area tall enough to show multiple items, but scrollable */
    .sc-items { 
        padding: 0 6px; 
        flex: 1; 
        min-height: 200px; 
        overflow-y: auto;
    }
    
    /* Keep all cart row elements visible */
    .sc-item { 
        grid-template-columns: 30px 1fr 12px; 
        gap: 4px; 
        padding: 8px 0; 
        align-items: center; 
    }
    .sc-item img { width: 30px; height: 30px; border-radius: 4px; }
    .sc-item-info h5 { font-size: 8px; max-width: 100%; white-space: normal; line-height: 1.1; margin-bottom: 2px; }
    .sc-item-info span { font-size: 8px; }
    .sc-qty { gap: 2px; margin-top: 2px; }
    .sc-qty button { width: 14px; height: 14px; font-size: 8px; padding: 0; }
    
    /* Restore Trash Icon */
    .sc-item > i.fa-trash-alt { 
        display: block !important; 
        font-size: 10px !important; 
        color: #cbd5e1; 
    }
    
    /* Checkout button stays fixed at bottom */
    .sc-foot { padding: 6px; flex-shrink: 0; }
    .sc-row { font-size: 7px; margin-bottom: 2px; }
    .sc-total { font-size: 9px; margin: 4px 0; }
    .sc-foot .btn { font-size: 8px; padding: 6px 2px; margin-top: 2px; }

    .side-widget { padding: 8px; }
    .side-widget h4 { font-size: 9px; margin-bottom: 6px; text-align: center; }
    .mini-products { display: none; } 
    .why-list { gap: 6px; }
    .why-item { flex-direction: column; align-items: center; text-align: center; gap: 4px; }
    .why-item i { font-size: 14px; margin: 0; }
    .why-item strong { font-size: 8px; }
    .why-item span { display: none; }
}