/* ========== صفحه فروشگاه — لیست + فیلتر ========== */
:root {
  --shop-red: #ef394e;
  --shop-text: #0c0c0c;
  --shop-muted: #81858b;
  --shop-hint: #a1a3a8;
  --shop-border: #e0e0e2;
  --shop-bg: #f5f5f5;
  --font: "Yekan Bakh", "YekanBakh", Estedad, Vazirmatn, Tahoma, sans-serif;
}

.shop-page {
  margin: 0;
  min-height: 100vh;
  background: var(--shop-bg);
  font-family: var(--font);
  color: var(--shop-text);
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}
.shop-page .site-footer {
  margin-top: 28px;
  margin-bottom: 8px;
}
@media (min-width: 1024px) {
  .shop-page { padding-bottom: 32px; }
}

.shop-page a,
.shop-page button,
.shop-page input,
.shop-page select {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.ti-icon--filter { --ti: url("icons/tabler/list.svg"); }
.ti-icon--arrows-sort { --ti: url("icons/tabler/chevron-down.svg"); }
.ti-icon--chevron-down { --ti: url("icons/tabler/chevron-down.svg"); }
.ti-icon--star { --ti: url("icons/tabler/star.svg"); }

/* —— هدر —— */
.shop-top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid #f0f0f1;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
.shop-top__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
}
.shop-top__back {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--shop-text);
}
.shop-top__back:hover { background: #f5f5f5; }
.shop-top__back .ti-icon {
  width: 22px;
  height: 22px;
  font-size: 22px;
}

.shop-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 9999px;
}
.shop-search:focus-within {
  border-color: #c8c8cc;
  background: #fafafa;
}
.shop-search__ico {
  width: 18px;
  height: 18px;
  font-size: 18px;
  color: var(--shop-hint);
  flex-shrink: 0;
}
.shop-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--shop-text);
}
.shop-search__input::placeholder { color: var(--shop-muted); }
.shop-search__clear {
  border: 0;
  background: #e8e8ea;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #424750;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.shop-search__clear[hidden] { display: none !important; }

.shop-top .header__profile {
  margin-inline-start: 0;
}

/* دسته‌ها */
.shop-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 0 12px;
  -webkit-overflow-scrolling: touch;
}
.shop-cats::-webkit-scrollbar { display: none; }
.shop-cat {
  flex: 0 0 auto;
  border: 1px solid var(--shop-border);
  background: #fff;
  color: #424750;
  border-radius: 9999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.shop-cat.is-active {
  background: #fff1f2;
  border-color: #ef394e;
  color: var(--shop-red);
}

/* —— لایه‌آوت —— */
.shop-layout {
  display: grid;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 24px;
  align-items: start;
}
@media (min-width: 960px) {
  .shop-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
    padding-top: 20px;
  }
}

/* فیلتر دسکتاپ */
.shop-filters {
  display: none;
  background: #fff;
  border: 1px solid #f0f0f1;
  border-radius: 12px;
  padding: 14px;
  position: sticky;
  top: 120px;
}
@media (min-width: 960px) {
  .shop-filters { display: block; }
}
.shop-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.shop-filters__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}
.shop-filters__reset,
.shop-sheet__reset {
  border: 0;
  background: transparent;
  color: var(--shop-red);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.shop-fblock {
  padding: 14px 0;
  border-top: 1px solid #f0f0f1;
}
.shop-fblock h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
}
.shop-checks {
  display: grid;
  gap: 8px;
}
.shop-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #424750;
  cursor: pointer;
  user-select: none;
}
.shop-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--shop-red);
  flex-shrink: 0;
}

.shop-price {
  display: grid;
  gap: 8px;
}
.shop-price label {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--shop-muted);
}
.shop-price input {
  height: 38px;
  border: 1px solid var(--shop-border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  direction: ltr;
  text-align: left;
}

.shop-fblock--toggles {
  display: grid;
  gap: 12px;
}
.shop-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.shop-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--shop-red);
}

