/* فونت وزیریمتن (لوکال) */
@font-face{font-family:'Vazirmatn';font-weight:400;src:url('../fonts/Vazirmatn-400.woff2') format('woff2');}
@font-face{font-family:'Vazirmatn';font-weight:500;src:url('../fonts/Vazirmatn-500.woff2') format('woff2');}
@font-face{font-family:'Vazirmatn';font-weight:700;src:url('../fonts/Vazirmatn-700.woff2') format('woff2');}
@font-face{font-family:'Vazirmatn';font-weight:900;src:url('../fonts/Vazirmatn-900.woff2') format('woff2');}

/* متغیرهای رنگ — حالت روشن */
:root{
  --bg:#f1f5f9; --surface:#ffffff; --surface-2:#f8fafc; --border:#e2e8f0;
  --text:#0f172a; --text-muted:#64748b;
  --primary:#4F46E5; --primary-soft:#eef2ff; --on-primary:#ffffff;
  --success:#16a34a; --success-soft:#f0fdf4;
  --warning:#d97706; --warning-soft:#fffbeb;
  --danger:#dc2626; --danger-soft:#fef2f2;
  --footer:#0f172a; --footer-text:#94a3b8;
  --radius-btn:10px; --radius-card:12px; --radius-modal:16px;
  --shadow:0 1px 2px rgba(15,23,42,.04),0 4px 12px rgba(15,23,42,.05);
  --overlay:rgba(2,6,23,.5);
}
/* پالت اولیه از تنظیمات در صورت نیاز روی body اعمال می‌شود */

/* متغیرهای رنگ — حالت تاریک (html.dark) */
html.dark{
  --bg:#0b1220; --surface:#111a2e; --surface-2:#0f172a; --border:#1e293b;
  --text:#e2e8f0; --text-muted:#94a3b8;
  --primary:#818cf8; --primary-soft:#1e2948; --on-primary:#0b1220;
  --success:#4ade80; --success-soft:#052e16;
  --warning:#fbbf24; --warning-soft:#3a2a02;
  --danger:#f87171; --danger-soft:#3a0d0d;
  --fg:#0b1220;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.5);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{min-height:100%}
body{font-family:'Vazirmatn',sans-serif;background:var(--bg);color:var(--text);font-size:14px;line-height:1.7;transition:background .2s,color .2s}
/* فوتر چسبان: محتوای کوتاه، فوتر را به انتهای صفحه می‌قدر برساند */
body{min-height:100vh;display:flex;flex-direction:column}
main.wrap,.content{flex:1 0 auto}
.shell{flex:1 0 auto;display:flex}
footer{flex-shrink:0}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font-family:inherit;color:inherit}

