/**
 * Component: Category Archive
 *
 * Styles for the product category listing page including header,
 * filters, subcategory pills, sort pills, product grid, and load more.
 *
 * @package    Flavor_Starter
 * @subpackage Styles/Components
 * @since      1.0.0
 */

/* --------------------------------------------------------
   Section
   -------------------------------------------------------- */
.category-archive__inner {
  padding-top: 2.4rem;
  padding-bottom: 3.2rem;
}

@media (min-width: 640px) {
  .category-archive__inner {
    padding-top: 3.2rem;
    padding-bottom: 4.8rem;
  }
}

/* --------------------------------------------------------
   Header
   -------------------------------------------------------- */
.category-archive__header {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

@media (min-width: 640px) {
  .category-archive__header {
    flex-direction: row;
    align-items: center;
    gap: 1.6rem;
  }
}

.category-archive__header-left {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex: 1;
  min-width: 0;
}

.category-archive__back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  flex-shrink: 0;
  border-radius: var(--radius);
  transition: background-color 0.15s ease;
  color: hsl(var(--foreground));
}

.category-archive__back-link:hover {
  background-color: hsl(var(--muted));
}

.category-archive__back-link .dashicons {
  font-size: 2rem;
}

.category-archive__header-text {
  min-width: 0;
}

.category-archive__title {
  font-size: 2rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .category-archive__title {
    font-size: 2.4rem;
  }
}

.category-archive__description {
  font-size: 1.4rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.2rem;
}

/* --------------------------------------------------------
   Date Filters
   -------------------------------------------------------- */
.category-archive__date-filters {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
  position: relative;
}

@media (min-width: 640px) {
  .category-archive__date-filters {
    margin-left: auto;
  }
}

/* Date type toggle */
.category-archive__date-toggle {
  display: flex;
  border: 1px solid hsl(var(--border));
  border-radius: 0.8rem;
  overflow: hidden;
}

.category-archive__date-toggle-btn {
  padding: 0.4rem 0.8rem;
  font-size: 1.2rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background-color: hsl(var(--background));
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .category-archive__date-toggle-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1.4rem;
  }
}

.category-archive__date-toggle-btn:hover {
  background-color: hsl(var(--muted));
}

.category-archive__date-toggle-btn--active {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.category-archive__date-toggle-btn--active:hover {
  background-color: hsl(var(--primary));
}

/* Month picker trigger */
.category-archive__month-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 3.2rem;
  padding: 0 0.8rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--background));
  font-size: 1.2rem;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 640px) {
  .category-archive__month-picker-trigger {
    height: 3.6rem;
    padding: 0 1.2rem;
    font-size: 1.4rem;
    min-width: 20rem;
  }
}

.category-archive__month-picker-trigger .dashicons {
  font-size: 1.4rem;
  width: 1.4rem;
  height: 1.4rem;
}

/* Clear filter */
.category-archive__clear-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  flex-shrink: 0;
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  transition: background-color 0.15s ease;
}

.category-archive__clear-filter:hover {
  background-color: hsl(var(--muted));
}

.category-archive__clear-filter .dashicons {
  font-size: 1.4rem;
}

/* Month picker dropdown */
.category-archive__month-picker {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  margin-top: 0.4rem;
  padding: 1.6rem;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

.category-archive__month-picker[hidden] {
  display: none;
}

.category-archive__month-picker-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.category-archive__year-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: var(--radius);
  color: hsl(var(--foreground));
  transition: background-color 0.15s ease;
}

.category-archive__year-nav:hover {
  background-color: hsl(var(--muted));
}

.category-archive__year-label {
  font-size: 1.4rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.category-archive__month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.category-archive__month-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.2rem;
  font-size: 1.2rem;
  font-weight: 500;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.category-archive__month-btn:hover {
  background-color: hsl(var(--muted));
}

.category-archive__month-btn--active {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* --------------------------------------------------------
   Subcategory Pills
   -------------------------------------------------------- */
.category-archive__subcategories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

@media (min-width: 640px) {
  .category-archive__subcategories {
    gap: 0.8rem;
    margin-bottom: 1.2rem;
  }
}

.category-archive__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 1.2rem;
  font-weight: 500;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  background-color: hsl(var(--background));
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .category-archive__pill {
    padding: 0.6rem 1.2rem;
    font-size: 1.4rem;
  }
}

.category-archive__pill:hover {
  background-color: hsl(var(--secondary));
}

.category-archive__pill--active {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.category-archive__pill--active:hover {
  background-color: hsl(var(--primary));
}

/* --------------------------------------------------------
   Sort Pills
   -------------------------------------------------------- */
.category-archive__sort-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.6rem;
}

@media (min-width: 640px) {
  .category-archive__sort-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
  }
}

.category-archive__sort-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border-radius: 9999px;
  font-size: 1.1rem;
  font-weight: 500;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  background-color: hsl(var(--background));
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .category-archive__sort-pill {
    padding: 0.6rem 1.2rem;
    font-size: 1.4rem;
  }
}

.category-archive__sort-pill:hover {
  background-color: hsl(var(--secondary));
}

.category-archive__sort-pill .dashicons {
  font-size: 1.2rem;
  width: 1.2rem;
  height: 1.2rem;
}

@media (min-width: 640px) {
  .category-archive__sort-pill .dashicons {
    font-size: 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
  }
}

.category-archive__sort-pill--active {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.category-archive__sort-pill--active:hover {
  background-color: hsl(var(--primary));
}

.category-archive__sort-pill--destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}

.category-archive__sort-pill--destructive:hover {
  background-color: hsl(var(--destructive));
}

/* --------------------------------------------------------
   Filter Notice
   -------------------------------------------------------- */
.category-archive__filter-notice {
  margin-bottom: 1.6rem;
  padding: 0.8rem 1.6rem;
  font-size: 1.4rem;
  color: hsl(var(--muted-foreground));
  background-color: hsl(var(--muted) / 0.5);
  border-radius: 0.8rem;
}

.category-archive__filter-notice strong {
  font-weight: 600;
}

/* --------------------------------------------------------
   Products Grid
   -------------------------------------------------------- */
.category-archive__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

@media (min-width: 640px) {
  .category-archive__grid {
    gap: 1.6rem;
  }
}

@media (min-width: 1024px) {
  .category-archive__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .category-archive__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --------------------------------------------------------
   Load More
   -------------------------------------------------------- */
.category-archive__load-more-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  margin-top: 3.2rem;
}

.category-archive__load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 4.4rem;
  padding: 0 3.2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.category-archive__load-more-btn:hover {
  background-color: hsl(var(--muted));
  border-color: hsl(var(--foreground) / 0.2);
}

.category-archive__load-more-btn--loading {
  opacity: 0.6;
  pointer-events: none;
}

.category-archive__product-count {
  font-size: 1.3rem;
  color: hsl(var(--muted-foreground));
}

/* --------------------------------------------------------
   Empty / No Results
   -------------------------------------------------------- */
.category-archive__no-results {
  text-align: center;
  padding: 6.4rem 1.6rem;
  color: hsl(var(--muted-foreground));
  font-size: 1.5rem;
}

.category-archive__empty {
  text-align: center;
  padding: 6.4rem 1.6rem;
  color: hsl(var(--muted-foreground));
}

.category-archive__back-btn {
  display: inline-block;
  margin-top: 1.6rem;
  padding: 0.8rem 2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 1.4rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  transition: background-color 0.15s ease;
}

.category-archive__back-btn:hover {
  background-color: hsl(var(--muted));
}
