/* =====================================================
   PRODUCTS LIST PAGE — صفحه لیست محصولات
===================================================== */

:root {
  --pl-brand: #b32a65;
  --pl-brand-2: #9a2457;
  --pl-text: #1f1a1e;
  --pl-muted: #7a7080;
  --pl-bg: #ffffff;
  --pl-soft: #faf5f8;
  --pl-border: #eee7ec;
  --pl-radius: 12px;
  --pl-radius-lg: 20px;
  --pl-tr: .25s cubic-bezier(.25, .1, .25, 1);
}

[data-theme="dark"] {
  --pl-bg: #16131a;
  --pl-text: #f8f4f7;
  --pl-muted: #a89ea8;
  --pl-soft: #1e1b22;
  --pl-border: #2a242f;
}

/* ═══════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════ */
.pl-header {
  background: linear-gradient(135deg, #fff2f7 0%, #faf5f8 100%);
  padding: 24px 0 40px;
  border-bottom: 1px solid var(--pl-border);
}

[data-theme="dark"] .pl-header {
  background: linear-gradient(135deg, #241820 0%, #1b1219 100%);
}

.pl-inner {
  width: min(1220px, 94%);
  margin: 0 auto;
  padding: 0 15px;
}

.pl-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--pl-muted);
  padding: 0;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pl-header .breadcrumb a {
  color: var(--pl-muted);
  text-decoration: none;
}

.pl-header .breadcrumb a:hover {
  color: var(--pl-brand);
}

.pl-header .breadcrumb .current {
  color: var(--pl-text);
  font-weight: 600;
}

.pl-head-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pl-title {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--pl-text);
  letter-spacing: -.5px;
}

.pl-count {
  font-size: .88rem;
  color: var(--pl-muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   PAGE
═══════════════════════════════════════════════════════ */
.pl-page {
  background: var(--pl-bg);
  padding: 30px 0 60px;
  min-height: 70vh;
}

.pl-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
  align-items: start;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
.pl-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-head {
  display: none;
}

.filter-box {
  padding: 18px;
  background: var(--pl-soft);
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius);
}

.filter-title {
  margin: 0 0 14px;
  font-size: .92rem;
  font-weight: 800;
  color: var(--pl-text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pl-border);
}

/* دسته‌ها */
.filter-cats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-cats a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--pl-text);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  transition: background .2s ease, color .2s ease;
}

.filter-cats a:hover {
  background: var(--pl-bg);
  color: var(--pl-brand);
}

.filter-cats a.active {
  background: var(--pl-brand);
  color: #fff;
  font-weight: 700;
}

.filter-cats a.active .count {
  background: rgba(255, 255, 255, .25);
  color: #fff;
}

.filter-cats .count {
  font-size: .72rem;
  background: var(--pl-border);
  color: var(--pl-muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-feature-settings: "ss02";
  min-width: 28px;
  text-align: center;
}

/* فیلتر قیمت */
.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.price-inputs input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  background: var(--pl-bg);
  font-family: inherit;
  font-size: .82rem;
  color: var(--pl-text);
  outline: none;
  text-align: center;
  font-feature-settings: "ss02";
  -moz-appearance: textfield;
}

.price-inputs input::-webkit-outer-spin-button,
.price-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.price-inputs input:focus {
  border-color: var(--pl-brand);
}

.price-sep {
  color: var(--pl-muted);
  font-size: .9rem;
}

.quick-prices {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-price {
  display: block;
  padding: 7px 10px;
  font-size: .8rem;
  color: var(--pl-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: 0.2s ease;
}

.quick-price:hover {
  background: var(--pl-bg);
  color: var(--pl-brand);
}

.quick-price.active {
  background: var(--pl-bg);
  color: var(--pl-brand);
  font-weight: 700;
}

/* checkbox */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--pl-text);
  user-select: none;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--pl-brand);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.filter-submit {
  width: 100%;
  height: 44px;
  border: 0;
  background: var(--pl-brand);
  color: #fff;
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease;
}

.filter-submit:hover {
  background: var(--pl-brand-2);
}

.filter-clear {
  display: block;
  text-align: center;
  padding: 10px 0;
  font-size: .82rem;
  color: var(--pl-muted);
  text-decoration: none;
  transition: color .2s ease;
}

.filter-clear:hover {
  color: var(--pl-brand);
}

/* ═══════════════════════════════════════════════════════
   MAIN
═══════════════════════════════════════════════════════ */
.pl-main {
  min-width: 0;
}

