/* =========================================================
   NIRVA FRESH - SHARED PRODUCT CATALOGUE LAYOUT
   Used by Personal Care, Snacks, Dairy, Groceries, Vegetables.
   Header/footer/search/nav remain in nirva-fresh-common.css.
========================================================= */

*{box-sizing:border-box}
body{margin:0;font-family:Poppins,sans-serif;background:#f6f8f5;color:#0f172a}
a{text-decoration:none;color:inherit}

/* ==========================================
   MAIN LAYOUT
========================================== */
.nf-shop-shell{
    max-width:1200px;
    margin:22px auto 60px;
    padding:0 18px;
    display:grid;
    grid-template-columns:210px minmax(0,1fr);
    gap:20px;
    align-items:start;
}

/* ==========================================
   SIDEBAR
========================================== */
.nf-shop-filter-toggle{display:none}

.nf-shop-sidebar{
    position:sticky;
    top:150px;
    max-height:calc(100vh - 180px);
    overflow-y:auto;
    background:#fff;
    border:1px solid #e5ebe7;
    border-radius:16px;
    padding:10px;
    box-shadow:0 8px 24px rgba(15,23,42,.045);
    scrollbar-width:thin;
}

.nf-shop-sidebar-title{
    padding:8px 10px 10px;
    font-size:13px;
    font-weight:800;
    color:#0f172a;
}

.nf-shop-sidebar a{
    display:block;
    padding:10px 11px;
    margin:2px 0;
    border-radius:9px;
    font-size:11px;
    font-weight:600;
    color:#475569;
    transition:.15s;
}

.nf-shop-sidebar a:hover{
    background:#f0fdf4;
    color:#166534;
}

.nf-shop-sidebar a.active{
    background:#15803d;
    color:#fff;
}

/* ==========================================
   PRODUCT AREA
========================================== */
.nf-shop-products{min-width:0}

.nf-shop-toolbar{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:14px;
    margin-bottom:18px;
}

.nf-shop-toolbar h2{
    margin:0;
    font-size:22px;
    font-weight:800;
}

.nf-shop-toolbar p{
    margin:4px 0 0;
    color:#64748b;
    font-size:11px;
}

.nf-shop-count{
    color:#64748b;
    font-size:11px;
    white-space:nowrap;
}

/* ==========================================
   RTC-LIKE PRODUCT GRID
========================================== */
.nf-product-grid{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:13px;
}

.nf-product-card{
    background:#fff;
    border:1px solid #e5ebe7;
    border-radius:15px;
    overflow:hidden;
    box-shadow:0 5px 16px rgba(15,23,42,.045);
    transition:.2s;
    display:flex;
    flex-direction:column;
    min-width:0;
}

.nf-product-card:hover{
    transform:translateY(-3px);
    box-shadow:0 12px 28px rgba(15,23,42,.09);
    border-color:#cfe6d4;
}

.nf-product-image{
    height:145px;
    background:linear-gradient(145deg,#f5fbf6,#f8fafc);
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
}

.nf-product-image img{
    width:100%;
    height:100%;
    object-fit:contain;
    padding:11px;
    display:block;
}

.nf-discount-badge{
    position:absolute;
    top:11px;
    left:11px;
    z-index:2;
    background:#fff;
    color:#15803d;
    border-radius:20px;
    padding:5px 8px;
    font-size:9px;
    font-weight:800;
    box-shadow:0 2px 8px rgba(15,23,42,.06);
}

.nf-product-info{
    padding:10px 11px 11px;
    display:flex;
    flex-direction:column;
    flex:1;
}

.nf-product-sub{
    font-size:9px;
    color:#16a34a;
    font-weight:700;
    text-transform:uppercase;
    margin-bottom:5px;
}

.nf-product-name{
    margin:0;
    font-size:13px;
    line-height:1.35;
    min-height:35px;
}

.nf-product-unit{
    margin-top:4px;
    color:#64748b;
    font-size:11px;
}

.nf-product-bottom{
    margin-top:auto;
    padding-top:9px;
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
}

.nf-product-price{
    font-size:16px;
    font-weight:800;
}

.nf-product-mrp{
    font-size:10px;
    color:#94a3b8;
    text-decoration:line-through;
    margin-left:4px;
}

/* ==========================================
   QUANTITY
   Keep legacy hooks for cart_js_common.js
========================================== */
.nf-qty-box{
    display:grid;
    grid-template-columns:34px minmax(38px,1fr) 34px;
    align-items:center;
    border:1px solid #dbe4dc;
    border-radius:9px;
    overflow:hidden;
    background:#fff;
    width:100%;
    min-height:36px;
}

.nf-qty-btn{
    width:34px;
    height:36px;
    border:0;
    background:#f0fdf4;
    color:#15803d;
    font-size:20px;
    font-weight:700;
    line-height:1;
    cursor:pointer;
}

.nf-qty-btn:hover{background:#dcfce7}

.nf-qty-input{
    width:100%;
    height:36px;
    border:0;
    border-left:1px solid #e2e8f0;
    border-right:1px solid #e2e8f0;
    text-align:center;
    font-family:inherit;
    font-size:15px;
    font-weight:700;
    color:#0f172a;
    outline:none;
    background:#fff;
}

.nf-add-button{
    border:0;
    background:#ff7417;
    color:#fff;
    border-radius:9px;
    padding:9px 10px;
    width:100%;
    font-family:inherit;
    font-size:11px;
    font-weight:800;
    cursor:pointer;
    box-shadow:0 4px 10px rgba(249,115,22,.16);
}

.nf-add-button:hover{background:#ea650f}

/* ==========================================
   EMPTY STATE
========================================== */
.nf-empty-products{
    grid-column:1/-1;
    background:#fff;
    border:1px dashed #cbd5e1;
    border-radius:18px;
    padding:48px 20px;
    text-align:center;
    color:#64748b;
}

/* ==========================================
   RESPONSIVE
========================================== */
@media(max-width:1100px){
    .nf-product-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}

@media(max-width:900px){
    .nf-shop-shell{
        grid-template-columns:185px minmax(0,1fr);
        gap:15px;
    }

    .nf-product-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

@media(max-width:768px){
    .nf-shop-shell{
        display:block;
        margin:16px auto 45px;
        padding:0 10px;
    }

    .nf-shop-filter-toggle{
        display:flex;
        align-items:center;
        justify-content:space-between;
        width:100%;
        padding:12px 14px;
        margin:0 0 12px;
        background:#fff;
        border:1px solid #e5ebe7;
        border-radius:10px;
        font-family:inherit;
        font-size:11px;
        font-weight:700;
        color:#334155;
        cursor:pointer;
    }

    .nf-shop-filter-toggle.open i{
        transform:rotate(180deg);
    }

    .nf-shop-sidebar{
        display:none;
        position:static;
        max-height:52vh;
        margin-bottom:14px;
        border-radius:10px;
    }

    .nf-shop-sidebar.mobile-open{
        display:block;
    }

    .nf-shop-toolbar{
        align-items:flex-start;
        margin-bottom:14px;
    }

    .nf-shop-toolbar h2{font-size:18px}
    .nf-shop-toolbar p{font-size:10px}

    .nf-product-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:9px;
    }

    .nf-product-image{height:108px}
    .nf-product-image img{padding:7px}
    .nf-product-info{padding:8px}
    .nf-product-sub{font-size:7.5px}
    .nf-product-name{font-size:10.5px;min-height:29px}
    .nf-product-unit{font-size:9px}
    .nf-product-price{font-size:14px}
    .nf-product-mrp{font-size:8px}

    .nf-qty-box{
        grid-template-columns:30px minmax(30px,1fr) 30px;
        min-height:32px;
    }

    .nf-qty-btn{
        width:30px;
        height:32px;
        font-size:17px;
    }

    .nf-qty-input{
        height:32px;
        font-size:12px;
    }

    .nf-add-button{
        padding:8px 5px;
        font-size:10px;
    }
}

@media(max-width:360px){
    .nf-product-grid{gap:6px}
    .nf-product-image{height:96px}
    .nf-product-info{padding:7px}
}

/* =========================================================
   MOBILE-ONLY STICKY SUBCATEGORY SIDEBAR
   Desktop/laptop rules above remain unchanged.
   ========================================================= */
@media (max-width:768px){
    .nf-shop-shell{
        display:grid;
        grid-template-columns:86px minmax(0,1fr);
        gap:8px;
        align-items:start;
        margin:16px auto 45px;
        padding:0 8px;
    }

    /* No dropdown on mobile: keep categories visible at left. */
    .nf-shop-filter-toggle{
        display:none !important;
    }

    .nf-shop-sidebar,
    .nf-shop-sidebar.mobile-open{
        display:block;
        position:sticky;
        top:154px;
        z-index:5;
        width:86px;
        max-height:calc(100vh - 170px);
        margin:0;
        padding:5px;
        overflow-y:auto;
        overflow-x:hidden;
        background:#fff;
        border:1px solid #e5ebe7;
        border-radius:11px;
        box-shadow:0 4px 14px rgba(15,23,42,.05);
        scrollbar-width:none;
    }
    .nf-shop-sidebar::-webkit-scrollbar{display:none}

    .nf-shop-sidebar-title{
        padding:6px 3px;
        font-size:8.5px;
        line-height:1.2;
        text-align:center;
    }

    .nf-shop-sidebar a{
        display:flex;
        align-items:center;
        justify-content:center;
        min-height:46px;
        margin:2px 0;
        padding:6px 4px;
        border-radius:8px;
        font-size:8.5px;
        font-weight:600;
        line-height:1.25;
        text-align:center;
        white-space:normal;
        overflow-wrap:anywhere;
    }

    .nf-shop-sidebar a.active{
        background:#15803d;
        color:#fff;
        font-weight:700;
    }

    .nf-shop-products{min-width:0}
    .nf-shop-toolbar{margin:1px 0 8px}
    .nf-shop-count{font-size:9px}

    .nf-product-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:6px;
    }
}

@media (max-width:390px){
    .nf-shop-shell{
        grid-template-columns:78px minmax(0,1fr);
        gap:6px;
        padding:0 6px;
    }
    .nf-shop-sidebar,
    .nf-shop-sidebar.mobile-open{
        width:78px;
        padding:4px;
    }
    .nf-shop-sidebar a{
        min-height:44px;
        padding:5px 3px;
        font-size:8px;
    }
}
