/* Category picker modal — home header */
.hp-cat-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hp-cat-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.hp-cat-modal__sheet {
  background: var(--hp-surface, #fff);
  color: var(--hp-text, #1e293b);
  width: 100%;
  max-width: 520px;
  max-height: min(85vh, 640px);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.hp-cat-modal.is-open .hp-cat-modal__sheet {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .hp-cat-modal {
    align-items: center;
    padding: 20px;
  }
  .hp-cat-modal__sheet {
    border-radius: 20px;
    max-height: min(80vh, 600px);
    transform: translateY(16px) scale(0.96);
    opacity: 0;
  }
  .hp-cat-modal.is-open .hp-cat-modal__sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.hp-cat-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--hp-border, #edf2f7);
  flex-shrink: 0;
}

.hp-cat-modal__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.hp-cat-modal__close {
  border: none;
  background: var(--hp-surface-2, #f1f5f9);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--hp-text);
  font-size: 1.1rem;
}

.hp-cat-modal__breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px 10px;
  font-size: 0.8rem;
  color: var(--hp-text-muted);
  flex-shrink: 0;
}

.hp-cat-modal__breadcrumb button {
  border: none;
  background: none;
  color: var(--hp-accent);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
}

.hp-cat-modal__body {
  overflow-y: auto;
  padding: 8px 12px 20px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

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

.hp-cat-list li {
  margin-bottom: 6px;
}

.hp-cat-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--hp-border);
  border-radius: 12px;
  background: var(--hp-surface);
  color: var(--hp-text);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: right;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.hp-cat-item:hover,
.hp-cat-item:focus-visible {
  border-color: var(--hp-accent-border);
  background: var(--hp-accent-soft);
  outline: none;
}

.hp-cat-item--all {
  font-weight: 700;
  color: var(--hp-accent);
}

.hp-cat-item i {
  color: var(--hp-text-muted);
  font-size: 0.85rem;
}

.hp-cat-loading,
.hp-cat-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--hp-text-muted);
  font-size: 0.9rem;
}

.hp-categories button.hp-cat-trigger {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 2px;
}

.hp-categories button.hp-cat-trigger,
.shop-categories button.hp-cat-trigger {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  color: var(--hp-text, var(--text, #333));
  font-weight: 500;
  font-size: 0.88rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.hp-categories button.hp-cat-trigger:hover,
.shop-categories button.hp-cat-trigger:hover,
.hp-categories button.hp-cat-trigger.is-active,
.shop-categories button.hp-cat-trigger.is-active {
  color: var(--hp-accent, #6e00ff);
  border-bottom-color: var(--hp-accent, #6e00ff);
}

/* نوار دسته در index */
.shop-categories-bar {
  position: sticky;
  top: 58px;
  z-index: 90;
  background: var(--light, #fff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .shop-categories-bar {
  background: var(--light, #171a20);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.shop-categories {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.shop-categories::-webkit-scrollbar {
  display: none;
}

.shop-categories ul {
  display: flex;
  align-items: center;
  gap: 0.35rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 8px 14px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .shop-categories-bar {
    top: 64px;
  }
  .app-header.header-with-search ~ .shop-categories-bar ~ main.content {
    padding-top: 118px;
  }
}

/* دسته در پنل فیلتر */
.filters-category-active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(110, 0, 255, 0.08);
  border: 1px solid rgba(110, 0, 255, 0.2);
  font-size: 0.9rem;
}

.filters-category-active[hidden] {
  display: none !important;
}

.filters-category-clear {
  border: none;
  background: transparent;
  color: #dc3545;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  flex-shrink: 0;
}

.filters-category-triggers {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: visible;
  flex-wrap: nowrap;
  padding: 0;
  margin-top: 0.35rem;
}

.filters-category-triggers .hp-cat-trigger {
  display: block;
  width: 100%;
  text-align: right;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  color: var(--hp-text, var(--text, #333));
  font-weight: 500;
  font-size: 0.92rem;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0;
  white-space: normal;
  line-height: 1.4;
}

.filters-category-triggers .hp-cat-trigger:last-child {
  border-bottom: none;
}

.filters-category-triggers .hp-cat-trigger:hover,
.filters-category-triggers .hp-cat-trigger.is-active {
  color: var(--hp-accent, #6e00ff);
  background: rgba(110, 0, 255, 0.06);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.filters-category-triggers .hp-cat-trigger.is-active {
  font-weight: 700;
  border-inline-start: 3px solid var(--hp-accent, #6e00ff);
  padding-inline-start: 8px;
}

.hp-cat-modal {
  z-index: 1000001;
}

/* منوی اصلی دسته‌ها — موبایل home */
.hp-cat-nav-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.hp-cat-nav-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.hp-cat-nav-modal__sheet {
  background: var(--hp-surface, #fff);
  color: var(--hp-text, #1e293b);
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.hp-cat-nav-modal.is-open .hp-cat-nav-modal__sheet {
  transform: translateY(0);
}

.hp-cat-nav-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--hp-border, #edf2f7);
}

.hp-cat-nav-modal__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.hp-cat-nav-modal__close {
  border: none;
  background: var(--hp-surface-2, #f1f5f9);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--hp-text);
  font-size: 1.1rem;
}

.hp-cat-nav-modal__list {
  list-style: none;
  margin: 0;
  padding: 10px 12px calc(20px + env(safe-area-inset-bottom, 0));
}

.hp-cat-nav-modal__list li {
  margin-bottom: 8px;
}

.hp-cat-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: right;
  text-decoration: none;
  border: 1px solid var(--hp-border, #e2e8f0);
  border-radius: 14px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--hp-text, #1e293b);
  background: var(--hp-surface, #fff);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.hp-cat-nav-item::after {
  content: '\f053';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.75rem;
  color: var(--hp-text-muted, #64748b);
}

a.hp-cat-nav-item::after {
  content: '\f061';
}

.hp-cat-nav-item:hover,
.hp-cat-nav-item:focus-visible {
  border-color: var(--hp-accent-border, #c4b5fd);
  color: var(--hp-accent, #6e00ff);
  background: var(--hp-accent-soft, rgba(110, 0, 255, 0.06));
}

@media (min-width: 769px) {
  .hp-cat-nav-modal {
    display: none;
  }
}

[data-theme="dark"] {
  --hp-surface: #171a20;
  --hp-surface-2: #252a36;
  --hp-text: #f3f4f6;
  --hp-text-muted: #9ca3af;
  --hp-border: rgba(255, 255, 255, 0.1);
  --hp-accent: #8b5cf6;
  --hp-accent-border: #a78bfa;
  --hp-accent-soft: rgba(139, 92, 246, 0.15);
}

[data-theme="dark"] .filters-category-active {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  color: #f3f4f6;
}

[data-theme="dark"] .filters-category-triggers .hp-cat-trigger {
  color: #e5e7eb;
  background: none;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .filters-category-triggers .hp-cat-trigger:hover,
[data-theme="dark"] .filters-category-triggers .hp-cat-trigger.is-active {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .filters-category-triggers .hp-cat-trigger.is-active {
  border-inline-start-color: #a78bfa;
}
