:root{
  --pbc-primary:#3e5962;
  --pbc-white:#ffffff;
  --pbc-light:#f5f7f7;
  --pbc-border:#e2e6e8;
  --pbc-text:#2f4858;
}

.pbc-shop{font-family: IRANSansX, sans-serif; color: var(--pbc-text); }
.pbc-shop .pbc-heading{margin: 0 0 1rem; font-weight:800; color:var(--pbc-primary);}

/* لایه‌بندی: سایدبار راست، محصولات چپ (RTL) */
.pbc-shop .pbc-grid{
  display:grid; grid-template-columns: 280px 1fr; gap: 24px; align-items:start;
}
@media (max-width: 991px){
  .pbc-shop .pbc-grid{grid-template-columns: 1fr; gap: 16px;}
}

/* --- Sidebar / Filters --- */
.pbc-filters{position:sticky; top:12px; background:var(--pbc-white); border:1px solid var(--pbc-border);
  border-radius:12px; padding:12px; box-shadow:0 2px 10px rgba(0,0,0,.04);}
.pbc-filters .pbc-actions{display:flex; gap:8px; margin-top:8px;}
.pbc-btn{display:inline-flex; align-items:center; justify-content:center; padding:10px 12px; border-radius:10px; border:1px solid var(--pbc-border); font-weight:700; text-decoration:none;}
.pbc-btn-primary{background:var(--pbc-primary) !important; color:var(--pbc-white) !important; border-color:var(--pbc-primary) !important;}
.pbc-btn-light{background:var(--pbc-light) !important; color:var(--pbc-text) !important;}

.pbc-acc{border:1px solid var(--pbc-border); border-radius:10px; background:var(--pbc-light); margin:10px 0; overflow:hidden;}
.pbc-acc>summary{cursor:pointer; padding:12px 14px; font-weight:800; color:var(--pbc-primary);}
.pbc-acc .pbc-field{padding:10px 14px 14px;}
.pbc-field input[type="number"], .pbc-select{
  width:100%; padding:10px 12px; background:#fff; border:1px solid var(--pbc-border); border-radius:10px; outline:none;
}
.pbc-range{display:flex; align-items:center; gap:8px;}
.pbc-sep{opacity:.6;}
.pbc-checks{display:grid; grid-template-columns:1fr 1fr; gap:6px;}
.pbc-radio label, .pbc-checks label{display:flex; align-items:center; gap:8px;}

