/* ── Products Page Layout ── */
.products-page {
  padding: 1.5rem 0 3rem;
  min-height: calc(100vh - 4rem);
}

/* ── Breadcrumb ── */
.breadcrumb {
  margin-bottom: 1.5rem;
}

.breadcrumb__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.875rem;
}

.breadcrumb__item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.breadcrumb__link {
  color: var(--muted-foreground);
  transition: color 0.2s ease;
}

.breadcrumb__link:hover {
  color: var(--primary);
}

.breadcrumb__current {
  font-weight: 500;
}

.breadcrumb__separator {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted-foreground);
}

/* ── Products Header ── */
.products-header {
  margin-bottom: 2rem;
}

.products-header__title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.products-header__count {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ── Products Toolbar ── */
.products-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.products-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

/* ── Search Bar ── */
.search-bar {
  position: relative;
  width: 100%;
}

.search-bar__icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  pointer-events: none;
}

.search-bar__input {
  width: 100%;
  height: 2.75rem;
  padding: 0 2.5rem 0 2.5rem;
  background: color-mix(in oklab, var(--muted) 50%, transparent);
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 1.2);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-bar__input:focus {
  border-color: var(--primary);
  background: var(--background);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 10%, transparent);
}

.search-bar__clear {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted-foreground);
  transition: all 0.2s ease;
}

.search-bar__clear:hover {
  background: var(--accent);
  color: var(--foreground);
}

.search-bar__clear svg {
  width: 1rem;
  height: 1rem;
}

/* ── Search Page ── */
.search-page__form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.search-page__form .search-bar {
  flex: 1;
}

.search-page__submit {
  height: 2.75rem;
  padding: 0 1.5rem;
  border-radius: calc(var(--radius) * 1.2);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .search-page__form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-page__submit {
    width: 100%;
  }
}

/* ── Sort Dropdown ── */
.sort-dropdown {
  position: relative;
  flex: 1;
}

.sort-dropdown__trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 2.75rem;
  padding: 0 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  transition: all 0.2s ease;
}

.sort-dropdown__trigger:hover {
  border-color: var(--primary);
}

.sort-dropdown__trigger svg {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
}

.sort-dropdown__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  left: 0;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
  overflow: hidden;
  animation: dropdown-in 0.2s ease;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sort-dropdown__item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: right;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: all 0.2s ease;
}

.sort-dropdown__item:hover {
  background: var(--accent);
}

.sort-dropdown__item--active {
  background: color-mix(in oklab, var(--primary) 10%, transparent);
  color: var(--primary);
  font-weight: 600;
}

/* ── Filter Button ── */
.btn--outline {
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn--outline:hover {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 5%, transparent);
}

.filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: calc(var(--radius) * 1.2);
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
}

.filter-btn svg {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
}

.filter-btn__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 9999px;
  background: var(--secondary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Categories Slider ── */
.categories-slider {
  margin-bottom: 2rem;
  overflow: hidden;
}

.categories-slider__track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0.25rem;
}

.categories-slider__track::-webkit-scrollbar {
  display: none;
}

.category-pill {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.category-pill:hover {
  border-color: color-mix(in oklab, var(--primary) 50%, transparent);
}

.category-pill--active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ── Products Grid ── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.products-grid .product-card {
  flex: none;
  width: 100%;
  min-width: 0;
}

.products-grid__loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--muted-foreground);
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  text-align: center;
}

.empty-state__icon {
  width: 5rem;
  height: 5rem;
  background: var(--muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.empty-state__icon svg {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--muted-foreground);
}

.empty-state__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-state__description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  max-width: 24rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.empty-state__reset {
  border-radius: calc(var(--radius) * 1.2);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination__btn {
  min-width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  border-radius: calc(var(--radius) * 0.8);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
  transition: all 0.2s ease;
}

.pagination__btn:hover {
  border-color: var(--primary);
}

.pagination__btn--active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.pagination__btn--disabled {
  opacity: 0.5;
  pointer-events: none;
}

.pagination__ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  color: var(--muted-foreground);
}

/* ── Filter Bottom Sheet ── */
.filter-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.filter-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 85vh;
  background: var(--background);
  border-radius: calc(var(--radius) * 3) calc(var(--radius) * 3) 0 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  animation: slide-up 0.3s ease;
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.filter-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.filter-sheet__title {
  font-size: 1.25rem;
  font-weight: 700;
}

.filter-sheet__close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.filter-sheet__close:hover {
  background: var(--accent);
}

.filter-sheet__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.filter-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filter-sheet__footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.filter-sheet__reset,
.filter-sheet__apply {
  flex: 1;
  height: 2.75rem;
  border-radius: calc(var(--radius) * 1.2);
  font-size: 0.875rem;
}

/* ── Filter Labels ── */
.filter-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.filter-sublabel {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.filter-divider {
  height: 1px;
  background: var(--border);
}

/* ── Price Filter ── */
.price-filter__inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.price-input {
  position: relative;
}

.price-input input {
  width: 100%;
  height: 2.75rem;
  padding: 0 3rem 0 0.75rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.price-input input:focus {
  border-color: var(--primary);
}

.price-input__unit {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  pointer-events: none;
}

.price-filter__quick-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.price-filter__quick-btn {
  padding: 0.375rem 0.75rem;
  height: 2rem;
  border-radius: calc(var(--radius) * 0.8);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  transition: all 0.2s ease;
}

.price-filter__quick-btn:hover {
  border-color: color-mix(in oklab, var(--primary) 50%, transparent);
}

.price-filter__quick-btn--active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* ── Color Filter ── */
.color-filter__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.color-filter__item {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
  cursor: pointer;
}

.color-filter__item:hover {
  transform: scale(1.1);
}

.color-filter__item--active {
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 20%, transparent);
}

.color-filter__item svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
}

/* ── Size Filter ── */
.size-filter__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.size-filter__item {
  min-width: 3rem;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) * 0.8);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--background);
  color: var(--foreground);
  transition: all 0.2s ease;
}

.size-filter__item:hover {
  border-color: color-mix(in oklab, var(--primary) 50%, transparent);
}

.size-filter__item--active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* ── Stock Filter ── */
.stock-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stock-filter__label {
  margin-bottom: 0;
  cursor: pointer;
}

/* ── Switch ── */
.switch {
  position: relative;
  width: 3rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: var(--muted);
  transition: all 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.switch__thumb {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.switch--active {
  background: var(--primary);
}

.switch--active .switch__thumb {
  transform: translateX(-1.5rem);
}

/* ── Responsive ── */
@media (min-width: 768px) {
  .products-toolbar {
    flex-direction: row;
    align-items: center;
  }

  .products-toolbar__actions {
    width: auto;
    flex-shrink: 0;
  }

  .sort-dropdown {
    flex: none;
    min-width: 12rem;
  }

  .filter-btn {
    flex: none;
    min-width: 6rem;
  }

  .filter-sheet {
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: 420px;
    height: 100%;
    border-radius: calc(var(--radius) * 3) 0 0 calc(var(--radius) * 3);
    animation: slide-left 0.3s ease;
  }

  @keyframes slide-left {
    from {
      transform: translateX(100%);
    }
    to {
      transform: translateX(0);
    }
  }
}

@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .products-header__title {
    font-size: 1.5rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .price-filter__inputs {
    grid-template-columns: 1fr;
  }

  .filter-sheet__footer {
    flex-direction: column;
  }
}
