.catalog-section {
  padding-top: 28px;
}

.catalog-section .notice {
  margin-bottom: 20px;
}

/* ── Unified browse bar: categories + search ── */

.catalog-controls {
  background: white;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.catalog-controls-top {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.category-pills {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0 2px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.category-pills li {
  flex: 0 0 auto;
}

.cat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--soft);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cat-pill:hover {
  border-color: var(--primary-light);
}

.cat-pill.active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--soft);
}

.cat-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lavender-pale);
  color: var(--primary);
  flex-shrink: 0;
}

.cat-pill.active .cat-pill-icon {
  background: rgba(255, 255, 255, 0.16);
  color: var(--soft);
}

.cat-pill-icon svg {
  width: 15px;
  height: 15px;
}

.cat-pill-label {
  white-space: nowrap;
}

.cat-pill-count {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.55;
}

.cat-pill.active .cat-pill-count {
  opacity: 0.8;
}

.catalog-search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--lavender-pale);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.catalog-search:focus-within {
  background: white;
  border-color: var(--lavender-deep);
  box-shadow: 0 0 0 3px rgba(155, 121, 214, 0.15);
}

.catalog-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-faint);
  pointer-events: none;
}

.catalog-search input[type="search"] {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 40px 11px 42px;
  border-radius: 999px;
  font-size: 16px;
}

.catalog-search input[type="search"]:focus {
  box-shadow: none;
  background: transparent;
}

.catalog-search input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.search-clear:hover {
  background: var(--gray-soft);
  color: var(--text);
}

.search-clear svg {
  position: static;
  width: 14px;
  height: 14px;
}

/* ── Subcategories appear under the selected category ── */

.subcategory-rail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.subcategory-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
}

.chip-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chip-group::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--soft);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover {
  background: var(--lavender-pale);
  color: var(--text);
}

.chip.active {
  background: var(--lavender);
  border-color: var(--lavender);
  color: var(--primary-dark);
}

.chip .count {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.65;
}

/* ── Active filter chips ── */

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: var(--lavender-pale);
  color: var(--lavender-deep);
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.active-filter-chip svg {
  width: 13px;
  height: 13px;
}

.active-filters-clear {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Meta row ── */

.catalog-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 16px;
}

.catalog-count {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 0;
}

.catalog-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
}

.catalog-tip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.75;
}

/* ── Pagination ── */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
}

.pagination-pages {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.pagination-btn,
.pagination-nav {
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: white;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pagination-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
}

.pagination-nav svg {
  width: 15px;
  height: 15px;
}

.pagination-nav-label {
  display: none;
}

.pagination-btn:hover,
.pagination-nav:hover:not(:disabled) {
  background: var(--lavender-pale);
  border-color: var(--lavender);
  color: var(--primary-dark);
}

.pagination-btn[aria-current="page"] {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--soft);
}

.pagination-btn:disabled,
.pagination-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: var(--text-faint);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  user-select: none;
}

/* ── Tablet and up ── */

@media (min-width: 768px) {
  .catalog-controls {
    padding: 18px 20px 16px;
  }

  .chip-group {
    flex-wrap: wrap;
    overflow: visible;
  }

  .pagination-nav-label {
    display: inline;
  }

  .pagination-nav {
    min-width: 0;
  }
}

@media (min-width: 1024px) {
  .catalog-section {
    padding-top: 36px;
  }

  .catalog-controls-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .category-pills {
    flex: 1;
    min-width: 0;
    padding-bottom: 0;
  }

  .catalog-tools {
    flex-shrink: 0;
    width: min(460px, 42%);
  }
}

/* Phones */

@media (max-width: 680px) {
  .catalog-tip {
    font-size: 0.74rem;
  }
}
