/* ===== Product listing page (TopRayan-like) ===== */

.h1-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 12px 0 8px;
}

.bread-crumb {
  margin-bottom: 12px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-left: 6px;
  margin-right: 2px;
  color: #bbb;
}

.breadcrumb-item a {
  color: var(--muted);
}

.breadcrumb-item a:hover,
.breadcrumb-item.active a {
  color: var(--red);
}

.hashtag-top {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 14px;
}

.hashtag-top a {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e6e6e6;
  color: #333;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
}

body.night .hashtag-top a {
  background: var(--surface);
  border-color: #444;
  color: #ddd;
}

.hashtag-top a:hover {
  border-color: var(--red);
  color: var(--red);
}

/* Listing layout */
.listing {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 40px;
}

.listing.search-listing {
  grid-template-columns: 1fr;
}

@media (max-width: 991px) {
  .listing {
    grid-template-columns: 1fr;
  }
}

#sidebar-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px 14px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

@media (max-width: 991px) {
  #sidebar-wrapper {
    position: static;
    max-height: none;
    display: none;
  }

  #sidebar-wrapper.mobile-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 2200;
    overflow-y: auto;
    border-radius: 0;
    padding: 16px 18px 28px;
    max-height: none;
  }

  body.filters-open {
    overflow: hidden;
  }
}

.filter-mobile-btn {
  display: none;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  font-family: inherit;
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 991px) {
  .filter-mobile-btn {
    display: block;
  }
}

.close-filters-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 700;
}

.close-filters-mobile button {
  border: 0;
  background: var(--gray);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
}

@media (max-width: 991px) {
  .close-filters-mobile {
    display: flex;
  }
}

.widget.list {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.widget.list:last-child {
  border-bottom: 0;
}

.open-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
  user-select: none;
  gap: 8px;
}

.open-sub::after {
  content: "▾";
  color: #aaa;
  font-size: 11px;
  transition: transform 0.15s;
}

.open-sub.collapsed::after,
.open-sub:not(.is-open):not(.one-check)::after {
  content: "◂";
  transform: none;
}

.open-sub.is-open::after {
  content: "▾";
}

.open-sub.one-check {
  cursor: default;
  font-weight: 600;
  gap: 10px;
  justify-content: flex-start;
}

.open-sub.one-check::after {
  display: none;
}

.open-sub.one-check label {
  cursor: pointer;
  font-weight: 600;
}

.side-filters {
  padding: 10px 2px 4px;
}

.side-filters.hiden,
.side-filters.collapsed {
  display: none;
}

.side-filters.pd-left {
  padding: 10px 2px 8px;
}

.price-range-texts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.price-range-texts .p-name {
  min-width: 58px;
  color: var(--muted);
  flex-shrink: 0;
}

.price-pick-data {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.price-pick-data input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: inherit;
  direction: ltr;
  text-align: left;
  background: var(--bg);
  color: var(--text);
}

.price-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 8px;
}

.tooman-black::after {
  content: "تومان";
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

#SetPriceFilter,
.btn-danger {
  width: 100%;
  margin-top: 6px;
  border: 0;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  padding: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#SetPriceFilter:hover,
.btn-danger:hover {
  background: var(--red-dark);
}

.brand-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.brand-list.should-scroll {
  max-height: 220px;
  overflow-y: auto;
  padding-left: 2px;
}

.brand-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
}

.brand-list li[hidden] {
  display: none;
}

.brand-list label {
  cursor: pointer;
  color: var(--text);
  line-height: 1.4;
}

.f-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
  flex-shrink: 0;
  cursor: pointer;
}

.widget-search {
  position: relative;
  margin-bottom: 8px;
}

.widget-search input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 7px 34px 7px 10px;
  font-family: inherit;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}

.widget-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  font-size: 12px;
  pointer-events: none;
}

.filter-clear-wrap {
  text-align: center;
  padding-top: 12px;
}

.filter-clear {
  display: inline-block;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 8px 14px;
}

.filter-clear:hover {
  background: #fff5f6;
}

.exist-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
}

/* Main list */
.list-content {
  min-width: 0;
}

.list-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.grid-list-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 13px;
}

.sort-header {
  color: var(--muted);
  margin-left: 6px;
}

.grid-list-buttons label {
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--text);
}

.grid-list-buttons input {
  display: none;
}

.grid-list-buttons input:checked + label {
  background: #f5f5f5;
  color: var(--red);
  font-weight: 600;
}

body.night .grid-list-buttons input:checked + label {
  background: #333;
}

.exist-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.result-count {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Product grid cards for listing */
.gridview .row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 0;
}

@media (min-width: 768px) {
  .gridview .row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .gridview .row {
    grid-template-columns: repeat(4, 1fr);
  }
}

.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.2s;
  height: 100%;
}

.list-card:hover {
  border-color: #ddd;
  background: #fafafa;
}

body.night .list-card:hover {
  background: #2e2e30;
}

.list-card .thumb {
  position: relative;
  display: block;
  padding-bottom: 100%;
  margin: 8px;
}

.list-card .thumb img {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10%;
}

.list-card .body {
  padding: 0 14px 6px;
  flex: 1;
}

.list-card .title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  height: 62px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.list-card .title a {
  color: var(--text);
}

.list-card .title a:hover {
  color: var(--red);
}

.list-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px;
  min-height: 28px;
}

.tag-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #f5f5f5;
  color: #555;
}

.tag-pill.low-stock {
  background: #fff3e0;
  color: #e65100;
}

.tag-pill.gaming {
  background: #fce4ec;
  color: #c2185b;
}

.tag-pill.fast {
  background: #e8f5e9;
  color: #2e7d32;
}

.list-card .price-box {
  padding: 4px 14px 14px;
  text-align: left;
  margin-top: auto;
}

.list-card .price-box .old {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.list-card .price-box del {
  text-decoration: line-through;
}

.list-card .price-now {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.list-card .price-now .unit {
  font-size: 12px;
  font-weight: 400;
}

.list-card .price-now.price-call {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.list-card .add-cart {
  margin: 0 14px 14px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  list-style: none;
  padding: 24px 0 10px;
  margin: 0;
}

.pagination a,
.pagination span {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.pagination .active span,
.pagination a:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.close-filters-mobile {
  display: none;
  margin-bottom: 12px;
}

@media (max-width: 991px) {
  .close-filters-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
  }
}