/* نوار پیام مدیر */
.announce{background:var(--primary);color:#fff;text-align:center;padding:9px 16px;font-size:13.5px}
.announce b{font-weight:700}
.announce a{text-decoration:underline;opacity:.9}

/* سربرگ */
.header{position:sticky;top:0;z-index:60;background:var(--surface);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:16px;padding:0 22px;min-height:64px;flex-wrap:wrap}
.logo{width:40px;height:40px;border-radius:10px;background:var(--primary);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.logo svg{width:22px;height:22px;stroke:var(--on-primary);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.brand{display:flex;flex-direction:column;line-height:1.25}
.brand b{font-size:16px;font-weight:900}
.brand small{font-size:11.5px;color:var(--text-muted)}
.spacer{flex:1}

/* تب‌ها / منوی عمومی */
.pubnav{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.pubnav a,.tabs a{display:inline-flex;align-items:center;gap:7px;padding:10px 14px;border-radius:10px 10px 0 0;color:var(--text-muted);font-size:14px;font-weight:500;border-bottom:3px solid transparent;cursor:pointer;transition:.15s}
.pubnav a svg,.tabs a svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.pubnav a:hover,.tabs a:hover{color:var(--primary)}
.pubnav a.active,.tabs a.active{background:var(--primary-soft);color:var(--primary);border-bottom-color:var(--primary);font-weight:700}

/* دکمه‌ها */
.btn{display:inline-flex;align-items:center;gap:6px;border:none;border-radius:var(--radius-btn);padding:10px 16px;font-size:14px;font-weight:500;cursor:pointer;transition:.15s;vertical-align:middle}
.btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.btn-primary{background:var(--primary);color:var(--on-primary)}
.btn-primary:hover{opacity:.9}
.btn-outline{background:transparent;border:1px solid var(--border);color:var(--text)}
.btn-outline:hover{border-color:var(--primary);color:var(--primary)}
.btn-danger{background:var(--danger);color:#fff}
.btn-danger:hover{opacity:.9}
.btn-ghost{background:transparent;color:var(--text-muted)}
.btn-ghost:hover{color:var(--primary)}
.btn-sm{padding:7px 12px;font-size:13px}
.btn-sm svg{width:15px;height:15px}
.icon-btn{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--text-muted);cursor:pointer;transition:.15s}
.icon-btn:hover{color:var(--primary);border-color:var(--primary)}
.icon-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}

/* کانتینر */
.wrap{max-width:1220px;margin:0 auto;padding:22px}
.page-title{font-size:20px;font-weight:900;margin:2px 0 4px}
.muted{color:var(--text-muted)}

/* کارت‌ها */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-card);box-shadow:var(--shadow)}
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin:16px 0}
.stat{padding:16px;display:flex;align-items:center;gap:12px}
.stat .ic{width:44px;height:44px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.stat .ic svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.stat b{font-size:20px;font-weight:900;display:block}
.stat small{color:var(--text-muted);font-size:12.5px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
.gridcat{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.hero{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-card);padding:26px;display:flex;justify-content:space-between;align-items:center;gap:20px;flex-wrap:wrap}
.hero h1{margin:0 0 6px;font-size:22px;font-weight:900}
.hero p{margin:0;color:var(--text-muted)}
.hero .tools{display:flex;gap:10px;flex-wrap:wrap}

/* نوار آیتم محصول */
.vcard{overflow:hidden;display:flex;flex-direction:column}
.vcard .img{height:150px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;border-bottom:1px solid var(--border)}
.vcard .img svg{width:44px;height:44px;stroke:var(--text-muted);opacity:.5;fill:none;stroke-width:1.3}
.vcard .img img{width:100%;height:100%;object-fit:cover}
.vcard .body{padding:14px;display:flex;flex-direction:column;gap:8px;flex:1}
.vcard .title{font-weight:700;font-size:14.5px}
.vcard .meta{font-size:12.5px;color:var(--text-muted)}
.vcard .price{font-weight:900;color:var(--primary);font-size:15px}
.vcard .actions{display:flex;gap:8px;margin-top:auto}

/* نوار ابزار و جدول */
.toolbar{display:flex;gap:10px;align-items:center;padding:14px 16px;border-bottom:1px solid var(--border);flex-wrap:wrap}
.search{position:relative;flex:1;min-width:160px}
.search svg{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;stroke:var(--text-muted);fill:none;stroke-width:1.8}
.search input{width:100%;border:1px solid var(--border);border-radius:var(--radius-btn);background:var(--surface-2);color:var(--text);padding:9px 38px 9px 12px;font-size:13.5px}
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th,td{padding:12px 14px;text-align:center;border-bottom:1px solid var(--border);vertical-align:middle}
thead th{color:var(--text-muted);font-weight:500;background:var(--surface-2);font-size:12.5px}
tbody tr:hover{background:var(--surface-2)}
.row-num{color:var(--text-muted);font-weight:500;max-width:40px}
.tcell{text-align:right;font-weight:500;min-width:180px}
.tag{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap}
.tag-success{background:var(--success-soft);color:var(--success)}
.tag-warning{background:var(--warning-soft);color:var(--warning)}
.tag-danger{background:var(--danger-soft);color:var(--danger)}
.tag-primary{background:var(--primary-soft);color:var(--primary)}

/* فرم‌ها */
.input,.select,.textarea{width:100%;border:1px solid var(--border);border-radius:var(--radius-btn);background:var(--surface-2);color:var(--text);padding:11px 13px;font-size:14px}
.input:focus,.select:focus,.textarea:focus{outline:2px solid var(--primary);outline-offset:-1px;border-color:transparent}
.field{margin-bottom:14px}
.field label{display:block;font-size:13px;font-weight:600;margin-bottom:6px}
.field label .req{color:var(--danger)}
.field .hint{font-size:12px;color:var(--text-muted);margin-top:4px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 16px}

/* مودال */
.overlay{position:fixed;inset:0;background:var(--overlay);backdrop-filter:blur(3px);display:none;align-items:center;justify-content:center;z-index:120;padding:16px}
.overlay.show{display:flex}
.modal{width:min(540px,96%);background:var(--surface);border-radius:var(--radius-modal);box-shadow:0 20px 50px rgba(0,0,0,.3);overflow:hidden;max-height:92vh;display:flex;flex-direction:column}
.modal-head{padding:16px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center}
.modal-head b{font-size:15px;font-weight:700}
.modal-head .close{margin-right:auto}
.modal-body{padding:20px;overflow-y:auto}
.modal-foot{padding:14px 20px;border-top:1px solid var(--border);display:flex;gap:10px;justify-content:flex-start}

/* حالت خالی */
.empty{text-align:center;padding:44px 16px;color:var(--text-muted)}
.empty svg{width:52px;height:52px;stroke:var(--border);fill:none;stroke-width:1.3;margin-bottom:10px}
.empty b{display:block;font-size:15px;color:var(--text)}
.empty small{font-size:13px}

/* آیکون داخل جعبهٔ ثبت‌نام / ورود */
/* تصویر محصول (حالت بدون تصویر: کارت تمیز و کوچک به‌جای باکس سیاه بزرگ) */
.pimg{height:190px;border-radius:12px 12px 0 0;display:flex;align-items:center;justify-content:center;background:var(--surface-2);overflow:hidden;flex-direction:column;gap:8px;color:var(--text-muted)}
.pimg svg{width:42px;height:42px;stroke:currentColor;fill:none;stroke-width:1.3;opacity:.6}
.pimg span{font-size:12px}
.pimg img{width:100%;height:100%;object-fit:cover}

/* آمار پیشنهادهای قیمت — ردیف‌بندی واضح */
.offer-stats{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.offer-stats>div{display:flex;justify-content:space-between;align-items:center;padding:6px 10px;border-radius:8px;background:var(--surface-2);font-size:13px}
.offer-stats>div span{color:var(--text-muted)}
.offer-stats>div b{font-weight:700}

/* ردیف زیردسته در جدول دسته‌بندی‌ها */
.sub-row{background:var(--surface-2)}
.sub-row td{padding:6px 8px}
.sub-row .row-num{opacity:.55}

.ico-box{width:52px;height:52px;border-radius:14px;background:var(--primary);display:flex;align-items:center;justify-content:center;color:#fff}
.ico-box svg{width:26px;height:26px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* دکمهٔ جستجوی فوتر */
.footer-search-btn{background:transparent;border:none;color:#cbd5e1;font-family:inherit;font-size:13.5px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;padding:0}
.footer-search-btn:hover{color:#fff}
.footer-search-btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8}

/* انتخاب نقش / محصول (رادیو) */
.radio-row{display:flex;flex-wrap:wrap;gap:10px}
.radio{display:flex;align-items:center;gap:9px;padding:11px 14px;border:1px solid var(--border);border-radius:var(--radius-btn);background:var(--surface-2);cursor:pointer;transition:.15s;user-select:none;flex:1;min-width:0}
.radio:hover{border-color:var(--primary)}
.radio:has(input:checked){border-color:var(--primary);background:var(--primary-soft)}
.radio input{position:absolute;opacity:0;pointer-events:none}
.radio .rc{width:18px;height:18px;border-radius:50%;border:2px solid var(--text-muted);flex:0 0 auto;position:relative;transition:.15s}
.radio:has(input:checked) .rc{border-color:var(--primary)}
.radio:has(input:checked) .rc:after{content:'';position:absolute;inset:3px;border-radius:50%;background:var(--primary)}
.radio .rt{font-size:14px;font-weight:500}

/* نکتهٔ حریم خصوصی (ثبت‌نام) */
.privacy-note{background:var(--primary-soft);border:1px solid var(--primary);color:var(--primary);border-radius:var(--radius-btn);padding:11px 14px;font-size:13px;margin:0 0 14px}

/* آپلود و پیش‌نمایش تصویر */
.img-upload{border:1px dashed var(--border);border-radius:var(--radius-card);padding:16px;background:var(--surface-2);text-align:center}
.img-upload input[type=file]{position:absolute;opacity:0;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.img-cta{display:inline-flex;align-items:center;gap:7px;padding:9px 14px;border-radius:var(--radius-btn);background:var(--primary-soft);color:var(--primary);font-weight:600;font-size:13.5px;cursor:pointer}
.img-cta svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8}
.img-preview{margin-top:12px;display:flex;flex-direction:column;align-items:center;gap:10px}
.img-preview img{max-width:100%;max-height:240px;border-radius:10px;border:1px solid var(--border);object-fit:contain;background:var(--surface)}
.img-upload .err-msg{margin-top:8px}

/* پیام خطای سمت کلاینت زیر فیلد */
.err-msg{display:block;color:var(--danger);font-size:12px;margin-top:4px;min-height:0}
.err-msg:empty{display:none}

/* صفحهٔ ورود با کد */
.otp-mobile{display:flex;align-items:center;gap:9px;padding:11px 13px;border:1px solid var(--border);border-radius:var(--radius-btn);background:var(--surface-2);font-weight:600}
.otp-mobile svg{width:17px;height:17px;stroke:var(--text-muted);fill:none;stroke-width:1.8}

/* فوتر — آمار و لینک */
footer{padding:18px}
.footer-stats{display:flex;flex-direction:column;align-items:center;gap:6px;margin-bottom:10px;font-size:13.5px}
.footer-stats span{display:inline-flex;align-items:center;gap:6px}
.footer-stats svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8}
.footer-stats b{color:#cbd5e1;font-weight:800}
.footer-links{display:flex;justify-content:center;gap:20px;flex-wrap:wrap;margin-bottom:10px}
.footer-links a{display:inline-flex;align-items:center;gap:6px;color:#cbd5e1}
.footer-links a:hover{color:#fff}
.footer-links svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8}
.footer-note{font-size:12px;color:var(--footer-text)}

/* صفحه‌بندی */
.pager{display:flex;gap:6px;justify-content:center;margin-top:20px;flex-wrap:wrap}
.pager a,.pager span{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:8px;padding:8px 13px;cursor:pointer;font-size:13.5px}
.pager .active{background:var(--primary);color:var(--on-primary);border-color:var(--primary);font-weight:700}
.pager .disabled{opacity:.5;cursor:default}

/* پابرگ */
footer{background:var(--footer);color:var(--footer-text);text-align:center;padding:16px;font-size:13px;margin-top:28px}
footer b{color:var(--footer-text)}

/* چیدمان پنل */
.shell{display:flex;min-height:calc(100vh - 64px)}
.side{width:230px;flex:0 0 auto;background:var(--surface);border-left:1px solid var(--border);padding:16px 12px}
.side .menu-title{font-size:11.5px;color:var(--text-muted);font-weight:700;padding:8px 12px}
.menu-item{display:flex;align-items:center;gap:11px;padding:11px 12px;border-radius:10px;color:var(--text);font-size:14px;font-weight:500;margin-bottom:2px;transition:.13s}
.menu-item svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.menu-item:hover{background:var(--surface-2)}
.menu-item.active{background:var(--primary-soft);color:var(--primary);font-weight:700}
.content{flex:1;padding:22px;min-width:0}

.userchip{display:flex;align-items:center;gap:9px}
.userchip .av{width:34px;height:34px;border-radius:50%;background:var(--primary-soft);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px}

/* Toast (برای دستورالعمل JS) */
#toasts{position:fixed;bottom:20px;left:16px;z-index:400;display:flex;flex-direction:column;gap:8px}
.toast{min-width:240px;max-width:380px;background:var(--surface);border:1px solid var(--border);border-right:4px solid var(--success);border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.2);padding:12px 16px;font-size:13.5px;animation:slidein .25s ease}
.toast .t{color:var(--text)}
.toast.warning{border-right-color:var(--warning)}
.toast.danger{border-right-color:var(--danger)}
@keyframes slidein{from{transform:translateX(30px);opacity:0}to{transform:translateX(0);opacity:1}}

/* پیام‌های سراسری (flash) */
.alert{display:flex;align-items:center;gap:10px;padding:13px 16px;border-radius:var(--radius-card);border:1px solid;margin:14px 0;font-size:14px}
.alert svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.9;flex:0 0 auto}
.alert-warning{background:var(--warning-soft);border-color:var(--warning);color:var(--warning)}
.alert-success{background:var(--success-soft);border-color:var(--success);color:var(--success)}
.alert-danger{background:var(--danger-soft);border-color:var(--danger);color:var(--danger)}

@media(max-width:960px){
  .cards{grid-template-columns:repeat(2,1fr)}
  .grid3,.gridcat,.form-grid{grid-template-columns:1fr}
  .side{width:200px}
}
@media(max-width:640px){
  .header{gap:10px;padding:0 14px}
  .side{width:60px}
  .side .menu-item span{display:none}
  .brand small{display:none}
  .radio-row{flex-direction:column}
  .radio{width:100%}
  .footer-stats{gap:12px;font-size:12.5px}
}