/* —— نوار ابزار —— */
.shop-page-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--shop-text, #0c0c0c);
}
.shop-main { min-width: 0; }
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid #f0f0f1;
  border-radius: 12px;
  padding: 10px 12px;
}
.shop-count {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #424750;
  white-space: nowrap;
}
.shop-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* —— مرتب‌سازی حرفه‌ای —— */
.shop-sort {
  position: relative;
  z-index: 20;
}
.shop-sort__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.shop-sort__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 12px 6px 10px;
  border: 1px solid #e8eaee;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f9fb 100%);
  color: var(--shop-text);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease,
    background 0.22s ease;
}
.shop-sort__btn:hover {
  border-color: #d5dde8;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.shop-sort__btn:active {
  transform: translateY(0);
}
.shop-sort.is-open .shop-sort__btn {
  border-color: rgba(25, 191, 211, 0.45);
  box-shadow:
    0 0 0 3px rgba(25, 191, 211, 0.12),
    0 10px 24px rgba(15, 23, 42, 0.08);
  background: #fff;
}
.shop-sort__glyph {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e8f9fc 0%, #d7f3f8 100%);
  color: #0f9aab;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}
.shop-sort.is-open .shop-sort__glyph {
  transform: rotate(-8deg) scale(1.04);
  background: linear-gradient(145deg, #19bfd3 0%, #0ea5b8 100%);
  color: #fff;
}
.shop-sort__bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.5px;
  width: 12px;
  height: 12px;
}
.shop-sort__bars i {
  display: block;
  height: 1.8px;
  border-radius: 99px;
  background: currentColor;
  transform-origin: right center;
}
.shop-sort__bars i:nth-child(1) { width: 100%; }
.shop-sort__bars i:nth-child(2) { width: 72%; }
.shop-sort__bars i:nth-child(3) { width: 44%; }
.shop-sort.is-open .shop-sort__bars i {
  animation: shopSortBars 0.7s ease both;
}
.shop-sort.is-open .shop-sort__bars i:nth-child(2) { animation-delay: 0.06s; }
.shop-sort.is-open .shop-sort__bars i:nth-child(3) { animation-delay: 0.12s; }
@keyframes shopSortBars {
  0% { transform: scaleX(0.55); opacity: 0.55; }
  55% { transform: scaleX(1.08); opacity: 1; }
  100% { transform: scaleX(1); opacity: 1; }
}
.shop-sort__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  text-align: right;
}
.shop-sort__text em {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: #8a9099;
  letter-spacing: -0.01em;
}
.shop-sort__text strong {
  font-size: 12.5px;
  font-weight: 800;
  color: #1f2430;
  line-height: 1.2;
  white-space: nowrap;
}
.shop-sort__chev {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #9aa1ab;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}
.shop-sort__chev .ti-icon {
  width: 16px;
  height: 16px;
  font-size: 16px;
}
.shop-sort.is-open .shop-sort__chev {
  transform: rotate(180deg);
  color: #19bfd3;
}
.shop-sort__menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 100%;
  width: max-content;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid #e7ebf0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.8) inset;
  transform-origin: top right;
  animation: shopSortMenuIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 30;
}
.shop-sort__menu[hidden] {
  display: none !important;
}
@keyframes shopSortMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.shop-sort__opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #2b303b;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.shop-sort__opt:hover {
  background: #f3f7fa;
  transform: translateX(-2px);
}
.shop-sort__opt.is-active {
  background: linear-gradient(90deg, rgba(25, 191, 211, 0.14), rgba(25, 191, 211, 0.05));
  color: #0b7f8f;
}
.shop-sort__opt-ico {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: #eef3f7;
  color: #6b7380;
  flex-shrink: 0;
}
.shop-sort__opt.is-active .shop-sort__opt-ico {
  background: #19bfd3;
  color: #fff;
  animation: shopSortPick 0.35s ease;
}
@keyframes shopSortPick {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.shop-grid.is-sorting {
  animation: shopGridSort 0.38s ease;
}
@keyframes shopGridSort {
  0% { opacity: 0.55; transform: translateY(6px); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shop-sort__btn,
  .shop-sort__glyph,
  .shop-sort__chev,
  .shop-sort__menu,
  .shop-sort__bars i,
  .shop-sort__opt,
  .shop-grid.is-sorting {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 420px) {
  .shop-sort__text em { display: none; }
  .shop-sort__btn {
    min-height: 38px;
    padding: 5px 10px;
    gap: 8px;
  }
  .shop-sort__glyph {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }
}

.shop-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--shop-border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #424750;
  cursor: pointer;
  position: relative;
}
.shop-filter-btn .ti-icon {
  width: 16px;
  height: 16px;
  font-size: 16px;
}
.shop-filter-btn__badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 50px;
  background: var(--shop-red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shop-filter-btn__badge[hidden] { display: none !important; }
@media (min-width: 960px) {
  .shop-filter-btn { display: none; }
}

/* چیپ‌های فعال */
.shop-active {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.shop-active[hidden] { display: none !important; }
.shop-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff1f2;
  color: var(--shop-red);
  border-radius: 9999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
}
.shop-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

/* گرید */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 700px) {
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 1100px) {
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.shop-card {
  background: #fff;
  border: 1px solid #f0f0f1;
  border-radius: 12px;
  overflow: hidden;
  animation: shopCardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes shopCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.shop-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.shop-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #fafafa;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.shop-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.shop-card__badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  background: var(--shop-red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
}
.shop-card__oos {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  color: #757575;
  font-size: 12px;
  font-weight: 800;
}
.shop-card__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--shop-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}
.shop-card__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--shop-muted);
  font-weight: 600;
}
.shop-card__meta .ti-icon {
  width: 12px;
  height: 12px;
  font-size: 12px;
  color: #f9bc00;
}
.shop-card__prices {
  margin-top: auto;
  display: grid;
  gap: 4px;
}
.shop-card__oldrow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}
.shop-card__old {
  font-size: 13px;
  font-weight: 500;
  color: var(--shop-hint);
  text-decoration: line-through;
  direction: ltr;
  unicode-bidi: plaintext;
}
.shop-card__off {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--shop-red);
  border-radius: 6px;
  padding: 2px 7px;
  line-height: 1.3;
}
.shop-card__now {
  display: flex;
  align-items: baseline;
  gap: 5px;
  direction: ltr;
  justify-content: flex-end;
}
.shop-card__now strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--shop-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.shop-card__now span {
  font-size: 13px;
  font-weight: 700;
  color: var(--shop-muted);
}

