/* ===========================================================
   SHOP — دسته‌بندی و فیلتر (لِول ۲)
   پیکسل‌به‌پیکسل مطابق ui/category.html. فقط روی آرشیو فروشگاه لود می‌شود.
   همه‌ی سلکتورها زیر .rey-ui اسکوپ شده‌اند و از توکن‌های base.css استفاده می‌کنند.
   =========================================================== */

/* برای سئو: عنوان h1 مخفی بصری ولی خواندنی برای موتور جستجو و اسکرین‌ریدر */
.rey-ui .rey-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- بردکرامب ---------- */
.rey-ui .rey-crumb { display: flex; align-items: center; gap: 8px; padding-top: 22px;
  font: 400 11px var(--rey-font); color: var(--muted); }
.rey-ui .rey-crumb a { color: var(--muted); transition: color .2s; }
.rey-ui .rey-crumb a:hover { color: var(--green); }
.rey-ui .rey-crumb .sep { opacity: .5; }
.rey-ui .rey-crumb .current { color: var(--text-2); font-weight: 500; }

/* ===========================================================
   مرورگر دسته‌بندی (بالای محصولات)
   ردیف دسته‌های اصلی → با کلیک، زیرشاخه‌ها باز می‌شوند.
   =========================================================== */
.rey-ui .rey-cats { background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(20px * var(--rey-r)); padding: 18px 14px; margin-top: 18px; }

.rey-ui .rey-cats__row { display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none; padding-bottom: 2px; }
.rey-ui .rey-cats__row::-webkit-scrollbar { display: none; }

.rey-ui .rey-cat { flex: 0 0 118px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 8px 14px; border: 1px solid transparent; border-radius: calc(16px * var(--rey-r));
  background: none; text-align: center; cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s; }
