:root{
    --bg:        #F8F9FC;
    --card:      #FFFFFF;
    --primary:   #6C63FF;
    --primary-2: #8B7BFF;
    --accent:    #FF4D6D;
    --text:      #1F2430;
    --muted:     #7A8599;
    --radius:    18px;
    --shadow:    0 6px 24px rgba(31,36,48,.07);
}

*{ font-family:'Vazirmatn', tahoma, sans-serif; }
body{ background:var(--bg); color:var(--text); padding-bottom:90px; }

/* ---------- Header ---------- */
.app-header{
    position:sticky; top:0; z-index:1030;
    background:rgba(255,255,255,.85);
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
    border-bottom:1px solid rgba(31,36,48,.06);
    transition:padding .25s ease;
}
.app-header.scrolled{ box-shadow:0 4px 18px rgba(31,36,48,.08); }
.app-header .btn-icon{
    width:42px; height:42px; border-radius:14px;
    display:grid; place-items:center;
    background:#F1F2F7; color:var(--text);
    border:none; transition:.2s;
}
.app-header .btn-icon:active{ transform:scale(.92); }

/* ---------- Search ---------- */
.search-box{
    display:flex; align-items:center; gap:8px;
    background:#F1F2F7; border-radius:16px;
    padding:10px 14px; transition:.25s;
}
.search-box:focus-within{
    background:#fff;
    box-shadow:0 0 0 2px var(--primary-2);
}
.search-box input{
    border:none; outline:none; background:transparent;
    flex:1; font-size:.9rem;
}
.search-box i{ color:var(--muted); }

