/* Product archive layout helpers (avoid relying on Tailwind classes that may be purged from the compiled CSS) */

.matmat-archive-layout {
  display: block;
}

.matmat-archive-products {
  min-width: 0;
}

@media (min-width: 1024px) {
  .matmat-archive-layout {
    display: grid;
    grid-template-columns: 304px 1fr;
    gap: 2rem;
    align-items: start;
  }

  .matmat-archive-sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
  }
}

/* --- Price range slider (dual) --- */
.matmat-price-slider .matmat-range-wrap {
  height: 18px;
}

.matmat-range-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  background: #e5e7eb; /* gray-200 */
  border-radius: 9999px;
}

.matmat-range-fill {
  position: absolute;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  background: #FFBC16; /* primary 600 */
  border-radius: 9999px;
}

.matmat-range {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  pointer-events: none; /* allow thumbs only */
  -webkit-appearance: none;
  appearance: none;
}

.matmat-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  cursor: pointer;
}

.matmat-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  cursor: pointer;
}

.matmat-range::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
}

.matmat-range::-moz-range-track {
  height: 4px;
  background: transparent;
}

/* ── Category tree filter ───────────────────────────────────────── */
.matmat-cat-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.matmat-cat-tree .matmat-cat-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.matmat-cat-item {
  border-bottom: 1px solid #f3f4f6;
}

.matmat-cat-item:last-child {
  border-bottom: none;
}

.matmat-cat-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Chevron toggle button */
.matmat-cat-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: #9ca3af;
  border-radius: 0.25rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.matmat-cat-toggle:hover {
  color: #374151;
  background-color: #f3f4f6;
}

.matmat-cat-chevron {
  transition: transform 0.2s ease;
}

.matmat-cat-toggle[aria-expanded="true"] .matmat-cat-chevron {
  transform: rotate(90deg);
}

/* Spacer for leaf items without toggle */
.matmat-cat-spacer {
  width: 1.5rem;
  flex-shrink: 0;
}

/* Category link */
.matmat-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.375rem;
  color: #374151;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-decoration: none;
  border-radius: 0.375rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.matmat-cat-link:hover {
  color: #111827;
  background-color: #f9fafb;
}

.matmat-cat-link.is-active {
  color: #92400e;
  font-weight: 600;
  background-color: #fef3c7;
}

.matmat-cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matmat-cat-count {
  flex-shrink: 0;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

.matmat-cat-link.is-active .matmat-cat-count {
  color: #b45309;
}

/* Children container */
.matmat-cat-children[hidden] {
  display: none;
}

/* "Clear filter" chip */
.matmat-cat-clear {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #92400e;
  background-color: #fef3c7;
  border-radius: 9999px;
  text-decoration: none;
  transition: background-color 0.15s ease;
  max-width: 100%;
}

.matmat-cat-clear:hover {
  background-color: #fde68a;
}

.matmat-cat-clear span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide items during search */
.matmat-cat-item.is-search-hidden {
  display: none;
}


/* ── Pagination ──────────────────────────────────────────────── */
.matmat-pagination {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
}

.matmat-pagination__list {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.matmat-pagination__item a,
.matmat-pagination__item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: all 0.15s ease;
  color: #374151;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.matmat-pagination__item a:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

.matmat-pagination__item.is-current span {
  background-color: #111827;
  border-color: #111827;
  color: #fff;
  font-weight: 600;
}

.matmat-pagination__item.is-dots span {
  border: none;
  background: transparent;
  min-width: 1.5rem;
  color: #9ca3af;
  cursor: default;
}

.matmat-pagination__item.is-prev a,
.matmat-pagination__item.is-next a {
  padding: 0 0.625rem;
  border-color: transparent;
  background: transparent;
}

.matmat-pagination__item.is-prev a:hover,
.matmat-pagination__item.is-next a:hover {
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}

@media (max-width: 639px) {
  .matmat-pagination__item a,
  .matmat-pagination__item span {
    min-width: 2.25rem;
    height: 2.25rem;
    font-size: 0.8125rem;
  }
}

/* ── Auto-filter loading indicator ───────────────────────────── */
.matmat-filter-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