.rey-ui .rey-cat:hover { background: var(--green-050); border-color: #dbeae2; transform: translateY(-2px); }

.rey-ui .rey-cat__img { width: 74px; height: 74px; border-radius: 50%;
  background: var(--gray-1); overflow: hidden; flex: 0 0 74px;
  display: flex; align-items: center; justify-content: center; color: var(--green);
  transition: box-shadow .2s; }
.rey-ui .rey-cat__img img { width: 100%; height: 100%; object-fit: contain; }
.rey-ui .rey-cat__img svg { width: 30px; height: 30px; }
.rey-ui .rey-cat:hover .rey-cat__img { box-shadow: 0 8px 20px rgba(0,95,54,.12); }

.rey-ui .rey-cat__name { font: 700 12.5px/1.6 var(--rey-font); color: var(--navy); }
.rey-ui .rey-cat__count { font: 400 11px var(--rey-font); color: var(--muted); }

.rey-ui .rey-cat__chev { position: absolute; top: 8px; inset-inline-start: 8px;
  width: 20px; height: 20px; border-radius: 50%; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s, color .25s, background .25s; }
.rey-ui .rey-cat__chev svg { width: 13px; height: 13px; }
.rey-ui .rey-cat.is-open .rey-cat__chev { transform: rotate(180deg); color: #fff; background: var(--green); }
.rey-ui .rey-cat.is-open { background: var(--green-100); border-color: var(--green-300); }
.rey-ui .rey-cat.is-open .rey-cat__name { color: var(--green); }

/* پنل زیرشاخه‌ها */
.rey-ui .rey-cats__sub { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.rey-ui .rey-cats__sub[hidden] { display: none; }
.rey-ui .rey-cats__sub-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px; padding: 0 6px; }
.rey-ui .rey-cats__sub-head b { font: 700 13px var(--rey-font); color: var(--navy); }
.rey-ui .rey-cats__sub-head a { font: 600 12px var(--rey-font); color: var(--green); }
.rey-ui .rey-cats__row--sm .rey-cat { flex: 0 0 104px; padding: 10px 6px 12px; }
.rey-ui .rey-cats__row--sm .rey-cat__img { width: 60px; height: 60px; flex-basis: 60px; }
.rey-ui .rey-cats__row--sm .rey-cat__name { font-size: 12px; }

@media (max-width: 860px) {
  .rey-ui .rey-cats { padding: 12px 8px; border-radius: calc(16px * var(--rey-r)); margin-top: 12px; }
  .rey-ui .rey-cat { flex: 0 0 96px; padding: 8px 4px 10px; }
  .rey-ui .rey-cat__img { width: 58px; height: 58px; flex-basis: 58px; }
  .rey-ui .rey-cat__name { font-size: 11.5px; }
  .rey-ui .rey-cat__count { font-size: 10px; }
  .rey-ui .rey-cats__row--sm .rey-cat { flex: 0 0 86px; }
  .rey-ui .rey-cats__row--sm .rey-cat__img { width: 50px; height: 50px; flex-basis: 50px; }
}

/* ===========================================================
   محتوای سئوی دسته‌بندی (پایین صفحه)
   =========================================================== */
.rey-ui .rey-catseo { background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(20px * var(--rey-r)); padding: 24px 26px; margin-bottom: 48px; }
.rey-ui .rey-catseo__head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rey-ui .rey-catseo__head h2 { font: 800 17px var(--rey-font); color: var(--navy); margin: 0; }
.rey-ui .rey-catseo__toggle { font: 600 12px var(--rey-font); color: var(--green);
  background: var(--green-100); border: none; border-radius: 99px; padding: 8px 16px; cursor: pointer; }
.rey-ui .rey-catseo__body { font: 400 13.5px/2.2 var(--rey-font); color: var(--text-2);
  position: relative; max-height: 150px; overflow: hidden; transition: max-height .3s ease; }
.rey-ui .rey-catseo__body::after { content: ""; position: absolute; inset-inline: 0; bottom: 0;
  height: 70px; background: linear-gradient(to bottom, rgba(255,255,255,0), var(--surface)); pointer-events: none; }
.rey-ui .rey-catseo__body.is-open { max-height: none; }
.rey-ui .rey-catseo__body.is-open::after { display: none; }
.rey-ui .rey-catseo__body p { margin: 0 0 14px; }
.rey-ui .rey-catseo__body h2,
.rey-ui .rey-catseo__body h3 { font: 700 15px var(--rey-font); color: var(--navy); margin: 20px 0 10px; }
.rey-ui .rey-catseo__body a { color: var(--green); }
.rey-ui .rey-catseo__body ul, .rey-ui .rey-catseo__body ol { padding-inline-start: 20px; margin: 0 0 14px; }
.rey-ui .rey-catseo__body li { margin-bottom: 7px; }
@media (max-width: 860px) {
  .rey-ui .rey-catseo { padding: 16px; border-radius: calc(16px * var(--rey-r)); margin-bottom: 32px; }
  .rey-ui .rey-catseo__head h2 { font-size: 15px; }
  .rey-ui .rey-catseo__body { font-size: 13px; }
}

/* ---------- چیدمان دو ستونه ---------- */
.rey-ui .rey-cat-layout { display: grid; grid-template-columns: 265px 1fr; gap: 20px;
  align-items: start; margin-top: 20px; margin-bottom: 48px; }
.rey-ui .rey-cat-layout > * { min-width: 0; }

/* ---------- سایدبار فیلترها ---------- */
.rey-ui .rey-side-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(18px * var(--rey-r)); padding: 20px; }
/* ستونِ فیلتر هیچ‌وقت از ارتفاعِ صفحه بلندتر نمی‌شود؛ خودش داخل اسکرول می‌شود. */
.rey-ui .rey-filters { position: sticky; top: 16px;
  display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.rey-ui .rey-f-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px; flex: 0 0 auto; }
.rey-ui .rey-f-head b { font: 800 14px var(--rey-font); color: var(--navy); }
.rey-ui .rey-f-clear { font: 600 11px var(--rey-font); color: var(--red); background: none; border: none; }

/* بدنه‌ی اسکرول‌شونده (سربرگ و دکمه‌ی اعمال بیرونش می‌مانند) */
.rey-ui .rey-f-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin-inline-end: -8px; padding-inline-end: 8px; scrollbar-width: thin; }

