/* Posts Filters Styling */
.posts-filters {
  position: relative;
}

.posts-filters__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: center;
}

.posts-filters__group {
  min-width: 140px;
}

.posts-filters__buttons,
.posts-filters__radios {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.posts-filter__item {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

/* Hide default radio buttons */
.posts-filter__radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Style radio labels as buttons with circle */
.posts-filter__label {
  padding: 12px 21px 12px 45px;
  border: 1px solid;
  background: transparent;
  color: var(--accent);
  border-radius: 24px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: inline-block;
  position: relative;
  width: 100%;
}

/* Radio circle */
.posts-filter__label::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transition: all 0.3s ease;
}

/* Radio inner dot when checked */
.posts-filter__label::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0;
  transition: all 0.3s ease;
}

.posts-filter__label:hover {
  border-color: #333;
  background: #f5f5f5;
}

.posts-filter__radio:checked + .posts-filter__label {
  background: #333;
  color: #fff;
  border-color: #333;
}

.posts-filter__radio:checked + .posts-filter__label::after {
  opacity: 1;
}

.posts-filter__btn {
  padding: 12px 21px;
  border: 1px solid;
  background: transparent;
  color: var(--accent);
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  white-space: nowrap;
  border-radius: 24px;
}

.posts-filter__btn:hover {
  border-color: #333;
  background: #f5f5f5;
}

.posts-filter__btn.active {
  background: #333;
  color: #fff;
  border-color: #333;
}

.posts-filter__select-wrapper {
  position: relative;
  display: inline-block;
}

.posts-filter__select {
  padding: 12px 45px 12px 21px;
  border: 1px solid;
  background: transparent;
  color: var(--accent);
  border-radius: 24px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.posts-filter__select-icon {
  position: absolute;
  right: 21px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--accent);
  transition: all 0.3s ease;
}

.posts-filter__select:hover,
.posts-filter__select:focus {
  border-color: #333;
  outline: none;
}

.posts-filter__select:hover ~ .posts-filter__select-icon,
.posts-filter__select:focus ~ .posts-filter__select-icon {
  color: #333;
}

.posts-filters__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.posts-filters__loading .spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.posts-section.loading {
  opacity: 0.5;
  pointer-events: none;
}

.no-posts-found {
  padding: 3rem 1rem;
  text-align: center;
  width: 100%;
  grid-column: 1 / -1;
}

.no-posts-found p {
  font-size: 1.1rem;
  color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .posts-filters__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .posts-filters__group {
    width: 100%;
  }

  .posts-filters__buttons,
  .posts-filters__radios {
    justify-content: center;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .posts-filter__select-wrapper {
    width: 100%;
  }

  .posts-filter__select {
    width: 100%;
  }
}
