:root {
  --c-bg: #fff;
  --c-text: #111;
  --c-border: #e5e5e5;
  --brand-gold: var(--primary, #2ec4b6);
}

/* =============================
   ستون فیلتر (سمت راست)
============================= */
.filters {
  flex: 0 0 200px;
  max-width: 220px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  direction: rtl;
  text-align: right;
  position: relative;
  z-index: 10;
}

.filters-head {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  min-height: 40px;
  flex-wrap: nowrap; /* ✅ جلوگیری از پرش */
}

.filters-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.filters-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap; /* ✅ chipها اگر زیاد شدن خط بعدی برن */
  flex-shrink: 0;
}

.selected-chip {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

/* =============================
   آکاردئون
============================= */
.acc {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.acc-item {
  border-bottom: 1px solid var(--c-border);
}

.acc-item:last-child {
  border-bottom: 0;
}

/* دکمه اصلی هر فیلتر */
.acc-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 14px 0;
  background: transparent;
  border: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--c-text);
}

/* علامت + و - سمت چپ */
.acc-btn .plus {
  font-size: 18px;
  font-weight: 600;
  color: #555;
}

/* حالت بسته → + */
.acc-btn[aria-expanded="false"] .plus::before {
  content: "+";
}

/* حالت باز → - */
.acc-btn[aria-expanded="true"] .plus::before {
  content: "-";
}

/* =============================
   پنل بازشونده
   ✅ بدون max-height و transition
   ✅ انیمیشن کامل با JS
============================= */
.acc-panel {
  overflow: hidden;
  padding: 0;
  height: 0;
  opacity: 0;
}

/* =============================
   لیبل‌ها و چک‌باکس‌ها
============================= */
.acc-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-family: var(--font-ui);
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

/* چک‌باکس‌ها */
.acc-panel input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.2px solid #cfcfcf;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  line-height: 16px;
  box-sizing: border-box;
}

.acc-panel input[type="checkbox"]:checked {
  border-color: var(--brand-gold);
  background: var(--brand-gold);
}

.acc-panel input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 10px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath fill='%23fff' d='M4.6 7.6L1.7 4.8 0.3 6.2 4.6 10 12 2.6 10.6 1.2z'/%3E%3C/svg%3E") no-repeat center/contain;
  opacity: 0;
}

.acc-panel input[type="checkbox"]:checked::after {
  opacity: 1;
}

/* =============================
   بخش سایز سفارشی (Custom Size)
============================= */
.custom-size {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 0px;
}

/* هر اسلایدر */
.custom-slider {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  width: 100%;
}

.custom-slider .slider-header {
  direction: rtl;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.custom-slider img {
  width: 70px;
  height: auto;
  opacity: 0.95;
  margin: 0;
  display: block;
}

/* عنوان */
.custom-slider label {
  font-weight: 500;
  color: #222;
  white-space: nowrap;
}

/* نوار اسلایدر (برای رنج‌های تکی؛ در دوبل توسط .range-wrapper کنترل می‌شود) */
.custom-slider input[type="range"] {
  width: 100%;
  accent-color: var(--brand-gold);
  cursor: pointer;
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--brand-gold) 0%, #d9d9d9 100%);
}

.range-values {
  font-size: 16px;
  color: #555;
  text-align: center;
  width: 100%;
  display: block;
  margin-top: 20px;
  direction: ltr;
}

/* هم‌راستایی تیک‌ها */
.size-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 13px;
}

/* ==========================================
   اسلایدرِ دوبل: بدون حلقه سفید + هم‌مرکزی کامل
========================================== */
.range-wrapper{
  position: relative;
  width: 100%;
  height: 20px;
  margin-top: 6px;
  direction: ltr;
}

/* ترک خاکستری سفارشی در مرکز */
.range-wrapper::before{
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: #ddd;
  border-radius: 999px;
}

/* خط طلایی بین دو دسته ـ دقیقاً وسط */
.range-wrapper .progress{
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1px;
  width: 0%;
  background: var(--brand-gold);
  border-radius: 999px;
  z-index: 1;
}

/* دو input روی هم؛ فقط شَست‌ها قابل کلیک‌اند */
.range-wrapper input[type="range"]{
  position: absolute;
  inset: 0;
  width: 100%;
  background: none !important;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  z-index: 2;
}

/* پنهان‌کردن ریل پیش‌فرض مرورگر */
.range-wrapper input[type="range"]::-webkit-slider-runnable-track{ 
  background: transparent; height: 6px; border: 0; 
}
.range-wrapper input[type="range"]::-moz-range-track{ 
  background: transparent; height: 6px; border: 0; 
}

/* شَست‌ها — بدون حلقه/شیار سفید */
.range-wrapper input[type="range"]::-webkit-slider-thumb{
  pointer-events: all;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--brand-gold);
  border: none;
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  margin-top: 0;
}
.range-wrapper input[type="range"]::-moz-range-thumb{
  pointer-events: all;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--brand-gold);
  border: none;
  cursor: pointer;
}

/* افکت هاور */
.range-wrapper input[type="range"]:focus::-webkit-slider-thumb,
.range-wrapper input[type="range"]::-webkit-slider-thumb:hover{
  box-shadow: 0 2px 4px rgba(0,0,0,.22);
}
.range-wrapper input[type="range"]:focus::-moz-range-thumb,
.range-wrapper input[type="range"]::-moz-range-thumb:hover{
  box-shadow: 0 2px 4px rgba(0,0,0,.22);
}

