/* ==========================================================================
   CATALOG LAYOUT & FILTERS
   ========================================================================== */
.ep-catalog-shell {
  max-width: 1900px;
  margin: 0 auto 84px;
  padding: 0 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.ep-filter-panel {
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: 20px;
  padding: 24px 20px 28px;
  box-shadow: var(--ep-shadow-md);
  position: static;
  max-height: none;
  overflow: visible;
}

.ep-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.ep-filter-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ep-filter-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ep-text);
  letter-spacing: .04em;
}

.ep-filter-clear {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--ep-primary-rgb), .22);
  background: rgba(var(--ep-primary-rgb), .08);
  color: var(--ep-primary);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-decoration: none;
  transition: .2s ease;
}

.ep-filter-clear:hover {
  background: rgba(var(--ep-primary-rgb), .14);
  border-color: rgba(var(--ep-primary-rgb), .32);
}

.ep-filter-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ep-filter-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ep-filter-title {
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ep-text);
  letter-spacing: .03em;
}

.ep-filter-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  font-size: .85rem;
  background: var(--ep-surface);
  color: var(--ep-text);
}

.ep-filter-input:focus {
  outline: none;
  border-color: var(--ep-primary);
  box-shadow: var(--ep-focus);
}

.ep-filter-input--sm {
  font-size: .78rem;
  padding: 8px 12px;
}

.ep-filter-input--price {
  font-size: .78rem;
  padding: 8px 10px;
}

.ep-category-search {
  margin-bottom: 8px;
}

.ep-category-list {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}

.ep-category-list::-webkit-scrollbar {
  width: 6px;
}

.ep-category-list::-webkit-scrollbar-track {
  background: transparent;
}

.ep-category-list::-webkit-scrollbar-thumb {
  background: rgba(var(--ep-primary-rgb), .25);
  border-radius: 20px;
}

.ep-category-list::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--ep-primary-rgb), .38);
}

.ep-category-group {
  display: flex;
  flex-direction: column;
}

.ep-category-group--nested {
  margin-left: 20px;
  position: relative;
}

.ep-category-group--nested::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(var(--ep-primary-rgb), .2);
}

.ep-category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ep-category-radio {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: .2s ease;
  font-size: .78rem;
  font-weight: 500;
  color: var(--ep-text);
  position: relative;
  flex: 1 1 auto;
}

.ep-category-radio:hover {
  background: rgba(var(--ep-primary-rgb), .06);
}

.ep-category-radio.is-checked {
  background: rgba(var(--ep-primary-rgb), .12);
  color: var(--ep-primary);
  font-weight: 600;
}

.ep-category-radio.has-children {
  font-weight: 600;
  position: relative;
}

.ep-category-radio .ep-category-children {
  display: block;
}

.ep-category-radio input[type="radio"] {
  accent-color: var(--ep-primary);
  cursor: pointer;
  margin: 0 8px 0 0;
}

.ep-category-name {
  flex: 1;
}

.ep-category-count {
  font-size: .68rem;
  color: var(--ep-text-soft);
  font-weight: 500;
  opacity: .7;
  margin-left: auto;
}

.ep-category-toggle {
  display: none;
}

.ep-category-children {
  display: none;
  margin-top: 4px;
  padding: 8px 0 4px 16px;
  border-left: 2px solid rgba(var(--ep-primary-rgb), .1);
  background: rgba(var(--ep-primary-rgb), .02);
}

.ep-category-children--main {
  background: #f8fafc;
  border: 1px solid rgba(var(--ep-primary-rgb), .08);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

.ep-category-children .ep-category-group + .ep-category-group {
  margin-top: 2px;
}

.ep-category-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px rgb(255 255 255 / 0%);
  border-radius: 10px;
  background: #fff;
  color: rgba(var(--ep-primary-rgb), .9);
  cursor: pointer;
  transition: all .18s ease;
  flex-shrink: 0;
}

.ep-category-toggle:hover,
.ep-category-toggle:focus-visible {
  border-color: var(--ep-primary);
  color: var(--ep-primary);
  box-shadow: var(--ep-focus);
  outline: none;
}

.ep-category-toggle__chevron {
  width: 8px;
  height: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  transition: transform .18s ease;
}

.ep-category-radio.is-expanded .ep-category-toggle__chevron {
  transform: rotate(-135deg);
}

/* Make expanded nodes visually match the checked (selected) category */
.ep-category-radio.is-expanded {
  background: rgba(var(--ep-primary-rgb), .12);
  color: var(--ep-primary);
  font-weight: 600;
}

.ep-category-level-1 {
  font-weight: 600;
  font-size: .82rem;
  padding: 10px 12px;
}

.ep-category-level-1:hover {
  background: rgba(var(--ep-primary-rgb), .08);
}

.ep-category-level-2 {
  font-weight: 500;
  padding-left: 16px;
  font-size: .76rem;
}

.ep-category-level-3 {
  font-weight: 500;
  padding-left: 32px;
  font-size: .74rem;
}

