/* ==========================================================================
   PC46 — منوی دسته‌بندی محصولات
   دسکتاپ: مگامنو با هاور  |  موبایل: پنل تمام‌صفحه با ناوبری لایه‌ای
   ========================================================================== */

/* ---------------------------- دسکتاپ ---------------------------- */
.nav-row .wrap{position:relative;display:flex;align-items:center;gap:10px}
.nav-row nav.main{flex:1;min-width:0}
.mega-item{flex:none}
.mega-item + nav.main{padding-inline-start:10px;border-inline-start:1px solid rgba(255,255,255,.14)}

.mega-trigger{display:inline-flex;align-items:center;gap:9px;height:40px;padding:0 14px;border:0;border-radius:12px;cursor:pointer;font:inherit;font-size:12.5px;font-weight:700;color:#fff;background:var(--grad);box-shadow:0 6px 18px rgba(37,99,235,.35);transition:box-shadow .2s,transform .2s,filter .2s}
.mega-trigger .ic{width:18px;height:18px}
.mega-trigger:hover,.mega-item.is-open .mega-trigger{box-shadow:0 10px 26px rgba(37,99,235,.55);filter:brightness(1.07)}
.mega-trigger:active{transform:scale(.98)}
.mega-trigger:focus-visible{outline:2px solid #fff;outline-offset:2px}
.mega-caret{width:15px!important;height:15px!important;opacity:.85;transition:transform .25s}
.mega-item.is-open .mega-caret{transform:rotate(180deg)}

/* پرده‌ی تیره زیر هدر (فقط وقتی منو باز است) */
.mega-backdrop{position:fixed;left:0;right:0;bottom:0;top:var(--hh,110px);z-index:1;background:rgba(8,15,43,.5);backdrop-filter:blur(2px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s,visibility .2s}
.mega-item.is-open .mega-backdrop{opacity:1;visibility:visible}

.mega-panel{position:absolute;z-index:2;top:100%;inset-inline:clamp(16px,4vw,48px);margin-top:6px;background:#fff;color:var(--tx);border:1px solid var(--line-2);border-radius:20px;box-shadow:0 30px 80px rgba(8,15,43,.32);opacity:0;visibility:hidden;transform:translateY(10px);transition:opacity .2s ease,transform .2s ease,visibility .2s}
/* پل نامرئی تا با حرکت ماوس از دکمه به پنل، منو نبندد */
.mega-panel::before{content:"";position:absolute;inset-inline:0;top:-24px;height:24px}
.mega-item.is-open .mega-panel{opacity:1;visibility:visible;transform:none}
html:not(.js) .mega-item:hover .mega-panel,html:not(.js) .mega-item:focus-within .mega-panel{opacity:1;visibility:visible;transform:none}

.mega-inner{display:grid;grid-template-columns:276px minmax(0,1fr);height:min(640px,calc(100vh - var(--hh,120px) - 28px));min-height:300px;border-radius:20px;overflow:hidden}

/* ستون راست: دسته‌های اصلی */
.mega-roots{list-style:none;margin:0;padding:12px;display:flex;flex-direction:column;gap:2px;overflow-y:auto;background:var(--bg-2);border-inline-end:1px solid var(--line);scrollbar-width:thin}
.mega-root{display:flex;align-items:center;gap:11px;padding:9px 10px;border-radius:12px;color:var(--tx-2);font-size:12.5px;font-weight:600;white-space:normal;transition:background .15s,color .15s,box-shadow .15s}
.mega-root .ico{display:grid;place-items:center;width:34px;height:34px;flex:none;border-radius:10px;background:rgba(59,130,246,.12);color:var(--blue-3);transition:background .15s,color .15s}
.mega-root .ico .ic{width:19px;height:19px}
.mega-root .nm{flex:1;min-width:0;line-height:1.5}
.mega-root .chev{width:15px;height:15px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;opacity:.35;transition:transform .2s,opacity .2s}
.mega-root:hover,.mega-root.is-active,.mega-root:focus-visible{background:#fff;color:var(--tx);box-shadow:0 4px 14px rgba(15,23,42,.08);outline:0}
.mega-root.is-active .ico{background:var(--grad);color:#fff}
.mega-root.is-active .chev{opacity:.9;transform:translateX(-3px)}
.mega-roots-foot{margin-top:auto;padding-top:8px}
.mega-root-all{padding:11px 12px;color:var(--blue-3);font-weight:700;border:1px dashed rgba(37,99,235,.35)}
.mega-root-all:hover{background:#fff;color:var(--blue-3)}

/* ستون چپ: زیرمجموعه‌ها */
.mega-stage{padding:22px 28px 26px;overflow-y:auto;min-width:0;scrollbar-width:thin}
.mega-sub{display:none}
.mega-sub.is-active{display:block;animation:megaIn .22s ease}
@keyframes megaIn{from{opacity:0;transform:translateX(12px)}to{opacity:1;transform:none}}
.mega-sub-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:20px;padding-bottom:14px;border-bottom:1px solid var(--line)}
.mega-sub-head h3{margin:0;font-size:16px;font-weight:800;color:var(--tx)}
.mega-all{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:10px;background:rgba(59,130,246,.1);color:var(--blue-3);font-size:12px;font-weight:700;white-space:nowrap;transition:background .2s,color .2s}
.mega-all .ic{width:15px;height:15px}
.mega-all:hover{background:var(--blue-3);color:#fff}
.mega-all-solid{background:var(--grad);color:#fff;padding:10px 20px}

.mega-cols{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:24px 30px}
.mega-col-title{display:block;padding-bottom:9px;margin-bottom:8px;border-bottom:1px solid var(--line);font-size:13px;font-weight:700;color:var(--tx);transition:color .15s,border-color .15s}
.mega-col-title:hover{color:var(--blue-3);border-color:rgba(37,99,235,.4)}
.mega-col ul{list-style:none;margin:0;padding:0}
.mega-col li a{display:block;padding:5px 0;font-size:12px;color:var(--tx-3);transition:color .15s,transform .15s}
.mega-col li a:hover{color:var(--blue-3);transform:translateX(-4px)}
.mega-col li a.mega-more{color:var(--blue-3);font-weight:600}

.mega-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;min-height:220px;text-align:center;color:var(--tx-3);font-size:13px}
.mega-empty .ic{width:56px;height:56px;padding:13px;border-radius:16px;background:rgba(59,130,246,.12);color:var(--blue-3)}
.mega-empty p{margin:0}

/* ---------------------------- موبایل ---------------------------- */
.m-search-row{display:flex;gap:8px}
.m-search-row .m-search-btn{flex:1;width:auto;min-width:0}
.m-cat-btn{flex:none;display:flex;align-items:center;gap:7px;height:44px;padding:0 13px;border:0;border-radius:14px;cursor:pointer;font:inherit;font-size:12px;font-weight:700;color:#fff;background:var(--grad);box-shadow:0 6px 16px rgba(37,99,235,.4);transition:transform .15s}
.m-cat-btn:active{transform:scale(.96)}
.m-cat-btn .ic{width:19px;height:19px}
@media(max-width:350px){.m-cat-btn span{display:none}.m-cat-btn{padding:0 12px}}

/* کارت «دسته‌بندی محصولات» بالای منوی همبرگری */
#drawer .drawer-cat{display:flex;align-items:center;gap:12px;width:100%;margin:0 0 10px;padding:12px 14px;border:1px solid rgba(255,255,255,.16);border-radius:16px;cursor:pointer;font:inherit;text-align:start;color:#fff;background:linear-gradient(135deg,rgba(37,99,235,.6),rgba(111,88,216,.55))}
#drawer .drawer-cat:active{transform:scale(.99)}
#drawer .drawer-cat .ico{display:grid;place-items:center;width:42px;height:42px;flex:none;border-radius:12px;background:rgba(255,255,255,.16)}
#drawer .drawer-cat .tx{flex:1;min-width:0}
#drawer .drawer-cat b{display:block;font-size:14px;font-weight:800}
#drawer .drawer-cat small{display:block;margin-top:2px;font-size:11px;color:#d4dcf5}
#drawer .drawer-cat .chev{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;opacity:.8}

.mcat{position:fixed;inset:0;z-index:120;display:flex;flex-direction:column;background:#f6f8fd;opacity:0;transform:translateY(18px);transition:opacity .22s ease,transform .22s ease}
.mcat[hidden]{display:none}
.mcat.is-open{opacity:1;transform:none}

.mcat-head{display:flex;align-items:center;gap:6px;padding:max(10px,env(safe-area-inset-top)) 12px 10px;background:#fff;border-bottom:1px solid var(--line);box-shadow:0 4px 18px rgba(15,23,42,.05)}
.mcat-btn{display:grid;place-items:center;flex:none;width:42px;height:42px;border:0;border-radius:13px;cursor:pointer;color:var(--tx);background:var(--bg-2)}
.mcat-btn:active{background:var(--bg-3)}
.mcat-btn .ic{width:20px;height:20px}
.mcat-back[hidden]{display:grid;visibility:hidden}
.mcat-title{flex:1;min-width:0;margin:0;text-align:center;font-size:14.5px;font-weight:800;color:var(--tx);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.mcat-body{position:relative;flex:1;overflow:hidden}
.mcat-view{position:absolute;inset:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:14px 14px calc(28px + env(safe-area-inset-bottom));visibility:hidden;opacity:0;transform:translateX(-26px);transition:transform .26s cubic-bezier(.3,.8,.3,1),opacity .2s,visibility .26s}
.mcat-view.is-behind{transform:translateX(26px)}
.mcat-view.is-current{visibility:visible;opacity:1;transform:none}

.mcat-all{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px;margin-bottom:12px;border-radius:16px;color:#fff;font-size:13px;font-weight:700;background:var(--grad);box-shadow:0 8px 22px rgba(37,99,235,.28)}
.mcat-all .ic{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.mcat-all:active{filter:brightness(.95)}

.mcat-list{list-style:none;margin:0;padding:4px 6px;background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 4px 16px rgba(15,23,42,.04)}
.mcat-list li + li{border-top:1px solid var(--line)}
.mcat-row{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:8px 6px;border:0;border-radius:12px;cursor:pointer;font:inherit;font-size:13.5px;font-weight:600;text-align:start;color:var(--tx);background:none;-webkit-tap-highlight-color:transparent}
.mcat-row:active{background:var(--bg-2)}
.mcat-row .ico{display:grid;place-items:center;width:40px;height:40px;flex:none;border-radius:12px;background:rgba(59,130,246,.12);color:var(--blue-3)}
.mcat-row .ico .ic{width:21px;height:21px}
.mcat-row .nm{flex:1;min-width:0;line-height:1.6}
.mcat-row .chev{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--tx-3);opacity:.7}

@media(min-width:900px){.mcat{display:none!important}}

/* محصولات داخل مگامنو */
.mega-prods-title{margin:26px 0 12px;font-size:12.5px;font-weight:800;color:var(--tx)}
.mega-cols + .mega-prods-title{padding-top:18px;border-top:1px solid var(--line)}
.mega-sub-head + .mega-prods-title{margin-top:0}
.mega-prods{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.mega-prod{display:flex;flex-direction:column;gap:8px;padding:10px;border:1px solid var(--line);border-radius:14px;background:#fff;color:var(--tx);transition:box-shadow .2s,border-color .2s,transform .2s}
.mega-prod:hover{border-color:rgba(37,99,235,.4);box-shadow:0 10px 26px rgba(15,23,42,.1);transform:translateY(-2px)}
.mega-prod .pic{display:grid;place-items:center;aspect-ratio:4/3;border-radius:10px;background:var(--bg-2);overflow:hidden}
.mega-prod .pic img{width:100%;height:100%;object-fit:contain}
.mega-prod .pic .ic{width:34px;height:34px;color:var(--blue-3);opacity:.6}
.mega-prod .nm{font-size:12px;font-weight:600;line-height:1.7;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.mega-prod .pr{font-size:11px;color:var(--tx-3)}
.mega-prod .pr b{font-size:13px;color:var(--blue-3);font-weight:800}