/* ---------- Category Chips ---------- */
.chips-row{
    display:flex; gap:8px; overflow-x:auto;
    padding:4px 12px 12px;
    scrollbar-width:none;
    scroll-behavior:smooth;
}
.chips-row::-webkit-scrollbar{ display:none; }
.chip{
    flex:0 0 auto;
    display:inline-flex; align-items:center; gap:6px;
    padding:8px 16px; border-radius:50px;
    background:#fff; border:1.5px solid #E8EAF2;
    font-size:.82rem; color:var(--text);
    cursor:pointer; white-space:nowrap;
    transition:.2s; user-select:none;
}
.chip .count{
    font-size:.7rem; color:var(--muted);
    background:#F1F2F7; border-radius:50px; padding:1px 7px;
}
.chip.active{
    background:linear-gradient(135deg, var(--primary), var(--primary-2));
    color:#fff; border-color:transparent;
    box-shadow:0 6px 16px rgba(108,99,255,.35);
    transform:translateY(-1px);
}
.chip.active .count{ background:rgba(255,255,255,.25); color:#fff; }
.chip:active{ transform:scale(.95); }

/* زیرگروه‌ها */
.subchips-row{
    display:flex; gap:6px; overflow-x:auto;
    padding:0 12px 12px; scrollbar-width:none;
}
.subchips-row::-webkit-scrollbar{ display:none; }
.subchip{
    flex:0 0 auto; padding:6px 14px; border-radius:50px;
    background:rgba(108,99,255,.08); color:var(--primary);
    font-size:.78rem; cursor:pointer; white-space:nowrap;
    border:1px solid rgba(108,99,255,.15); transition:.2s;
}
.subchip.active{
    background:var(--primary); color:#fff;
}

/* ---------- Sort / Info ---------- */
.toolbar{
    display:flex; align-items:center; justify-content:space-between;
    padding:6px 16px 12px;
}
.toolbar .sort-btns{ display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; }
.sort-btn{
    font-size:.76rem; padding:5px 12px; border-radius:50px;
    background:transparent; border:none; color:var(--muted);
    white-space:nowrap; transition:.2s;
}
.sort-btn.active{ background:#EDEBFF; color:var(--primary); font-weight:600; }

/* ---------- Product Cards ---------- */
.product-grid{
    display:grid;
    grid-template-columns:repeat(2, 1fr);
    gap:12px; padding:0 12px;
}
@media (min-width:768px){
    .product-grid{ grid-template-columns:repeat(3, 1fr); }
}
@media (min-width:1200px){
    .product-grid{ grid-template-columns:repeat(4, 1fr); }
}

.product-card{
    background:var(--card); border-radius:var(--radius);
    box-shadow:var(--shadow); overflow:hidden;
    display:flex; flex-direction:column;
    transition:transform .25s ease, box-shadow .25s ease;
    animation:fadeUp .4s ease both;
    cursor:pointer;
}
.product-card:hover{ transform:translateY(-4px); box-shadow:0 12px 30px rgba(31,36,48,.12); }
.product-card:active{ transform:scale(.97); }

@keyframes fadeUp{
    from{ opacity:0; transform:translateY(14px); }
    to  { opacity:1; transform:translateY(0); }
}

.product-img{
    position:relative; aspect-ratio:1/1; overflow:hidden;
    background:#F1F2F7;
}
.product-img img{
    width:100%; height:100%; object-fit:cover;
    transition:transform .4s ease;
}
.product-card:hover .product-img img{ transform:scale(1.06); }

.badge-off{
    position:absolute; top:10px; right:10px;
    background:var(--accent); color:#fff;
    font-size:.68rem; padding:3px 9px; border-radius:50px;
    box-shadow:0 4px 12px rgba(255,77,109,.4);
}
.badge-new{
    position:absolute; top:10px; left:10px;
    background:#00C48C; color:#fff;
    font-size:.66rem; padding:3px 9px; border-radius:50px;
}

.product-body{ padding:12px; display:flex; flex-direction:column; gap:6px; flex:1; }
.product-title{
    font-size:.84rem; font-weight:600; line-height:1.5;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
    overflow:hidden; min-height:2.6em;
}
.product-cat{ font-size:.7rem; color:var(--muted); }
.price-row{ margin-top:auto; display:flex; align-items:center; justify-content:space-between; }
.price{ font-size:.88rem; font-weight:800; }
.price small{ font-size:.68rem; font-weight:400; color:var(--muted); }
.price-old{ font-size:.72rem; color:var(--muted); text-decoration:line-through; }
.add-btn{
    width:34px; height:34px; border-radius:12px; border:none;
    background:linear-gradient(135deg, var(--primary), var(--primary-2));
    color:#fff; display:grid; place-items:center;
    box-shadow:0 4px 12px rgba(108,99,255,.35); transition:.2s;
}
.add-btn:active{ transform:scale(.88); }

/* ---------- Skeleton ---------- */
.skeleton{
    background:linear-gradient(90deg,#F1F2F7 25%,#E8EAF2 50%,#F1F2F7 75%);
    background-size:200% 100%; animation:shimmer 1.2s infinite;
    border-radius:var(--radius); aspect-ratio:3/4.4;
}
@keyframes shimmer{ to{ background-position:-200% 0; } }

/* ---------- Bottom Sheet ---------- */
.sheet-overlay{
    position:fixed; inset:0; z-index:1050;
    background:rgba(15,17,21,.5);
    opacity:0; pointer-events:none; transition:opacity .3s;
}
.sheet-overlay.show{ opacity:1; pointer-events:auto; }

.bottom-sheet{
    position:fixed; left:0; right:0; bottom:0; z-index:1055;
    background:#fff; border-radius:24px 24px 0 0;
    max-height:82vh; display:flex; flex-direction:column;
    transform:translateY(100%); transition:transform .35s cubic-bezier(.32,.72,.25,1);
}
.bottom-sheet.show{ transform:translateY(0); }
.sheet-handle{ width:44px; height:5px; background:#E0E2EC; border-radius:50px; margin:10px auto 4px; }
.sheet-header{
    display:flex; align-items:center; justify-content:space-between;
    padding:10px 18px; border-bottom:1px solid #F1F2F7;
}
.sheet-body{ overflow-y:auto; padding:12px 16px 24px; flex:1; }

.cat-group{ border-radius:16px; overflow:hidden; margin-bottom:8px; background:#FAFBFE; border:1px solid #F1F2F7; }
.cat-group-header{
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 16px; cursor:pointer; transition:.2s; user-select:none;
}
.cat-group-header:active{ background:#F1F2F7; }
.cat-group-header .title{ display:flex; align-items:center; gap:10px; font-size:.9rem; font-weight:600; }
.cat-group-header .title i{ color:var(--primary); font-size:1.1rem; }
.cat-group-header .arrow{ transition:transform .3s; color:var(--muted); }
.cat-group.open .arrow{ transform:rotate(180deg); }

.subcat-list{ max-height:0; overflow:hidden; transition:max-height .35s ease; }
.cat-group.open .subcat-list{ max-height:500px; }
.subcat-item{
    display:flex; justify-content:space-between; align-items:center;
    padding:11px 16px 11px 46px; font-size:.83rem;
    color:var(--muted); cursor:pointer; transition:.2s;
}
.subcat-item:active{ background:#F1F2F7; }
.subcat-item.active{ color:var(--primary); font-weight:600; }
.subcat-item .badge{ background:#EDEBFF; color:var(--primary); font-size:.68rem; }

/* ---------- Floating Filter Button ---------- */
.fab-filter{
    position:fixed; bottom:24px; left:16px; z-index:1040;
    height:52px; padding:0 22px; border:none; border-radius:50px;
    background:linear-gradient(135deg, var(--primary), var(--primary-2));
    color:#fff; font-size:.9rem; font-weight:600;
    display:flex; align-items:center; gap:8px;
    box-shadow:0 10px 26px rgba(108,99,255,.45);
    transition:transform .2s;
}
.fab-filter:active{ transform:scale(.93); }

/* ---------- Empty state ---------- */
.empty-state{ text-align:center; padding:60px 20px; color:var(--muted); }
.empty-state i{ font-size:3rem; color:#D8DBE8; }