.shop-empty {
  text-align: center;
  padding: 48px 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #f0f0f1;
}
.shop-empty[hidden] { display: none !important; }
.shop-empty .ti-icon {
  width: 40px;
  height: 40px;
  font-size: 40px;
  color: var(--shop-hint);
  margin-bottom: 10px;
}
.shop-empty p {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: #424750;
}
.shop-empty button {
  border: 0;
  background: var(--shop-red);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

/* شیت موبایل */
.shop-sheet {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.shop-sheet[hidden] { display: none !important; }
.shop-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.shop-sheet__panel {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 18px 18px 0 0;
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  animation: shopSheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes shopSheetUp {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.shop-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f1;
}
.shop-sheet__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}
.shop-sheet__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f5f5f5;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.shop-sheet__close .ti-icon {
  width: 18px;
  height: 18px;
  font-size: 18px;
}
.shop-sheet__body {
  overflow-y: auto;
  padding: 8px 16px 16px;
  -webkit-overflow-scrolling: touch;
}
.shop-sheet__body .shop-fblock:first-child { border-top: 0; }
.shop-sheet__foot {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f0f0f1;
}
.shop-sheet__apply {
  border: 0;
  background: var(--shop-red);
  color: #fff;
  border-radius: 10px;
  height: 46px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.shop-sheet__reset {
  border: 1px solid var(--shop-border);
  background: #fff;
  color: #424750;
  border-radius: 10px;
  height: 46px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

body.is-shop-sheet-open { overflow: hidden; }