/* موبایل: آکاردئون‌ها پیش‌فرض بسته */
@media (max-width: 991px){
  .pbc-acc{background:#fff;}
  .pbc-filters{position:static;}
}

/* --- Products --- */
.pbc-products{}
.pbc-cards{display:grid; gap:14px;}
/* 4 ستون دسکتاپ */
@media (min-width: 992px){
  .pbc-cards{grid-template-columns: repeat(4, 1fr);}
}
/* 2 ستون موبایل */
@media (max-width: 991px){
  .pbc-cards{grid-template-columns: repeat(2, 1fr);}
}

/* کارت محصول */
.pbc-card{background:#fff; border:1px solid var(--pbc-border); border-radius:12px; overflow:hidden; display:flex; flex-direction:column; height:100%;}
.pbc-media{position:relative; display:block; background:var(--pbc-light);}
.pbc-thumb{width:100%; height:auto; display:block; object-fit:cover;}
.pbc-card.is-oos .pbc-thumb{filter:grayscale(100%) contrast(95%);}
.pbc-badge-oos{
  position:absolute; inset:0; margin:auto; width:max-content; height:max-content;
  background:#000; color:#fff; padding:8px 12px; border-radius:8px; font-weight:800; opacity:.85;
}

.pbc-info{padding:10px 12px; display:flex; flex-direction:column; gap:8px; flex:1;}
.pbc-title{font-size:0.95rem; line-height:1.5; margin:0; font-weight:800;}
.pbc-title a{color:var(--pbc-text); text-decoration:none;}
.pbc-title a:hover{color:var(--pbc-primary);}

.pbc-price{display:flex; flex-direction:column; align-items:center; justify-content:center; background:linear-gradient(135deg, #f5f7f7 0%, #e8ebec 100%); border:1px solid var(--pbc-border);
  border-radius:10px; padding:8px 10px;}
.pbc-price ins{color:var(--pbc-primary); text-decoration:none; font-weight:800; font-size:1.05rem;}
.pbc-price del{color:#c62828; font-size:0.85rem; opacity:.9;} /* قیمت قبل کوچکتر و قرمز */

.pbc-cta{margin-top:auto; display:flex; justify-content:stretch;}
.pbc-buy, .pbc-view{
  display:inline-flex; width:100%; align-items:center; justify-content:center; gap:8px;
  padding:10px 12px; border-radius:10px; font-weight:800; text-decoration:none;
  background:var(--pbc-primary) !important; color:#fff !important; border:1px solid var(--pbc-primary) !important;
}
.pbc-view{background:#fff !important; color:var(--pbc-primary) !important; border-color:var(--pbc-primary) !important;}

.pbc-empty{padding:24px; text-align:center; background:var(--pbc-light); border:1px dashed var(--pbc-border); border-radius:12px;}

/* Pagination */
.pbc-pagination{display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin:14px 0;}
.pbc-pagination .pbc-page a,
.pbc-pagination .pbc-page span{
  display:inline-flex; min-width:36px; min-height:36px; align-items:center; justify-content:center;
  padding:4px 10px; border-radius:10px; border:1px solid var(--pbc-border); background:#fff; color:var(--pbc-text); text-decoration:none;
}
.pbc-pagination .pbc-page .current{background:var(--pbc-primary); color:#fff; border-color:var(--pbc-primary);}

/* ورودی‌های هماهنگ با سایدبار */
.pbc-input, .pbc-select{
  width:100%; padding:10px 12px; background:#fff; border:1px solid var(--pbc-border);
  border-radius:10px; outline:none; font-family:inherit; font-size:0.95rem;
}
.pbc-input:focus, .pbc-select:focus{
  border-color: var(--pbc-primary);
  box-shadow: 0 0 0 3px rgba(62,89,98,.12);
}
.pbc-input-search{
  background: linear-gradient(0deg, #fff, #fff) padding-box,
              linear-gradient(135deg, #f5f7f7, #e8ebec) border-box;
  border:1px solid var(--pbc-border);
  border-radius:10px;
}

/* حالت لودینگ نتایج */
.pbc-shop.pbc-loading .pbc-results{
  position: relative;
  opacity:.6;
}
.pbc-shop.pbc-loading .pbc-results:after{
  content:""; position:absolute; inset:0; margin:auto; width:38px; height:38px; border-radius:50%;
  border:3px solid var(--pbc-light); border-top-color: var(--pbc-primary); animation:pbcspin 0.9s linear infinite;
}
@keyframes pbcspin { to { transform: rotate(360deg); } }

/* ===== PBC v1.2.0 — Title: always two lines, price box untouched ===== */

:root{
  --pbc-title-font-size: 15px;   /* ثابت برای محاسبه دقیق ارتفاع */
  --pbc-title-line: 1.6;
  --pbc-title-rows: 2;           /* همیشه دو خط فضا */
}

/* لایه داخلی کارت: CTA همیشه پایین بماند */
.pbc-info{
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  height: 100%;
}

/* عنوان محصول: دقیقا دو خط فضا
   - اگر یک‌خطی باشد: خط دوم خالی رزرو می‌ماند
   - اگر سه‌خطی باشد: فقط دو خط نمایش داده می‌شود */
.pbc-title{
  font-size: var(--pbc-title-font-size);
  line-height: var(--pbc-title-line);
  font-weight: 800;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: var(--pbc-title-rows);
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: calc(var(--pbc-title-font-size) * var(--pbc-title-line) * var(--pbc-title-rows));
}
.pbc-title a{
  color: var(--pbc-text);
  text-decoration: none;
  display: block;
}
.pbc-title a:hover{ color: var(--pbc-primary); }

/* CTA پایین کارت ثابت بماند */
.pbc-cta{ margin-top: auto; display: flex; }

/* v1.2.1 — Price filter: vertical stack + currency badge inside input */
.pbc-price-stack{
  display:flex; flex-direction:column; gap:8px;
}
.pbc-input-wrap.pbc-input-currency{
  position:relative;
}
.pbc-input-wrap.pbc-input-currency .pbc-input{
  /* چون سایت RTL است، واحد سمت چپ می‌نشیند و padding-left بیشتر می‌خواهیم */
  padding-left:58px; /* جا برای "ریال" */
}
.pbc-input-wrap .pbc-currency{
  position:absolute;
  left:12px; top:50%; transform:translateY(-50%);
  font-size: .8rem; line-height:1;
  color:#6b7b83; background:#eef2f3;
  border:1px solid var(--pbc-border);
  padding:6px 8px; border-radius:8px;
  pointer-events:none;
}

/* هماهنگی فوکوس ورودی */
.pbc-input:focus{
  border-color: var(--pbc-primary);
  box-shadow: 0 0 0 3px rgba(62,89,98,.12);
}

/* ===== PBC v1.3.1 – Sidebar right + mobile 2 cols ===== */

/* ظرف: سایدبار (راست) + نتایج (چپ) */
.pbc-shop{
  display:grid !important;
  grid-template-columns: 300px 1fr !important; /* سایدبار | نتایج */
  gap:24px !important;
  align-items:start !important;
  width:100% !important;
}
.pbc-shop .pbc-sidebar{ order:1; position:sticky; top:16px; align-self:start; }
.pbc-shop .pbc-results{ order:2; min-width:0 !important; }

/* گرید محصولات (دسکتاپ پیش‌فرض 4 ستون؛ توسط کلاس columns-* هم کنترل می‌شود) */
.pbc-shop .pbc-results .pbc-grid{
  display:grid !important;
  width:100% !important;
  max-width:100% !important;
  gap:20px !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
.pbc-shop .pbc-results .pbc-grid > *{ min-width:0 !important; }

/* احترام به مقدار [columns] */
.pbc-shop .pbc-results .pbc-grid.columns-1{ grid-template-columns:repeat(1,minmax(0,1fr)) !important; }
.pbc-shop .pbc-results .pbc-grid.columns-2{ grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
.pbc-shop .pbc-results .pbc-grid.columns-3{ grid-template-columns:repeat(3,minmax(0,1fr)) !important; }
.pbc-shop .pbc-results .pbc-grid.columns-4{ grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
.pbc-shop .pbc-results .pbc-grid.columns-5{ grid-template-columns:repeat(5,minmax(0,1fr)) !important; }

/* کارت‌ها هم‌قد و منظم */
.pbc-card{ display:flex !important; flex-direction:column !important; height:100% !important; min-width:0 !important; }
.pbc-card .pbc-media{ display:block; width:100% !important; aspect-ratio: 3 / 4; overflow:hidden; border-radius:inherit; }
.pbc-card .pbc-media img{ width:100% !important; height:100% !important; object-fit:contain !important; object-position:center !important; }
.pbc-card .pbc-title{ line-height:1.4; min-height:calc(1.4em*2 + 2px) !important; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-top:10px !important; }
.pbc-card .pbc-price{ margin:8px 0 10px !important; }
.pbc-card .pbc-cta{ margin-top:auto !important; }

/* صفحه‌بندی فشرده و وسط‌چین */
.pbc-shop .pbc-results .pbc-pagination{
  margin:18px 0 8px !important;
  display:flex !important; flex-wrap:wrap !important; gap:8px !important;
  justify-content:center !important; align-items:center;
}
.pbc-shop .pbc-results .pbc-pagination a,
.pbc-shop .pbc-results .pbc-pagination span.ellipsis{
  display:inline-flex !important; align-items:center; justify-content:center;
  min-width:36px; height:36px; padding:0 10px;
  border-radius:10px; border:1px solid #3e5962; color:#3e5962; background:#fff;
  text-decoration:none; font-weight:600;
}
.pbc-shop .pbc-results .pbc-pagination a.is-active{
  background:#3e5962; color:#fff; border-color:#3e5962;
}
.pbc-shop .pbc-results .pbc-pagination span.ellipsis{
  border-color:transparent; color:#9aa7ad; pointer-events:none;
}

/* ریسپانسیو: سایدبار بالا، گرید 2 ستونه */
/* ===== PBC v1.3.1 – Force 2 columns on mobile ===== */
@media (max-width: 820px){
  /* سایدبار بالا بماند */
  .pbc-shop{ grid-template-columns: 1fr !important; gap:16px !important; }
  .pbc-shop .pbc-sidebar{ position: static; order: 1; }
  .pbc-shop .pbc-results{ order: 2; }

  /* با specificity برابر/بیشتر همهٔ حالت‌های columns-* را به 2 ستون مجبور کن */
  .pbc-shop .pbc-results .pbc-grid,
  .pbc-shop .pbc-results .pbc-grid.columns-1,
  .pbc-shop .pbc-results .pbc-grid.columns-2,
  .pbc-shop .pbc-results .pbc-grid.columns-3,
  .pbc-shop .pbc-results .pbc-grid.columns-4,
  .pbc-shop .pbc-results .pbc-grid.columns-5{
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 14px !important;
  }
}
@media (max-width: 420px){
  .pbc-shop .pbc-results .pbc-grid{
    gap: 12px !important;
  }
}
/* ==== PBC 1.3.1-m — Mobile sidebar toggle ==== */
@media (max-width: 820px){
  .pbc-sidebar{ position: relative !important; border-radius: 12px; }
  .pbc-sidebar .pbc-filter-toggle{
    display:flex; align-items:center; justify-content:space-between;
    padding:10px 12px; border:1px solid #dfe6ea; border-radius:12px;
    background:#fff; color:#3e5962; font-weight:600; cursor:pointer;
    margin-bottom:8px;
  }
  .pbc-sidebar .pbc-filter-toggle .arrow{
    width:10px; height:10px; border-right:2px solid #3e5962; border-bottom:2px solid #3e5962;
    transform: rotate(-45deg); transition: transform .2s ease;
    margin-inline-start:8px;
  }
  .pbc-sidebar.is-collapsed .pbc-filter-toggle .arrow{ transform: rotate(135deg); }
  .pbc-sidebar .pbc-sidebar-inner{ overflow: hidden; }
}

/* === v1.4.0 UI: Anjoman font for sidebar === */
.pbc-sidebar,
.pbc-sidebar .pbc-acc > summary,
.pbc-sidebar .pbc-field,
.pbc-sidebar label,
.pbc-sidebar .pbc-input,
.pbc-sidebar .pbc-select,
.pbc-sidebar .pbc-btn{
  font-family: 'Anjoman','AnjomanMax','IRANSansX',sans-serif !important;
  font-weight: 600;
}

/* === v1.4.0 UI: Category list single-column + inner scroll === */
.pbc-sidebar .pbc-cat-scroll{
  max-height: 210px;   /* ~5 items; adjust if needed */
  overflow: auto;
  padding-inline-end: 4px;
}
.pbc-sidebar .pbc-cat-scroll::-webkit-scrollbar{ width: 6px; }
.pbc-sidebar .pbc-cat-scroll::-webkit-scrollbar-thumb{
  background: #d0d5d8; border-radius: 6px;
}
.pbc-sidebar .pbc-cat-scroll label,
.pbc-sidebar .pbc-cat-scroll .pbc-check,
.pbc-sidebar .pbc-cat-scroll .pbc-checks *{
  display: block !important;
  white-space: nowrap;       /* remove if you prefer multi-line titles */
  margin: 6px 0;
}
.pbc-sidebar .pbc-cat-scroll .pbc-checks,
.pbc-sidebar .pbc-cat-scroll .pbc-cols{
  display: block !important;
  column-count: 1 !important;
}
.pbc-sidebar .pbc-cat-scroll input[type="checkbox"]{
  margin-inline-start: 0;
  margin-inline-end: 6px;
  vertical-align: middle;
}
@media (max-width: 991px){
  .pbc-sidebar .pbc-cat-scroll{ max-height: 200px; }
}

/* === v1.4.0 UI RTL for category checklist === */
.pbc-shop .pbc-sidebar .pbc-checks--rtl{
  direction: rtl !important;
  text-align: right !important;
}
.pbc-shop .pbc-sidebar .pbc-checks--rtl label,
.pbc-shop .pbc-sidebar .pbc-checks--rtl .pbc-check{
  display: flex !important;
  flex-direction: row-reverse !important; /* checkbox on the right */
  align-items: center !important;
  gap: 8px !important;
  justify-content: flex-start !important;  /* align content to right edge */
}
.pbc-shop .pbc-sidebar .pbc-checks--rtl input[type="checkbox"]{
  margin-left: 6px !important;
  margin-right: 0 !important;
}

/* === Category checklist: single-column + internal scroll === */
.pbc-shop .pbc-sidebar .pbc-checks--single{
  /* Grid دوستونه را بی‌اثر کن */
  display: block !important;
  grid-template-columns: 1fr !important;
  grid-auto-flow: row !important;

  /* باکس ساده مثل «موجودی» */
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0; /* padding خود .pbc-field اعمال شده */
}

/* هر آیتم یک ردیف تمیز؛ RTL: چک‌باکس راست، متن چپ */
.pbc-shop .pbc-sidebar .pbc-checks--single label,
.pbc-shop .pbc-sidebar .pbc-checks--single .pbc-check{
  display: flex !important;
  flex-direction: row-reverse !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  line-height: 1.9 !important;
  background: transparent !important;
  border: 0 !important;
  white-space: normal !important; /* عنوان بلند چندخطی شود */
}

.pbc-shop .pbc-sidebar .pbc-checks--single input[type="checkbox"]{
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
}
/* === راست‌چین‌کردن کامل آیتم‌های دسته‌بندی === */
.pbc-shop .pbc-sidebar .pbc-checks--single{
  direction: rtl !important;
  text-align: right !important;
}

/* متن و چک‌باکس با راست چین هماهنگ شوند */
.pbc-shop .pbc-sidebar .pbc-checks--single label,
.pbc-shop .pbc-sidebar .pbc-checks--single .pbc-check{
  justify-content: flex-end !important;   /* آیتم‌ها به راست بچسبند */
  direction: rtl !important;
  text-align: right !important;
}

/* فاصله‌ی متن از چک‌باکس */
.pbc-shop .pbc-sidebar .pbc-checks--single input[type="checkbox"]{
  margin-left: 6px !important;
  margin-right: 0 !important;
}

/* === موقعیت چک‌باکس قبل از متن === */
.pbc-shop .pbc-sidebar .pbc-checks--single label,
.pbc-shop .pbc-sidebar .pbc-checks--single .pbc-check {
  display: flex !important;
  flex-direction: row !important;  /* ✅ چک‌باکس قبل از متن */
  align-items: center !important;
  justify-content: flex-start !important; /* چسبیده به راست */
  gap: 8px !important;
  direction: rtl !important;
  text-align: right !important;
}

/* چک‌باکس فاصله از متن */
.pbc-shop .pbc-sidebar .pbc-checks--single input[type="checkbox"] {
  margin-right: 6px !important;  /* بین چک‌باکس و متن فاصله بده */
  margin-left: 0 !important;
}