.rey-ui .rey-fgroup { border-top: 1px solid var(--border-2); padding: 12px 0; }
.rey-ui .rey-fgroup:first-of-type { border-top: none; padding-top: 2px; }
.rey-ui .rey-fgroup b { display: flex; align-items: center; gap: 8px;
  font: 700 12.5px var(--rey-font); color: var(--navy); min-width: 0; flex: 1 1 auto; }
.rey-ui .rey-fgroup b svg { width: 15px; height: 15px; color: var(--green); flex: 0 0 15px; }

/* سربرگِ گروه = خلاصه‌ی <details>؛ کلیک روی آن باز/بسته می‌کند */
.rey-ui .rey-fgroup__t { display: flex; align-items: center; gap: 8px; cursor: pointer;
  list-style: none; user-select: none; }
.rey-ui .rey-fgroup__t::-webkit-details-marker { display: none; }
.rey-ui .rey-fgroup__t::marker { content: ""; }
.rey-ui .rey-fgroup__chev { width: 14px; height: 14px; flex: 0 0 14px; color: var(--muted);
  transition: transform .2s, color .2s; }
.rey-ui .rey-fgroup[open] > .rey-fgroup__t .rey-fgroup__chev { transform: rotate(180deg); color: var(--green); }
.rey-ui .rey-fgroup__c { padding-top: 11px; }

/* لیست‌های بلند (دسته‌بندی/برند/ویژگی) خودشان اسکرول می‌شوند */
.rey-ui .rey-fscroll { max-height: 220px; overflow-y: auto; overscroll-behavior: contain;
  padding-inline-end: 6px; scrollbar-width: thin; }
.rey-ui .rey-f-body::-webkit-scrollbar,
.rey-ui .rey-fscroll::-webkit-scrollbar { width: 6px; }
.rey-ui .rey-f-body::-webkit-scrollbar-thumb,
.rey-ui .rey-fscroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.rey-ui .rey-f-body::-webkit-scrollbar-thumb:hover,
.rey-ui .rey-fscroll::-webkit-scrollbar-thumb:hover { background: var(--green-300); }

/* گزینه‌ی چک‌باکسی (برند و ...) */
.rey-ui .rey-fopt { display: flex; align-items: center; gap: 9px; padding: 6px 0; cursor: pointer;
  font: 500 12.5px var(--rey-font); color: var(--text-2); user-select: none; }