.ep-category-level-4 {
  font-weight: 500;
  padding-left: 48px;
  font-size: .72rem;
}

/* Expand main categories toggle */
.ep-category-expand-toggle {
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ep-text);
  font-size: 0.95rem;
}

.ep-category-expand-toggle:hover {
  background: rgba(var(--ep-primary-rgb), .04);
}

.ep-category-expand-toggle__icon {
  display: inline-block;
  transform: rotate(0);
  transition: transform .18s ease;
}

.ep-category-expand-toggle[aria-pressed="true"] .ep-category-expand-toggle__icon {
  transform: rotate(180deg);
}

/* When collapsed, hide nested groups; when expanded, show only top-level groups expanded */
.ep-category-list.is-collapsed .ep-category-group--nested{
  display:none
}
.ep-category-list.is-expanded{
  max-height:none;
   overflow:visible;
}

/* Brand Search & List */
.ep-brand-search {
  margin-bottom: 8px;
}

.ep-brand-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Checkboxes */
.ep-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 500;
  color: var(--ep-text);
}

.ep-filter-checkbox.is-checked {
  color: var(--ep-primary);
  font-weight: 600;
}

.ep-filter-checkbox input[type="checkbox"] {
  accent-color: var(--ep-primary);
  cursor: pointer;
  margin: 0;
}

/* Price Inputs */
.ep-price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep-price-separator {
  color: var(--ep-text-soft);
  font-weight: 500;
}

/* Filter Options & Apply Button */
.ep-filter-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ep-filter-apply {
  padding: 12px 20px;
  background: var(--ep-gradient-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 6px 14px rgba(var(--ep-primary-rgb), .22);
  transition: .2s ease;
}

.ep-filter-apply:hover {
  filter: brightness(1.05);
}

/* TREE VIEW (FILTERS) */
.ep-tree-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.ep-tree-node[open] > .ep-tree-summary {
  background: rgba(var(--ep-primary-rgb), .08);
  border-radius: 14px 14px 0 0;
}

.ep-tree-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(var(--ep-primary-rgb), .6);
  border-bottom: 2px solid rgba(var(--ep-primary-rgb), .6);
  transform: rotate(-45deg);
  transition: .2s ease;
  margin-right: 2px;
}

.ep-tree-node[open] > .ep-tree-summary .ep-tree-chevron {
  transform: rotate(45deg);
}

.ep-tree-chevron.is-placeholder {
  border-color: transparent;
  width: 12px;
  height: 12px;
}

.ep-tree-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: .2s ease;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ep-text);
}

.ep-tree-label input {
  accent-color: var(--ep-primary);
}

.ep-tree-label span {
  flex: 1;
  min-width: 0;
}

.ep-tree-label:hover {
  background: rgba(var(--ep-primary-rgb), .08);
}

.ep-tree-label.is-active {
  border-color: rgba(var(--ep-primary-rgb), .28);
  background: rgba(var(--ep-primary-rgb), .14);
  color: var(--ep-primary);
}

.ep-tree-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 14px 12px 28px;
}

.ep-tree-leaf {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.ep-tree-leaf:hover {
  border-color: rgba(var(--ep-primary-rgb), .28);
}

.ep-tree-leaf .ep-tree-label {
  padding: 0;
}

.ep-tree-leaf .ep-tree-chevron {
  margin-right: 6px;
}

.ep-tree-node.is-search-match > .ep-tree-summary .ep-tree-label,
.ep-tree-leaf.is-search-match .ep-tree-label {
  border-color: rgba(var(--ep-primary-rgb), .32);
  background: rgba(var(--ep-primary-rgb), .18);
  color: var(--ep-primary);
}

/* CATALOG RESULTS & PAGINATION */
.ep-catalog-results {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.ep-catalog-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ep-catalog-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ep-text);
}

.ep-catalog-count {
  margin: 0;
  font-size: .85rem;
  color: var(--ep-text-soft);
  font-weight: 500;
}

.ep-catalog-search-hint {
  font-size: .72rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(var(--ep-primary-rgb), .12);
  color: var(--ep-primary);
  font-weight: 600;
}

.ep-catalog-results .ep-product-grid {
  padding: 0;
  overflow-x: hidden;
}

.ep-load-more-wrap {
  display: flex;
  justify-content: center;
}

.ep-load-more {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: linear-gradient(180deg, var(--ep-primary));
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
  transition: transform .12s ease, opacity .12s ease;
}

.ep-load-more:active {
  transform: translateY(1px);
}

.ep-load-more.is-loading {
  opacity: 0.85;
  cursor: progress;
}

.ep-load-more[aria-busy="true"]::after {
  content: '';
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  border: 2px solid rgba(20, 45, 157, 0.6);
  border-right-color: transparent;
  border-radius: 50%;
  animation: ep-spin .9s linear infinite;
}

@keyframes ep-spin {
  to {
    transform: rotate(360deg);
  }
}