.shape-option {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.shape-option img {
  width: 48px;
  height: 48px;
  object-fit: contain; 
  display: inline-block;
}

/* مستطیلی‌کردن آیکن‌های شکل (کات از بالا/پایین) */
#flt-shape .shape-option img{
  width: 48px;
  height: 26px;
  object-fit: contain;
  object-position: center;
  display: block;
  flex-shrink: 0;
}

/* کمی فاصله کمتر */
#flt-shape .shape-option{
  margin: 2px 0;
  gap: 6px;
}

/* فقط برای فیلتر نوع ریم */
#flt-rim .flt-opt{
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

#flt-rim .flt-icon{
  width: 48px;
  height: 26px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
}

/* اعدادِ قیمت بالای خط */
#flt-price .custom-slider{ padding-top: 6px; }

#flt-price .range-values--top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}

/* خط تیره وسط */
#flt-price .range-values--top .dash{
  opacity: .6;
  flex: 0 0 auto;
}

/* ====== Color filter ====== */

/* 1) چیدمان */
#flt-colors .color-swatches{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:10px 0 2px;
}

#flt-colors .swatch{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border-radius:999px;
}

/* چک‌باکس پنهان */
#flt-colors .swatch input[type="checkbox"]{
  position:absolute;
  width:1px;height:1px;
  margin:-1px;padding:0;border:0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow:hidden;
  white-space:nowrap;
  opacity:0;
  appearance:none;
  -webkit-appearance:none;
}

/* دات اصلی */
#flt-colors .swatch .dot{
  width:22px;
  height:22px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.18);
  cursor:pointer;
  position:relative;
  overflow:hidden;

  box-shadow:
    0 2px 6px rgba(0,0,0,.10),
    inset 0 0 0 1px rgba(255,255,255,.55);

  transition: transform .15s ease, box-shadow .15s ease;
}

/* افکت نور */
#flt-colors .swatch .dot::before{
  content:"";
  position:absolute;
  inset:-2px;
  border-radius:999px;
  background: radial-gradient(circle at 30% 30%,
    rgba(255,255,255,.70) 0%,
    rgba(255,255,255,.25) 25%,
    rgba(255,255,255,0) 60%);
  opacity:.9;
  pointer-events:none;
}

#flt-colors .swatch:hover .dot{
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 4px 12px rgba(0,0,0,.14),
    inset 0 0 0 1px rgba(255,255,255,.65);
}

/* انتخاب‌شده: رینگ دو لایه */
#flt-colors .swatch.is-active .dot{
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow:
    0 0 0 2px #111,
    0 0 0 4px var(--brand-gold, #2ec4b6),
    0 6px 14px rgba(0,0,0,.14);
}

/* Tooltip فارسی از data-label */
#flt-colors .swatch .dot::after{
  content: attr(data-label);
  position:absolute;
  top: 140%;
  left:50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  background: #111;
  color:#fff;
  padding: 4px 8px;
  border-radius: 10px;
  opacity: 0;
  pointer-events:none;
  transition: opacity .12s ease;
  z-index: 9999;
}
#flt-colors .swatch:hover .dot::after,
#flt-colors .swatch:focus-within .dot::after{
  opacity: 1;
}

/* شفاف */
#flt-colors .dot.dot--transparent{
  background-image:
    linear-gradient(45deg,#cfcfcf 25%,transparent 25%),
    linear-gradient(-45deg,#cfcfcf 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#cfcfcf 75%),
    linear-gradient(-45deg,transparent 75%,#cfcfcf 75%);
  background-size:8px 8px;
  background-position:0 0,0 4px,4px -4px,-4px 0;
}

/* پلنگی/تورتویز */
#flt-colors .dot.dot--pattern{
  background-image:
    radial-gradient(circle at 30% 30%, rgba(0,0,0,.18) 0 18%, transparent 19%),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,.14) 0 16%, transparent 17%),
    radial-gradient(circle at 55% 25%, rgba(0,0,0,.10) 0 14%, transparent 15%);
  background-color: #c79a63;
}

/* ==========================================================================
   فیلترهای چسبان (Sticky Filters) - دسکتاپ (چسبان تا انتهای گرید محصولات)
   ========================================================================== */
@media (min-width: 992px) {
  .filters {
    position: sticky;
    top: calc(var(--header-h, 110px) + 20px);
    z-index: 5;
    align-self: flex-start;
    max-height: none;
    overflow: visible;
    padding-bottom: 20px;
    box-sizing: border-box;
  }
}

.filters-mobile-header {
  display: none;
}
.filters-backdrop {
  display: none;
}

@media (max-width: 991px) {
  .filters {
    position: fixed;
    top: 0;
    right: -320px; /* Hidden initially */
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    z-index: 10000000; /* High index to cover everything */
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0; /* Reset padding */
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .filters.is-open {
    right: 0;
  }

  .filters-form {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 80px 20px; /* Padding for scrollable area */
  }

  .filters-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border, #e5e5e5);
    background: #fff;
    flex-shrink: 0;
    z-index: 2;
  }

  .filters-mobile-title {
    font-size: 15px;
    font-weight: 800;
    color: #111;
  }

  .filters-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #555;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
  }

  .filters-close-btn:hover {
    color: #ef4444;
  }

  .filters-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9999999; /* Just below drawer */
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    pointer-events: none;
  }

  .filters-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s ease, visibility 0s;
  }

  /* Prevent page scroll when filter drawer is open */
  body.filters-open-active {
    overflow: hidden !important;
  }
}


