/* =========================================================
   CPC Archive UI
   - filters
   - sort dropdown
   - pagination
   - loader overlay
   ========================================================= */

/* Layout */
.cpc-archive__bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 40px;
}

/* Filters */
.cpc-archive__filters {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 10px;
}

button.cpc-filter {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;

  border: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  height: 36px;
  padding: 8px 20px;
  border-radius: 18px;

  background-color: #eafaea;
  color: #2b2b2b;

  cursor: pointer;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

button.cpc-filter:hover {
  background-color: #c1f0c1;
}
button.cpc-filter.is-active {
  background-color: #2b2b2b;
  color: #ffffff;
}

/* Sort */
.cpc-archive__sort {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.cpc-archive__sort select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  height: 48px;
  min-width: 220px;
  padding: 0 44px 0 16px;

  border: 1px solid #d6d6d6;
  border-radius: 10px;
  background-color: #fff;

  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  color: #2b2b2b;

  cursor: pointer;

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%232B2B2B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px;
}

.cpc-archive__sort select:hover {
  border-color: #bdbdbd;
}

.cpc-archive__sort select:focus {
  outline: none;
  border-color: #60c15d;
  box-shadow: 0 0 0 3px rgba(96, 193, 93, 0.18);
}

/* Optional: make ASC/DESC compact */
.cpc-archive__sort .cpc-sort-order {
  min-width: 120px;
}

/* Pagination */
.cpc-pagination {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.cpc-pagination .page-numbers {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.cpc-pagination .page-numbers a,
.cpc-pagination .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 36px;
  height: 32px;
  padding: 0 12px;

  border-radius: 999px;
  border: 1px solid #dde6dd;
  background: #ffffff;

  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: #2b2b2b;
  text-decoration: none;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.cpc-pagination .page-numbers a:hover {
  background: #eafaea;
  border-color: #bfe9bf;
  transform: translateY(-1px);
}

.cpc-pagination .page-numbers .current {
  background: #d5f6d5;
  border-color: #aee2ae;
  font-weight: 700;
}

.cpc-pagination .page-numbers .prev,
.cpc-pagination .page-numbers .next {
  padding: 0 14px;
  font-weight: 700;
}

.cpc-pagination .page-numbers .disabled,
.cpc-pagination .page-numbers .dots {
  opacity: 0.6;
  background: #fff;
  border-color: #e6e6e6;
  cursor: default;
}

.cpc-pagination .page-numbers a:focus-visible {
  outline: 2px solid #60c15d;
  outline-offset: 2px;
}

/* Loader overlay (animated SVG centered) */
.cpc-archive__results {
  position: relative;
}

.cpc-archive.is-loading .cpc-archive__results::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;

  background-color: rgba(255, 255, 255, 0.72);

  background-image: url('../images/wave-animation.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 260px auto;

  border-radius: 12px;
}

.cpc-archive.is-loading .cpc-archive__results::after {
  content: none;
}

/* Mobile */
@media (max-width: 768px) {
  .cpc-archive__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 30px;
  }

  .cpc-archive__sort {
    justify-content: flex-start;
    width: 100%;
    gap: 10px;
  }

  .cpc-archive__sort select {
    min-width: 0;
    width: 100% !important;
    height: 46px;
  }

  .cpc-archive__sort .cpc-sort-order {
    width: 120px;
  }

  .cpc-pagination {
    margin-top: 24px;
  }

  .cpc-pagination .page-numbers {
    gap: 8px;
  }

  .cpc-pagination .page-numbers a,
  .cpc-pagination .page-numbers span {
    min-width: 34px;
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
  }

  button.cpc-filter {
    height: 28px;
    font-size: 14px;
  }
  .cpc-archive__filters {
    gap: 10px 8px;
  }
}
