/* ==========================================================================
   DahuaNet — pages/shop.css
   فهرست محصولات، دسته و برند: سربرگ، نوار فیلتر (ستون کناری / کشو)، نوار ابزار، شبکه‌ی محصولات.
   ========================================================================== */

/* ---------- سربرگ ---------- */
.shop-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.shop-head::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 420px;
  height: 420px;
  inset-inline-end: -140px;
  top: -200px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 32px, rgba(46, 139, 255, .07) 32px 33px);
}
.shop-head h1 { font-size: var(--fs-3xl); }
.shop-head__cats { margin-top: 8px; }
.chip__img { width: 22px; height: 22px; object-fit: contain; }

/* ---------- چیدمان ---------- */
.shop {
  display: grid;
  gap: 28px;
  align-items: start;
  padding-block: 28px 0;
}
@media (min-width: 961px) {
  .shop { grid-template-columns: 280px minmax(0, 1fr); }
}

/* ---------- نوار فیلتر ---------- */
.filters { display: grid; gap: 10px; align-content: start; }
.filter {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
}
.filter > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  font-size: var(--fs-sm);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.filter > summary::-webkit-details-marker { display: none; }
.filter__title { display: inline-flex; align-items: center; gap: 8px; flex: 1; }
.filter__title .icon { color: var(--primary); }
.filter__chevron { color: var(--fg-subtle); transition: transform var(--dur-2) var(--ease); }
.filter[open] .filter__chevron { transform: rotate(180deg); }
.filter__body { display: grid; gap: 4px; padding: 0 16px 14px; }
.filter__body--scroll { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.filter__option { padding: 5px 0; }
.filter__option.is-child { padding-inline-start: 22px; font-size: var(--fs-xs); color: var(--fg-muted); }
.filter--toggles { display: grid; gap: 12px; padding: 14px 16px; }
.filter__price { grid-template-columns: 1fr 1fr; gap: 10px; }
.filter__price .input { min-height: 44px; }
.filter__body--swatches { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.swatch { display: grid; justify-items: center; gap: 4px; font-size: var(--fs-2xs); cursor: pointer; }
.swatch__dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 3px var(--bg), 0 0 0 4px var(--line);
  transition: box-shadow var(--dur-2);
}
.swatch input:checked + .swatch__dot { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 3px var(--bg), 0 0 0 5px var(--azure); }
.swatch input:focus-visible + .swatch__dot { outline: 2px solid var(--azure); outline-offset: 5px; }
.filters__actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-block: 12px 4px;
  background: linear-gradient(transparent, var(--bg) 30%);
}
.shop__filters-close, .shop__filters-head { display: none; }

/* در دسکتاپ کشو نیست: ستون چسبان کناری */
@media (min-width: 961px) {
  .shop__filters.drawer {
    position: sticky;
    top: calc(var(--header-h) + 76px);
    z-index: 1;
    display: block;
    width: auto;
    max-height: calc(100vh - var(--header-h) - 96px);
    overflow-y: auto;
    padding: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
    visibility: visible;
    transition: none;
    scrollbar-width: thin;
  }
  .shop__filters .drawer__body { padding: 0 0 8px; overflow: visible; }
  .shop__filter-btn { display: none; }
}
@media (max-width: 960px) {
  .shop__filters-head, .shop__filters-close { display: flex; }
  .shop__filters .filters { padding-bottom: 0; }
}

/* ---------- نوار ابزار ---------- */
.shop__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
}
.shop__count { color: var(--fg-muted); font-size: var(--fs-sm); }
.shop__count strong { color: var(--fg); }
.sort { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.sort__label { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-subtle); font-size: var(--fs-xs); font-weight: 700; }
.sort__links { display: flex; flex-wrap: wrap; gap: 2px; }
.sort__links a {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  color: var(--fg-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: background var(--dur-2), color var(--dur-2);
}
.sort__links a:hover { color: var(--fg); background: var(--bg-soft); }
.sort__links a[aria-current] { background: var(--bg-tint); color: var(--primary); }
.sort__select { display: none; min-height: 40px; width: auto; padding-block: 6px; font-size: var(--fs-sm); }
@media (max-width: 1180px) {
  /* بدون جاوااسکریپت پیوندها می‌مانند؛ با آن فهرست کشویی جایشان را می‌گیرد */
  .js .sort__links, .js .sort__label { display: none; }
  .js .sort__select { display: block; }
}

.shop__active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.chip--removable { min-height: 34px; padding: 4px 12px; background: var(--bg-tint); border-color: transparent; color: var(--primary); font-size: var(--fs-xs); }
.chip--removable .icon { color: var(--primary); }
.chip--removable:hover { background: var(--danger-bg); color: var(--danger); }
.chip--removable:hover .icon { color: var(--danger); }

/* ---------- شبکه‌ی محصولات ---------- */
.product-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 420px) {
  .product-grid { gap: 10px; }
  .product-grid .p-card { padding: 6px 6px 10px; border-radius: var(--r); }
  .product-grid .p-card__specs, .product-grid .p-card__model { display: none; }
  .product-grid .price strong { font-size: var(--fs-md); }
  .product-grid .btn-add { width: 36px; height: 36px; }
}
.product-grid + .pager { margin-top: 32px; }

/* ---------- حالت خالی ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: clamp(36px, 6vw, 72px) 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-xl);
  text-align: center;
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--bg-tint);
  color: var(--primary);
}
.empty__icon .icon { width: 36px; height: 36px; }
.empty p { color: var(--fg-muted); max-width: 48ch; }

/* ---------- مقایسه ---------- */
.compare-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--bg); }
.compare { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.compare th, .compare td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.compare thead th { position: sticky; top: 0; background: var(--bg); vertical-align: bottom; }
.compare tbody th { width: 180px; color: var(--fg-muted); font-weight: 700; background: var(--bg-soft); }
.compare tbody tr:hover td { background: var(--bg-soft); }
.compare__product { display: grid; gap: 8px; justify-items: start; min-width: 180px; }
.compare__product img { width: 120px; height: 120px; object-fit: contain; border-radius: var(--r); background: var(--grad-media); }
.compare__product a { font-weight: 800; line-height: 1.7; }
.compare__product a:hover { color: var(--primary); }
.compare__diff td { color: var(--fg); font-weight: 700; }
