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

/* 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: 8px 0 8px 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: 0.75rem;
  align-items: start;
}

.ach-filterable-post-item {
  background: transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px;
  background-color: var(--color-neutral-object);
}

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

/* Image link for featured posts */
.ach-post-image-link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Shine effect on hover */
.ach-filterable-post-image::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(45deg);
  z-index: 5;
  opacity: 0;
}

.ach-filterable-post-item:hover .ach-filterable-post-image::before {
  animation: shine 0.75s ease-in-out;
}

@keyframes shine {
  0% {
    left: -50%;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    left: 150%;
    opacity: 0;
  }
}

/* Emblematic Badge Styles */
.ach-emblematic-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  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);
}

/* Destacados badge styling */
.ach-destacados-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  background-color: #3b82f6;
  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(59, 130, 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: 8px 4px 4px 4px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.ach-filterable-post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.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: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 2;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.ach-category-pill:hover {
  background: #485466;
}

/* 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;
}

/* Destacados category pill styling */
.ach-category-pill-destacados {
  background: #3b82f6;
  color: white;
  text-decoration: none;
  cursor: pointer;
}

.ach-category-pill-destacados:hover {
  background: #2563eb;
  color: white;
  text-decoration: none;
}

.ach-filterable-post-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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-direction: column;
}

.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: 14px !important;
}

/* Address section with navigation buttons */
.ach-post-address {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.ach-post-address-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-body-loud);
  font-weight: 600;
  font-size: 14px;
}

.ach-post-address-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ach-post-address-buttons .ach-button {
  flex: 0 0 auto;
  height: 32px !important;
  width: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
}

.ach-post-address-buttons .ach-button.error {
  background-color: #ef4444;
  border-color: #ef4444;
  color: white;
}

.ach-post-address-buttons .ach-button.error:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

/* Address separator */
.ach-post-address-separator {
  width: 100%;
  height: 1px;
  background-color: var(--color-border-neutral-silent);
  margin: 0.25rem 0;
}

/* Permalink button for featured posts */
.ach-post-permalink-wrapper {
  display: flex;
  align-items: center;
}

.ach-post-permalink-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--color-contextual-action);
  text-decoration: none;
  font-size: 14px;
  line-height: 28px;
  font-weight: 600;
  padding: 4px 0;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.ach-post-permalink-btn:hover {
  color: var(--color-contextual-action-quiet);
  transition: all 0.2s ease;
}

.ach-post-permalink-btn i {
  transition: all 0.2s ease;
}

.ach-post-permalink-btn:hover i {
  transform: translateX(4px);
}

/* Activate hover effect when hovering over the card */
.ach-filterable-post-item:hover .ach-post-permalink-btn {
  color: var(--color-contextual-action-quiet);
}

.ach-filterable-post-item:hover .ach-post-permalink-btn i {
  transform: translateX(4px);
}

/* Copy success message tooltip */
.ach-copy-success-message {
  position: fixed;
  background-color: var(--color-neutral-object);
  color: var(--color-body-loud);
  padding: 8px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 8px -4px rgba(17, 20, 24, 0.05);
  z-index: 9999;
  bottom: 20px;
  right: 20px;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  transform: translateY(10px);
  min-width: 330px;
}

.ach-copy-success-message.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .ach-copy-success-message {
    bottom: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(10px);
  }

  .ach-copy-success-message.show {
    transform: translateX(-50%) translateY(0);
  }
}

.ach-copy-success-message .ach-emblematic-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background-color: rgba(16, 185, 129, 0.2);
  color: rgba(16, 185, 129, 0.9);
  box-shadow: none;
  border: 1px solid rgba(16, 185, 129, 0.9);
}

.ach-copy-success-message .ach-emblematic-badge i {
  font-size: 16px;
}

/* 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: 200px 1fr;
    gap: 1rem;
  }

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

  .ach-filterable-sidebar {
    padding: 12px;
  }

  .ach-filterable-title {
    font-size: 1.25rem;
  }

  .ach-filterable-results {
    font-size: 0.85rem;
  }

  .ach-filterable-category-item {
    gap: 6px;
    padding: 0.35rem 0.25rem;
  }

  .ach-category-name {
    font-size: 12px;
    gap: 0.25rem;
    line-height: 1.4;
    min-width: 0;
    flex: 1;
  }

  .ach-category-count {
    font-size: 11px;
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 4px;
  }

  .ach-category-name i {
    flex-shrink: 0;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .ach-filterable-grid-container {
    padding: 0;
    grid-template-columns: 1fr;
  }

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

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

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

  .ach-sidebar-desktop {
    display: none !important;
  }

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

  .ach-filterable-post-content {
    padding: 6px 4px 4px 4px;
  }

  .ach-filterable-title {
    font-size: 1.125rem;
  }

  .ach-filterable-results {
    font-size: 0.8rem;
  }

  .ach-filterable-post-meta {
    gap: 0.5rem;
    margin-top: auto;
  }

  .ach-filterable-post-title {
    font-size: 14px;
  }

  .ach-filterable-post-categories {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .ach-category-pill {
    font-size: 10px;
    padding: 2px 6px;
  }

  .ach-post-address-buttons {
    gap: 0.4rem;
  }

  .ach-post-address-buttons .ach-button {
    height: 28px !important;
    width: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
  }

  .ach-post-address-buttons .ach-button i {
    font-size: 12px !important;
  }

  .ach-post-permalink-btn {
    font-size: 12px;
    gap: 6px;
  }

  .ach-post-permalink-btn i {
    font-size: 11px;
  }

  .ach-load-more-container {
    padding: 0;
  }
}

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

.ach-mobile-filters-container {
  background: var(--color-neutral-object);
  padding: 1rem;
  border-radius: 8px;
}

.ach-mobile-filters-title {
  margin: 8px 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-heading-loud);
}

.ach-mobile-filters-description {
  margin: 0 0 1rem 0;
  font-size: 14px;
  color: var(--color-body);
  line-height: 1.5;
}

.ach-mobile-category-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-body-loud);
  margin-bottom: 0.5rem;
}

.ach-mobile-category-dropdown {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid var(--color-border-neutral-quiet);
  background: var(--color-surface);
  color: var(--color-body);
}

.ach-mobile-category-dropdown:focus {
  outline: 2px solid var(--color-contextual-action);
  outline-offset: 2px;
}
