.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.9) 100%);
  border-radius: 14px;
  margin-bottom: 2.5rem;
  position: relative;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.02),
    0 4px 12px rgba(0, 0, 0, 0.03);
}

.filters::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.1) 0%,
    rgba(148, 163, 184, 0.1) 50%,
    rgba(37, 99, 235, 0.05) 100%
  );
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  pointer-events: none;
}

[data-theme='dark'] .filters {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme='dark'] .filters::before {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.2) 0%,
    rgba(99, 102, 241, 0.1) 50%,
    rgba(37, 99, 235, 0.15) 100%
  );
}

.filterGroup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filterLabel {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ifm-color-emphasis-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.filterButtons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filterButton {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--ifm-color-emphasis-700);
  cursor: pointer;
  transition:
    background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
}

.filterButton:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.filterButton:active {
  transform: translateY(0);
}

.filterButton.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: transparent;
  color: white;
  box-shadow:
    0 2px 8px rgba(37, 99, 235, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.filterButton.active:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.4rem;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.filterButton.active .count {
  background: rgba(255, 255, 255, 0.25);
}

.clearButton {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--ifm-color-primary);
  cursor: pointer;
  transition:
    color 0.15s ease,
    transform 0.15s ease;
  position: relative;
}

.clearButton::after {
  content: '';
  position: absolute;
  bottom: 0.375rem;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.clearButton:hover {
  color: var(--ifm-color-primary-dark);
}

.clearButton:hover::after {
  opacity: 0.5;
  transform: scaleX(1);
}

/* Dark mode adjustments */
[data-theme='dark'] .filterButton {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.15);
  color: var(--ifm-color-emphasis-600);
}

[data-theme='dark'] .filterButton:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(37, 99, 235, 0.4);
}

[data-theme='dark'] .count {
  background: rgba(148, 163, 184, 0.2);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .filters {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: 12px;
  }

  .filterGroup {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
    width: 100%;
  }

  .filterLabel {
    font-size: 0.75rem;
  }

  .filterButtons {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.375rem;
    margin-bottom: -0.375rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filterButtons::-webkit-scrollbar {
    display: none;
  }

  .filterButton {
    flex-shrink: 0;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
  }

  /* Disable hover transforms on mobile */
  .filterButton:hover {
    transform: none;
  }

  .filterButton:active {
    transform: scale(0.97);
  }

  .clearButton {
    align-self: flex-end;
    padding: 0.375rem 0;
    font-size: 0.8125rem;
  }
}

/* Touch device optimization */
@media (hover: none) {
  .filterButton:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(148, 163, 184, 0.2);
  }

  .filterButton.active:hover {
    transform: none;
    box-shadow:
      0 2px 8px rgba(37, 99, 235, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  .filterButton:active {
    transform: scale(0.97);
  }

  [data-theme='dark'] .filterButton:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.15);
  }
}
