/* Modern Pagination — styled for Pagy 43 default `series_nav` markup.
   Pagy 43 renders links/gaps/current page with ARIA attributes instead of
   the legacy .page/.current/.gap classes:
     - normal page link  -> <a href="...">N</a>
     - current page       -> <a role="link" aria-current="page">N</a>
     - gap separator       -> <a role="separator">…</a>
     - disabled prev/next  -> <a role="link"> (no href) */
.pagy {
  display: flex;
  align-items: center;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  margin: 2rem 0;
  gap: 0.5rem;
}

/* Base styles for all buttons (everything except the gap separators) */
.pagy a:not([role="separator"]) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  text-decoration: none;
  border-radius: 9999px;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(75, 85, 99, 0.5);
  padding: 0.5rem 0.75rem;
  color: #d1d5db;
  transition: all 0.2s ease;
}

/* Hover for interactive (linked) buttons */
.pagy a[href]:hover {
  background-color: rgba(31, 41, 55, 0.7);
  border-color: rgba(107, 114, 128, 0.7);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Disabled buttons (prev/next without a link, not the current page) */
.pagy a[role="link"]:not([aria-current]) {
  cursor: not-allowed;
  opacity: 0.5;
  background-color: rgba(31, 41, 55, 0.4);
  color: #6b7280;
  border-color: rgba(75, 85, 99, 0.3);
}

/* Current page with gradient */
.pagy a[aria-current] {
  background: linear-gradient(135deg, #9F638D, #5D4A7E); /* Using similar colors to primary/secondary */
  color: white;
  border: none;
  font-weight: 600;
  opacity: 1;
  box-shadow: 0 4px 6px -1px rgba(159, 99, 141, 0.3), 0 2px 4px -1px rgba(93, 74, 126, 0.15);
}

/* First/last page buttons (prev/next) */
.pagy a:not([role="separator"]):first-child,
.pagy a:not([role="separator"]):last-child {
  font-weight: 600;
  padding: 0.5rem 1rem;
}

/* Separator "gap" */
.pagy a[role="separator"] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  text-decoration: none;
  color: #6b7280;
}

/* Mobile version more compact */
@media (max-width: 640px) {
  .pagy {
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .pagy a:not([role="separator"]),
  .pagy a[role="separator"] {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
  }

  /* Hide some pages on mobile to keep compact (keep first/last page and the
     current page's neighbours; prev/next stay as the nav's first/last child) */
  .pagy a:not([role="separator"]):not([aria-current]):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
    display: none;
  }
}

/* Slight animation when clicking */
.pagy a[href]:active {
  transform: translateY(0);
  box-shadow: none;
}
