/**
 * HyperMarket M3 — Infinite Scroll Styles
 * فایل: assets/css/infinite-scroll.css
 * (یا به انتهای layout.css اضافه کنید)
 */

/* ── تریگر container ── */
#hm-infinite-trigger {
  width: 100%;
  padding: 8px 0 32px;
  min-height: 4px; /* حداقل ارتفاع برای IntersectionObserver */
}

/* ── Skeleton Grid ── */
.hm-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(var(--shop-cols, 2), 1fr);
  gap: var(--gap, 12px);
  width: 100%;
  margin-top: 8px;
}

.hm-skeleton-card {
  background: var(--surface, #fff);
  border-radius: var(--rad, 16px);
  padding: 12px;
  overflow: hidden;
}

/* shimmer animation */
@keyframes hm-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.hm-sk {
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(0,0,0,.06) 25%,
    rgba(0,0,0,.03) 50%,
    rgba(0,0,0,.06) 75%
  );
  background-size: 800px 100%;
  animation: hm-shimmer 1.4s infinite linear;
}

.hm-sk--img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  margin-bottom: 10px;
}

.hm-sk--title {
  height: 14px;
  width: 80%;
  margin-bottom: 8px;
}

.hm-sk--price {
  height: 14px;
  width: 50%;
  margin-bottom: 12px;
}

.hm-sk--btn {
  height: 38px;
  border-radius: var(--radf, 999px);
}

/* ── دکمه fallback ── */
.hm-load-more-btn {
  display: block;
  margin: 16px auto 0;
  min-width: 160px;
}

/* ── حذف pagination اصلی WooCommerce ── */
.hm-shop-page__pagination,
.woocommerce-pagination,
nav.woocommerce-pagination {
  display: none !important;
}

/* ── حذف result count ── */
.hm-shop-page__result-count,
.woocommerce-result-count {
  display: none !important;
}


/* ═══════════════════════════════════════
   Chip های دسته‌بندی — بزرگ‌تر با آیکون
   ═══════════════════════════════════════ */

