/* Filterable Grid Layout */
.ach-filterable-grid-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Sidebar Styles */
.ach-filterable-sidebar {
  background: var(--color-neutral-object);
  border-radius: 8px;
  padding: 12px;
  height: fit-content;
  position: sticky;
  top: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ach-filterable-sidebar-title {
  margin: 0 0 4px 0;
  font-weight: 600;
  color: var(--color-heading-loud);
}

.ach-filterable-sidebar-content p {
  font-size: 14px;
  color: var(--color-body);
}

.ach-categories-heading {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.ach-categories-title {
  font-size: 12px; /* Adjust as needed */
  font-weight: 600;
  margin-right: 8px;
  white-space: nowrap;
}

.ach-categories-line {
  flex: 1;
  height: 1px; /* Adjust thickness */
  background: var(--color-border-neutral); /* Use your theme color */
  border-radius: 3px;
}

.ach-filterable-categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ach-filterable-category-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.ach-filterable-category-item:hover {
  background-color: var(--color-object-accent-silent);
}

.ach-category-checkbox {
  display: none;
}

.ach-category-checkbox-custom {
  width: 20px;
  height: 20px;
  border: 1px solid var(--color-border-neutral);
  border-radius: 8px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ach-category-checkbox:checked + .ach-category-checkbox-custom {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.ach-category-checkbox:checked + .ach-category-checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.ach-category-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 18px;
  color: var(--color-body);
  flex: 1;
}

.ach-category-count {
  color: var(--color-body-loud);
  font-size: 16px;
}

/* Main Content Area */
.ach-filterable-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ach-filterable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-object-accent-silent);
}

.ach-filterable-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-body);
}

.ach-filterable-results {
  font-size: 0.9rem;
  color: var(--color-body-muted);
}

/* Loading Indicator */
.ach-filterable-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}

.ach-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-object-accent-silent);
  border-top: 3px solid var(--color-object-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Posts Grid */
.ach-filterable-posts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.ach-filterable-post-item {
  background: transparent;
  overflow: hidden;
}

.ach-filterable-post-item:hover {
  transform: translateY(-2px);
}

.ach-filterable-post-image {
  position: relative;
  aspect-ratio: 1/1;
  overflow: hidden;
}

/* Emblematic Badge Styles */
.ach-emblematic-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background-color: #8b5cf6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.ach-filterable-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  border-radius: 8px;
}

.ach-filterable-post-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-object-accent-silent);
  color: var(--color-body-muted);
  font-size: 2rem;
}

.ach-filterable-post-content {
  padding: 1rem;
}

.ach-filterable-post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ach-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  background: var(--color-neutral-on-disabled);
  color: var(--color-neutral-on-solid);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 2;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

/* Emblematic category pill styling */
.ach-category-pill-emblematic {
  background: #8b5cf6;
  color: white;
  text-decoration: none;
  cursor: pointer;
}

.ach-category-pill-emblematic:hover {
  background: #7c3aed;
  color: white;
  text-decoration: none;
}

.ach-filterable-post-title {
  margin: 0 0 0.5rem 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 2;
  color: var(--color-heading);
}

.ach-filterable-post-title a {
  color: var(--color-body);
  text-decoration: none;
  transition: color 0.2s ease;
}

.ach-filterable-post-title a:hover {
  color: var(--color-object-accent);
}

.ach-filterable-post-excerpt {
  font-size: 0.85rem;
  color: var(--color-body-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.ach-filterable-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--color-body-muted);
}

.ach-filterable-post-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-body-loud);
  font-weight: 600;
}

.ach-filterable-post-meta p {
  margin: 0;
  color: var(--color-body);
  font-size: 14px;
}

.ach-filterable-post-meta i {
  font-size: 0.8rem;
}

/* Load More Button */
.ach-load-more-container {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

/* .ach-load-more-btn styles removed - now using ach-button classes */

/* Empty States */
.ach-no-categories,
.ach-no-posts {
  text-align: center;
  padding: 2rem;
  color: var(--color-body-muted);
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .ach-filterable-grid-container {
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
  }

  .ach-filterable-posts {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .ach-filterable-grid-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ach-filterable-sidebar {
    position: static;
    order: 2;
  }

  .ach-filterable-main {
    order: 1;
  }

  .ach-filterable-posts {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .ach-filterable-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .ach-sidebar-desktop {
    display: none !important;
  }
  .ach-mobile-category-dropdown-wrapper {
    display: block !important;
  }
}

@media (max-width: 480px) {
  .ach-filterable-posts {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ach-filterable-sidebar {
    padding: 1rem;
  }

  .ach-filterable-post-content {
    padding: 0.75rem;
  }

  .ach-filterable-post-meta {
    gap: 0.75rem;
  }
}

.ach-mobile-category-dropdown-wrapper {
  display: none;
  margin-bottom: 1.5rem;
}

.ach-mobile-category-dropdown {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid var(--color-object-accent-silent, #b7c3d3);
  background: var(--color-surface, #fff);
  color: var(--color-body, #627289);
  margin-bottom: 1rem;
}

.ach-mobile-category-dropdown:focus {
  outline: 2px solid var(--color-object-accent, #7a8ba3);
}