.ep-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.ep-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(var(--ep-primary-rgb), .1);
  color: var(--ep-primary);
  font-size: .75rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(var(--ep-primary-rgb), .2);
  transition: .2s ease;
}

.ep-filter-tag:hover {
  background: rgba(var(--ep-primary-rgb), .15);
  border-color: rgba(var(--ep-primary-rgb), .3);
}

.ep-filter-tag span {
  line-height: 1.2;
}

.ep-filter-tag svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ep-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px auto 6px;
  font-size: .75rem;
  color: var(--ep-text-soft);
}

.ep-pagination__pages {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep-pagination__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ep-border);
  border-radius: 10px;
  text-decoration: none;
  background: #fff;
  color: var(--ep-text);
  transition: .2s ease;
}

.ep-pagination__link:hover {
  border-color: var(--ep-primary);
  color: var(--ep-primary);
}

.ep-pagination__link.is-active {
  background: var(--ep-primary);
  color: #fff;
  border-color: var(--ep-primary);
  box-shadow: 0 6px 16px rgba(var(--ep-primary-rgb), .22);
}

.ep-pagination__link--direction {
  font-weight: 700;
  letter-spacing: .1em;
}

.ep-pagination__link.is-disabled {
  pointer-events: none;
  opacity: .35;
}

.ep-pagination__ellipsis {
  padding: 0 6px;
  font-size: .9rem;
  letter-spacing: .2em;
}

.ep-pagination__status {
  text-align: center;
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ep-text-soft);
}

@media (max-width: 1120px) {
  .ep-catalog-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .ep-catalog-shell {
    grid-template-columns: 1fr;
    max-width: 100%;
    overflow-x: hidden;
  }
  .ep-filter-panel {
    position: relative;
    top: auto;
    max-height: none;
  }
  .ep-filter-panel__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .ep-catalog-results,
  .ep-product-grid {
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 600px) {
  .ep-catalog-shell {
    padding: 0 10px;
  }
}

/* Sort Select Styles */
.ep-sort-select {
  padding: 8px 12px;
  border: 1px solid var(--ep-border);
  border-radius: 10px;
  font-size: .8rem;
  background: #fff;
  color: var(--ep-text);
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
}

.ep-sort-select:hover {
  border-color: var(--ep-primary);
}

.ep-sort-select:focus {
  outline: none;
  border-color: var(--ep-primary);
  box-shadow: 0 0 0 3px rgba(var(--ep-primary-rgb), .1);
}

/* Catalog Toolbar Styles */
.ep-catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--ep-border);
  margin-bottom: 24px;
}

.ep-catalog-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ep-results-count {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ep-text);
}

.ep-search-badge {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ep-primary);
  background: rgba(var(--ep-primary-rgb), .1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(var(--ep-primary-rgb), .2);
}

.ep-sort-form {
  margin-left: auto;
}

.ep-sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--ep-text-soft);
  font-weight: 600;
}

.ep-sort-label span {
  white-space: nowrap;
}

/* Responsive Catalog Toolbar */
@media (max-width: 768px) {
  .ep-catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .ep-sort-form {
    margin-left: 0;
  }

  .ep-sort-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .ep-sort-select {
    flex: 1;
    max-width: none;
    width: auto;
  }
}

@media (max-width: 480px) {
  .ep-sort-label {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .ep-sort-label span {
    font-size: .75rem;
  }

  .ep-sort-select {
    width: 100%;
    font-size: .75rem;
    padding: 10px 12px;
  }
}

/* Recently Viewed Section */
.ep-recently-viewed {
  max-width: 1280px;
  margin: 60px auto 0;
  padding: 0 32px 0 0;
  display: contents;
  flex-direction: column;
  gap: 18px;
}

.ep-recently-viewed__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ep-recently-viewed__head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ep-text);
  letter-spacing: .04em;
}

.ep-recently-viewed__cta {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ep-primary);
  text-decoration: none;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ep-recently-viewed__cta:hover {
  text-decoration: underline;
  color: var(--ep-primary-accent);
}

.ep-recently-viewed__scroller {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-top: 14px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.ep-recently-viewed__scroller::-webkit-scrollbar {
  height: 6px;
}

.ep-recently-viewed__scroller::-webkit-scrollbar-track {
  background: rgba(var(--ep-primary-rgb), .08);
  border-radius: 999px;
}

.ep-recently-viewed__scroller::-webkit-scrollbar-thumb {
  background: rgba(var(--ep-primary-rgb), .26);
  border-radius: 999px;
}

.ep-recently-viewed__scroller::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--ep-primary-rgb), .4);
}

.ep-recently-viewed__card {
  scroll-snap-align: start;
  flex: 0 0 240px;
  min-width: 220px;
}

.ep-recently-viewed__empty {
  margin: 0;
  font-size: .85rem;
  color: var(--ep-text-soft);
}

@media(max-width: 780px) {
  .ep-recently-viewed {
    padding: 0 20px;
    margin-top: 48px;
  }
}