.rey-ui .rey-fopt input { display: none; }
.rey-ui .rey-fopt .bx { width: 18px; height: 18px; border-radius: calc(6px * var(--rey-r)); border: 1.5px solid #cfd5da;
  background: #fff; position: relative; transition: all .15s; flex: 0 0 18px; }
.rey-ui .rey-fopt input:checked + .bx { background: var(--green); border-color: var(--green); }
.rey-ui .rey-fopt input:checked + .bx::after { content: ""; position: absolute; inset: 0; margin: auto;
  width: 9px; height: 5px; border: 2px solid #fff; border-top: none; border-right: none;
  transform: rotate(-45deg) translateY(-1px); }
.rey-ui .rey-fopt .cnt { margin-right: auto; font: 400 10.5px var(--rey-font); color: var(--muted); }

/* محدوده قیمت */
.rey-ui .rey-price-inputs { display: flex; align-items: center; gap: 8px; }
.rey-ui .rey-price-inputs input { width: 100%; min-width: 0; font: 500 12px var(--rey-font); color: var(--text);
  background: var(--gray-1); border: 1.5px solid transparent; border-radius: calc(10px * var(--rey-r)); padding: 9px 12px; outline: none; }
.rey-ui .rey-price-inputs input:focus { border-color: var(--green); background: #fff; }
.rey-ui .rey-price-inputs span { font: 400 11px var(--rey-font); color: var(--muted); }

/* جستجو در نتایج */
.rey-ui .rey-fsearch { width: 100%; min-width: 0; font: 500 12px var(--rey-font); color: var(--text);
  background: var(--gray-1); border: 1.5px solid transparent; border-radius: calc(10px * var(--rey-r)); padding: 9px 12px; outline: none; }
.rey-ui .rey-fsearch:focus { border-color: var(--green); background: #fff; }

/* دکمه‌ی اعمال فیلتر (فقط برای حالت بدون‌جاوااسکریپت / موبایل) */
.rey-ui .rey-f-apply { display: block; width: 100%; margin-top: 16px; text-align: center; flex: 0 0 auto;
  background: var(--green); color: #fff; font: 700 13px var(--rey-font); border: none;
  border-radius: calc(12px * var(--rey-r)); padding: 11px; cursor: pointer; }
.rey-ui.js .rey-f-apply { display: none; } /* با جاوااسکریپت فعال، خودکار اعمال می‌شود */

/* ---------- نوار مرتب‌سازی ---------- */
.rey-ui .rey-sortbar { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: calc(16px * var(--rey-r)); padding: 10px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.rey-ui .rey-sortbar .lbl { display: inline-flex; align-items: center; gap: 7px;
  font: 700 12px var(--rey-font); color: var(--navy); }
.rey-ui .rey-sortbar .lbl svg { width: 16px; height: 16px; color: var(--green); }
.rey-ui .rey-sort-chip { font: 500 12px var(--rey-font); color: var(--text-3); background: none; border: none;
  border-radius: 99px; padding: 7px 14px; transition: all .15s; }
.rey-ui .rey-sort-chip:hover { color: var(--green); }
.rey-ui .rey-sort-chip.active { color: var(--green); font-weight: 700; background: var(--green-100); }
.rey-ui .rey-sortbar .count { margin-right: auto; font: 400 11.5px var(--rey-font); color: var(--muted); }

/* ---------- گرید محصولات ---------- */
.rey-ui .rey-cat-layout .products { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
  margin: 0; padding: 0; list-style: none; }
.rey-ui .rey-cat-layout .products::before,
.rey-ui .rey-cat-layout .products::after { display: none !important; }
.rey-ui .rey-cat-layout .products li.product { width: 100%; margin: 0; float: none; position: relative; }

/* چک‌باکس مقایسه روی کارت */
.rey-ui .rey-cmp-check { position: absolute; top: 14px; left: 14px; z-index: 2;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: calc(12px * var(--rey-r));
  cursor: pointer; color: var(--text-3); transition: all .15s; }
.rey-ui .rey-cmp-check input { display: none; }
.rey-ui .rey-cmp-check svg { width: 16px; height: 16px; }
.rey-ui .rey-cmp-check.on { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- حالت «نتیجه‌ای نیست» ---------- */
.rey-ui .rey-noresults { grid-column: 1 / -1; text-align: center; padding: 60px 20px;
  border: 1.5px dashed var(--border); border-radius: calc(20px * var(--rey-r)); }
.rey-ui .rey-noresults svg { width: 54px; height: 54px; color: #c9d5cf; }
.rey-ui .rey-noresults b { display: block; font: 800 16px var(--rey-font); color: var(--navy); margin-top: 14px; }
.rey-ui .rey-noresults span { font: 400 12.5px var(--rey-font); color: var(--muted); }

/* ---------- نوار شناور مقایسه ---------- */
.rey-ui .rey-cmp-bar { position: fixed; bottom: 18px; right: 50%; transform: translateX(50%); z-index: 80;
  display: none; align-items: center; gap: 14px; background: var(--navy); color: #fff;
  border-radius: 99px; padding: 10px 12px 10px 22px; box-shadow: 0 16px 40px rgba(0,0,0,.25);
  font: 600 12.5px var(--rey-font); }
.rey-ui .rey-cmp-bar.show { display: flex; }
.rey-ui .rey-cmp-bar .rey-cmp-go { background: var(--green); color: #fff; border-radius: 99px;
  padding: 9px 22px; font: 700 12px var(--rey-font); }

/* ---------- دکمه‌ی نمایش فیلترها (موبایل) ---------- */
.rey-ui .rey-filters-toggle { display: none; width: 100%; align-items: center; justify-content: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: calc(12px * var(--rey-r)); padding: 11px;
  font: 700 13px var(--rey-font); color: var(--navy); margin-bottom: 10px; }
.rey-ui .rey-filters-toggle svg { width: 18px; height: 18px; color: var(--green); }

/* ---------- صفحه‌بندی ---------- */
.rey-ui .rey-cat-layout .woocommerce-pagination { margin-top: 28px; text-align: center; }
.rey-ui .rey-cat-layout .woocommerce-pagination ul { display: inline-flex; gap: 6px; border: 0; margin: 0; padding: 0; }
.rey-ui .rey-cat-layout .woocommerce-pagination ul li { border: 0; margin: 0; }
.rey-ui .rey-cat-layout .woocommerce-pagination a,
.rey-ui .rey-cat-layout .woocommerce-pagination span { display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: calc(10px * var(--rey-r)); background: #fff;
  border: 1px solid var(--border); font: 600 13px var(--rey-font); color: var(--text-2); }
.rey-ui .rey-cat-layout .woocommerce-pagination .current { background: var(--green); color: #fff; border-color: var(--green); }
/* ul را خودمان چاپ می‌کنیم (قالبِ woocommerce/loop/pagination.php)، پس ریستِ
   بولت‌ها اینجا لازم است و نباید به تمِ مادر تکیه کنیم. */
.rey-ui .woocommerce-pagination ul { list-style: none; margin: 0; padding: 0; display: inline-flex; gap: 6px; border: 0; }
.rey-ui .woocommerce-pagination ul li { list-style: none; margin: 0; padding: 0; border: 0; }
.rey-ui .woocommerce-pagination ul li::marker { content: ""; }
/* فلشِ قبلی/بعدی: فقط SVG خودمان. آیکون/شبه‌المانی که تمِ مادر تزریق می‌کند حذف شود
   وگرنه دو فلش روی هم می‌افتد. */
.rey-ui .woocommerce-pagination a svg,
.rey-ui .woocommerce-pagination span svg { width: 16px; height: 16px; }
.rey-ui .woocommerce-pagination .prev::before, .rey-ui .woocommerce-pagination .prev::after,
.rey-ui .woocommerce-pagination .next::before, .rey-ui .woocommerce-pagination .next::after { content: none !important; display: none !important; }
.rey-ui .woocommerce-pagination .prev > i, .rey-ui .woocommerce-pagination .next > i,
.rey-ui .woocommerce-pagination .prev [class*="wd-icon"], .rey-ui .woocommerce-pagination .next [class*="wd-icon"] { display: none !important; }
.rey-ui .woocommerce-pagination .dots { border-color: transparent; background: none; min-width: 24px; padding: 0; }

/* ---------- ریسپانسیو ---------- */
@media (max-width: 1024px) {
  .rey-ui .rey-cat-layout { grid-template-columns: 230px 1fr; }
}
@media (max-width: 768px) {
  .rey-ui .rey-cat-layout { grid-template-columns: 1fr; margin-top: 14px; }
  .rey-ui .rey-filters-toggle { display: inline-flex; }
  .rey-ui .rey-filters { display: none; position: static; max-height: 72vh; }
  .rey-ui .rey-filters.open { display: flex; }
  .rey-ui .rey-cat-layout .products { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rey-ui .rey-sortbar { padding: 8px 10px; }
  .rey-ui .rey-sort-chip { padding: 6px 10px; font-size: 11px; }
  .rey-ui .rey-crumb { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; padding-top: 14px; font-size: 11px; }
  .rey-ui .rey-crumb::-webkit-scrollbar { display: none; }
  .rey-ui .rey-crumb a, .rey-ui .rey-crumb span { flex: 0 0 auto; }
}

/* گرید فروشگاه با کارت یکپارچه‌ی .pcard: سلولِ li شفاف، کارت داخلش */
.rey-ui .rey-cat-layout .products li.product,
.rey-ui .rey-shop-page ul.products li.product {
  background: none !important; border: none !important; padding: 0 !important;
  box-shadow: none !important; transform: none !important; border-radius: 0 !important; }
.rey-ui .rey-cat-layout .products .pcard { height: 100%; border: 1px solid var(--border); }
.rey-ui .rey-cat-layout .products .pcard:hover { border-color: var(--green-300); box-shadow: 0 10px 22px rgba(15,27,45,.06); }