/* Sort bar */
.pl-sortbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--pl-soft);
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius);
  flex-wrap: wrap;
}

.filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--pl-border);
  background: var(--pl-bg);
  border-radius: 8px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  color: var(--pl-text);
  cursor: pointer;
}

.sort-chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}

.sort-chips::-webkit-scrollbar { display: none; }

.sort-chip {
  padding: 7px 14px;
  font-size: .82rem;
  color: var(--pl-muted);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: 0.2s ease;
  font-weight: 500;
}

.sort-chip:hover {
  background: var(--pl-bg);
  color: var(--pl-brand);
}

.sort-chip.active {
  background: var(--pl-brand);
  color: #fff;
  font-weight: 700;
}

/* view toggle */
.view-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--pl-bg);
  border: 1px solid var(--pl-border);
  border-radius: 8px;
}

.view-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--pl-muted);
  display: grid;
  place-items: center;
  transition: 0.2s ease;
}

.view-btn:hover {
  color: var(--pl-text);
}

.view-btn.active {
  background: var(--pl-brand);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════
   GRID
═══════════════════════════════════════════════════════ */
.pl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* حالت لیستی */
.pl-grid.view-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.pl-grid.view-list .pl-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: stretch;
}

.pl-grid.view-list .pl-card-image {
  aspect-ratio: 1 / 1;
  border-radius: var(--pl-radius) 0 0 var(--pl-radius);
}

.pl-grid.view-list .pl-card-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pl-grid.view-list .pl-card-title {
  font-size: 1rem;
  -webkit-line-clamp: 1;
  min-height: auto;
}

.pl-grid.view-list .pl-add-btn {
  width: fit-content;
  min-width: 180px;
}

/* ───── کارت ───── */
.pl-card {
  display: flex;
  flex-direction: column;
  background: var(--pl-soft);
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-lg);
  overflow: hidden;
  transition: 0.25s cubic-bezier(.25, .1, .25, 1);
}

.pl-card:hover {
  transform: translateY(-4px);
  border-color: var(--pl-brand);
  box-shadow: 0 18px 36px -18px rgba(179, 42, 101, .28);
}

.pl-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.pl-card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--pl-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.pl-card-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform .4s ease;
}

.pl-card:hover .pl-card-image img {
  transform: scale(1.06);
}

.pl-no-img {
  font-size: 3rem;
  opacity: .3;
}

/* بج تخفیف */
.pl-discount {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #d7194b;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  padding: 3px 9px 4px;
  border-radius: 999px;
  letter-spacing: .3px;
  z-index: 2;
  font-feature-settings: "ss02";
}

/* بج محصول */
.pl-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--pl-brand);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  padding: 3px 9px 4px;
  border-radius: 999px;
  z-index: 2;
}

/* ناموجود */
.pl-out {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d7194b;
  font-weight: 800;
  font-size: .9rem;
  z-index: 3;
}

[data-theme="dark"] .pl-out {
  background: rgba(18, 16, 20, .8);
}

/* ───── بدنه کارت ───── */
.pl-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.pl-card-cat {
  font-size: .68rem;
  color: var(--pl-muted);
  text-decoration: none;
  font-weight: 600;
  transition: color .2s ease;
}

.pl-card-cat:hover { color: var(--pl-brand); }

.pl-card-title-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.pl-card-title {
  margin: 0;
  font-size: .88rem;
  font-weight: 800;
  color: var(--pl-text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.65em;
  transition: color .2s ease;
}

.pl-card:hover .pl-card-title { color: var(--pl-brand); }

/* قیمت */
.pl-card-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

.pl-card-price del {
  font-size: .72rem;
  color: #b8aeba;
  text-decoration: line-through;
  font-feature-settings: "ss02";
}

.pl-card-price strong {
  font-size: .98rem;
  font-weight: 800;
  color: var(--pl-brand);
  font-feature-settings: "ss02";
}

.pl-card-price strong span {
  font-size: .68rem;
  font-weight: 500;
  color: var(--pl-muted);
  margin-right: 2px;
}

/* دکمه سبد */
.pl-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  margin-top: 4px;
  border: 0;
  border-radius: 10px;
  background: var(--pl-brand);
  color: #fff;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.25s ease;
  flex-shrink: 0;
}

.pl-add-btn:hover {
  background: var(--pl-brand-2);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -6px rgba(179, 42, 101, .5);
}