.hm-shop-page__chips {
  display: flex;
  gap: 8px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hm-shop-page__chips::-webkit-scrollbar { display: none }

/* chip پایه */
.hm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  border-radius: 999px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid rgba(0,0,0,.1);
  background: #fff;
  color: var(--on-surface, #1a1a2e);
  transition: background .2s, border-color .2s, transform .15s;
  scroll-snap-align: start;
  /* سایز پایه — کوچک */
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* chip بزرگ با آیکون — کلاس hm-chip--lg */
.hm-chip.hm-chip--lg {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 14px 8px;
  min-width: 68px;
  border-radius: 16px;        /* گوشه‌های چهارگوش‌تر برای سایز بزرگتر */
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1px;
}

/* آیکون — تصویر */
.hm-chip__ico--img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: rgba(0,0,0,.05);
}

/* آیکون — emoji */
.hm-chip__ico--all,
.hm-chip__ico--fallback {
  font-size: 26px;
  line-height: 1;
  display: block;
}

/* لیبل */
.hm-chip__label {
  display: block;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* حالت active */
.hm-chip--active {
  background: var(--primary, #1a1a2e);
  color: #fff;
  border-color: var(--primary, #1a1a2e);
}

.hm-chip--active .hm-chip__ico--img {
  outline: 2px solid rgba(255,255,255,.6);
  outline-offset: 1px;
}

/* hover */
.hm-chip:not(.hm-chip--active):hover {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.18);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════
   تب‌بار دسته‌های اصلی
══════════════════════════════════════════ */
/* ══════════════════════════════════════════
   تب‌بار دسته‌های اصلی
══════════════════════════════════════════ */
.hm-cattabs {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;          /* آیتم active داخل کادر بماند */
  scrollbar-width: none;
  border-bottom: none;
  padding: 9px 12px 8px;
  position: relative;
  background: var(--surface, #fff);
  /* کادر واقعی با border و border-radius */
  border: 1.5px solid rgba(0,0,0,.08);
  border-radius: 16px;
  margin: 8px 12px 2px;
}
.hm-cattabs::-webkit-scrollbar { display: none }

.hm-cattab {
  flex-shrink: 0;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(0,0,0,.5);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  border: 1.5px solid transparent;
  transition: color .2s ease, background .18s ease, border-color .18s ease;
  position: relative;
}
.hm-cattab--active {
  color: #fff;
  font-weight: 800;
  background: var(--primary, #1a1a2e);
  border-color: var(--primary, #1a1a2e);
}
.hm-cattab:not(.hm-cattab--active):hover {
  color: rgba(0,0,0,.72);
  background: rgba(0,0,0,.04);
}

/* ══════════════════════════════════════════
   زیردسته‌ها — pill با گوشه کرد‌تر
══════════════════════════════════════════ */
.hm-subcats {
  display: flex;
  gap: 6px;
  padding: 7px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--surface, #fff);
  border: 1.5px solid rgba(0,0,0,.08);
  border-radius: 16px;
  margin: 0 12px 2px;
}
.hm-subcats::-webkit-scrollbar { display: none }

/* انیمیشن ظاهر شدن subcats */
.hm-subcats {
  animation: hmSubcatsFade .22s ease both;
}
@keyframes hmSubcatsFade {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hm-subcat {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 5px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(0,0,0,.55);
  text-decoration: none;
  border: 1.5px solid rgba(0,0,0,.1);
  background: transparent;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .15s;
}
.hm-subcat--active {
  background: var(--primary, #1a1a2e);
  color: #fff;
  border-color: var(--primary, #1a1a2e);
}
.hm-subcat:not(.hm-subcat--active):hover {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.18);
}
.hm-subcat:active { transform: scale(.97); }

/* ══════════════════════════════════════════
   Loading overlay — جابجایی مینیمال بین دسته‌ها
══════════════════════════════════════════ */
@keyframes hmPageFadeOut {
  from { opacity: 1;   filter: blur(0); }
  to   { opacity: .25; filter: blur(1px); }
}
@keyframes hmPageFadeIn {
  from { opacity: .2; transform: translateY(10px); filter: blur(1.5px); }
  to   { opacity: 1;  transform: translateY(0);    filter: blur(0); }
}
.hm-products-grid--loading {
  pointer-events: none;
  animation: hmPageFadeOut .22s cubic-bezier(.4,0,.6,1) forwards;
}
.hm-products-grid--loaded {
  animation: hmPageFadeIn .35s cubic-bezier(.2,.8,.4,1) both;
}
/* نوار لود روی تب‌بار */
.hm-cattabs::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 0; height: 3px;
  background: var(--primary, #1a1a2e);
  opacity: 0;
  border-radius: 0 0 16px 16px;
  transition: none;
}
.hm-cattabs--loading::after {
  width: 100%;
  opacity: .45;
  transition: width .55s cubic-bezier(.4,0,.2,1), opacity .15s;
}

/* ══════════════════════════════════════════
   Sort bar + Pill
══════════════════════════════════════════ */
.hm-sort-bar {
  display: flex;
  align-items: center;
  padding: 8px 14px 4px;
}

.hm-sort-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,.13);
  background: var(--surface, #fff);
  color: var(--on-surface, #1a1a2e);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
}
.hm-sort-pill:hover { background: rgba(0,0,0,.05); }
.hm-sort-pill svg { flex-shrink: 0; opacity: .7 }
.hm-sort-pill__chevron {
  transition: transform .2s;
  opacity: .5;
}
.hm-sort-pill[aria-expanded="true"] .hm-sort-pill__chevron {
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════
   Sort Bottom Sheet
══════════════════════════════════════════ */
.hm-sort-sheet {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
}
.hm-sort-sheet:not([hidden]) {
  pointer-events: auto;
}

.hm-sort-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.38);
  opacity: 0;
  transition: opacity .25s;
}
.hm-sort-sheet:not([hidden]) .hm-sort-sheet__backdrop {
  opacity: 1;
}

.hm-sort-sheet__panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  max-height: 65vh;
  overflow-y: auto;
}
.hm-sort-sheet:not([hidden]) .hm-sort-sheet__panel {
  transform: translateY(0);
}

.hm-sort-sheet__handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,.15);
  margin: 12px auto 4px;
}
.hm-sort-sheet__title {
  font-size: 13px;
  font-weight: 800;
  color: var(--on-surface-variant, #888);
  text-align: center;
  padding: 4px 20px 12px;
  letter-spacing: .3px;
}
.hm-sort-sheet__list {
  list-style: none;
  padding: 0 8px;
}

.hm-sort-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--on-surface, #1a1a2e);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
}
.hm-sort-opt:hover { background: rgba(0,0,0,.05); }
.hm-sort-opt--active {
  color: var(--primary, #1a1a2e);
  font-weight: 800;
  background: rgba(0,0,0,.04);
}
.hm-sort-opt__check { flex-shrink: 0; color: var(--primary, #1a1a2e); }

/* حذف select پیش‌فرض WooCommerce */
.woocommerce-ordering { display: none !important; }

/* ══════════════════════════════════════════
   Scroll active tab to center
   (این کار را JS انجام می‌دهد — CSS فقط smooth scroll)
══════════════════════════════════════════ */
.hm-cattabs,
.hm-subcats {
  scroll-behavior: smooth;
}

/* ══════════════════════════════════════════
   صفحه ورود / ثبت‌نام — hm-auth
══════════════════════════════════════════ */
.hm-auth {
  max-width: 400px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* هدر */
.hm-auth__hero {
  text-align: center;
  padding: 12px 0 20px;
}
.hm-auth__logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 20px;
  margin: 0 auto 8px;
  display: block;
}
.hm-auth__logo-text {
  font-size: 22px;
  font-weight: 900;
  color: var(--p, #1a1a2e);
  display: block;
  margin-bottom: 6px;
}
.hm-auth__tagline {
  font-size: 13px;
  color: var(--tl, #9090b0);
}

/* نوتیس */
.hm-auth__notices {
  margin-bottom: 4px;
}

/* تب‌ها */
.hm-auth__tabs {
  display: flex;
  gap: 0;
  background: rgba(0,0,0,.05);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 22px;
  position: relative;
}
.hm-auth__tab {
  flex: 1;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  color: rgba(0,0,0,.45);
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: color .2s;
  position: relative;
  z-index: 1;
}
.hm-auth__tab--active {
  color: var(--p, #1a1a2e);
}
.hm-auth__tab-ink {
  position: absolute;
  top: 4px; bottom: 4px;
  right: 4px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  transition: right .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
  z-index: 0;
}

/* پنل */
.hm-auth__panel { display: none; }
.hm-auth__panel--active { display: block; }

/* فیلد */
.hm-auth__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.hm-auth__field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ts, #555577);
}
.hm-auth__optional {
  font-weight: 400;
  color: var(--tl, #9090b0);
  font-size: 11px;
}
.hm-auth__input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.04);
  border: 1.5px solid rgba(0,0,0,.09);
  border-radius: 14px;
  padding: 0 14px;
  transition: border-color .18s, background .18s;
}
.hm-auth__input-wrap:focus-within {
  border-color: var(--p, #1a1a2e);
  background: #fff;
}
.hm-auth__input-wrap .material-symbols-rounded {
  font-size: 18px;
  color: var(--tl, #9090b0);
  flex-shrink: 0;
}
.hm-auth__input-wrap .hm-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 13px 0;
  font-size: 14px;
  font-family: inherit;
  color: var(--p, #1a1a2e);
  outline: none;
  direction: rtl;
}
.hm-auth__input-wrap .hm-input::placeholder {
  color: var(--tl, #9090b0);
  font-weight: 400;
}

/* toggle رمز */
.hm-auth__pw-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--tl, #9090b0);
  display: flex;
  align-items: center;
}
.hm-auth__pw-toggle .material-symbols-rounded { font-size: 18px; }

/* hint */
.hm-auth__field-hint {
  font-size: 11.5px;
  color: var(--g, #16a34a);
  font-weight: 600;
  padding: 0 2px;
}
.hm-auth__info-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ts, #555577);
  background: rgba(0,0,0,.04);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.hm-auth__info-note .material-symbols-rounded { font-size: 16px; }

/* ردیف remember + forgot */
.hm-auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.hm-auth__remember {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ts, #555577);
  cursor: pointer;
}
.hm-auth__remember input { accent-color: var(--p, #1a1a2e); }
.hm-auth__forgot {
  font-size: 12.5px;
  color: var(--p, #1a1a2e);
  font-weight: 700;
  text-decoration: none;
}
.hm-auth__forgot:hover { text-decoration: underline; }

/* دکمه اصلی */
.hm-auth__form .hm-btn--full {
  width: 100%;
  margin-top: 4px;
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* switch */
.hm-auth__switch {
  text-align: center;
  font-size: 13px;
  color: var(--ts, #555577);
  margin-top: 18px;
}
.hm-auth__switch-btn {
  background: none;
  border: none;
  color: var(--p, #1a1a2e);
  font-weight: 800;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* حذف متن حریم خصوصی WooCommerce */
.woocommerce-privacy-policy-text,
.woocommerce-privacy-policy-link,
p.woocommerce-privacy-policy-text {
  display: none !important;
}