.pl-add-btn.disabled,
.pl-add-btn:disabled {
  background: var(--pl-border);
  color: var(--pl-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.pl-add-btn.is-loading {
  pointer-events: none;
  opacity: .75;
}

.pl-add-btn.is-done {
  background: #27ae60;
}

/* ═══════════════════════════════════════════════════════
   EMPTY
═══════════════════════════════════════════════════════ */
.pl-empty {
  text-align: center;
  padding: 80px 20px;
  background: var(--pl-soft);
  border-radius: var(--pl-radius-lg);
  border: 1px dashed var(--pl-border);
}

.pl-empty-icon {
  font-size: 4rem;
  opacity: .35;
  margin-bottom: 16px;
}

.pl-empty h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--pl-text);
}

.pl-empty p {
  margin: 0 0 20px;
  font-size: .88rem;
  color: var(--pl-muted);
}

.pl-empty-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--pl-brand);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 700;
  transition: background .2s ease;
}

.pl-empty-btn:hover {
  background: var(--pl-brand-2);
}

/* ═══════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════ */
.pl-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.pg-btn,
.pg-num {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--pl-soft);
  border: 1px solid var(--pl-border);
  color: var(--pl-text);
  text-decoration: none;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  transition: 0.2s ease;
  font-feature-settings: "ss02";
}

.pg-btn:hover:not(.disabled),
.pg-num:hover {
  background: var(--pl-brand);
  color: #fff;
  border-color: var(--pl-brand);
}

.pg-num.active {
  background: var(--pl-brand);
  color: #fff;
  border-color: var(--pl-brand);
  font-weight: 800;
}

.pg-btn.disabled {
  opacity: .35;
  cursor: not-allowed;
}

.pg-dots {
  padding: 0 4px;
  color: var(--pl-muted);
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR OVERLAY (موبایل)
═══════════════════════════════════════════════════════ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  z-index: 998;
  display: none;
}

.sidebar-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .pl-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pl-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 88vw;
    height: 100dvh;
    background: var(--pl-bg);
    padding: 20px;
    overflow-y: auto;
    transition: right .35s cubic-bezier(.25, .1, .25, .1);
    z-index: 999;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .15);
    top: 0;
    display: block;
    gap: 0;
  }

  .pl-sidebar.is-open {
    right: 0;
  }

  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--pl-border);
  }

  .sidebar-head-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--pl-text);
  }

  .sidebar-close {
    width: 34px;
    height: 34px;
    border: 0;
    background: var(--pl-soft);
    border-radius: 10px;
    font-size: 18px;
    line-height: 1;
    color: var(--pl-text);
    cursor: pointer;
  }

  .filter-toggle {
    display: inline-flex;
  }

  .sidebar-overlay {
    display: block;
  }

  .filter-box + .filter-box { margin-top: 12px; }
  .filters-form { display: block; }

  .pl-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .pl-header {
    padding: 16px 0 28px;
  }

  .pl-title {
    font-size: 1.3rem;
  }

  .pl-count {
    font-size: .78rem;
  }

  .pl-page {
    padding: 20px 0 40px;
  }

  .pl-sortbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .sort-chip {
    padding: 6px 10px;
    font-size: .75rem;
  }

  .view-toggle {
    display: none;
  }

  .pl-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .pl-grid.view-list .pl-card {
    grid-template-columns: 100px 1fr;
  }

  .pl-card-body {
    padding: 10px 12px 12px;
    gap: 6px;
  }

  .pl-card-title {
    font-size: .82rem;
    min-height: 2.55em;
  }

  .pl-card-price strong {
    font-size: .88rem;
  }

  .pl-card-price del {
    font-size: .68rem;
  }

  .pl-add-btn {
    height: 34px;
    font-size: .72rem;
    gap: 4px;
  }

  .pl-add-btn svg {
    width: 13px;
    height: 13px;
  }

  .pg-btn,
  .pg-num {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: .8rem;
  }
}

@media (max-width: 380px) {
  .pl-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .pl-card-body {
    padding: 8px 10px 10px;
  }

  .pl-card-title { font-size: .78rem; }
  .pl-card-price strong { font-size: .82rem; }
  .pl-add-btn { font-size: .68rem; padding: 0 8px; }
}

/* ═══════════════════════════════════════════════════════
   DARK MODE
═══════════════════════════════════════════════════════ */
[data-theme="dark"] .pl-card-image {
  background: #191620;
}

[data-theme="dark"] .filter-cats a.active {
  background: var(--pl-brand);
}

[data-theme="dark"] .pl-empty {
  background: #1e1b22;
}