/**
 * Bengal SSG Default Theme
 * Pagination Component
 *
 * Enhanced pagination with better UX:
 * - Clear visual hierarchy
 * - Hover states
 * - Active indicators
 * - Mobile-friendly
 * - Keyboard accessible
 */

/* ============================================
   BASE PAGINATION
   ============================================ */

.pagination {
  margin: var(--space-12) 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;

  ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  li {
    margin: 0;
  }

  a,
  span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: var(--border-radius-medium);
    text-decoration: none;
    font-size: var(--text-body-small);
    font-weight: var(--weight-medium);
    transition: all var(--transition-fast);
  }
}/* ============================================
   PAGINATION LINKS
   ============================================ */

.pagination a{
  color: var(--color-text-secondary);
  background-color: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  box-shadow: var(--elevation-subtle);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;

}
/* ============================================
   PAGINATION LINKS
   ============================================ */

.pagination a:hover {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
    box-shadow: var(--elevation-low);
    transform: translate3d(0, -1px, 0);
  }
/* ============================================
   PAGINATION LINKS
   ============================================ */

.pagination a:active {
    transform: translate3d(0, 0, 0);
  }
/* ============================================
   PAGINATION LINKS
   ============================================ */

.pagination a:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
  }

/* ============================================
   PAGINATION STATES
   ============================================ */

/* Active Page - with casting light glow */
.pagination .active {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border: 1px solid var(--color-primary);
  box-shadow: var(--elevation-medium);
  cursor: default;
  font-weight: var(--weight-semibold);
  animation: pagination-glow 8s ease-in-out infinite;
}

@keyframes pagination-glow {
  0%, 100% {
    box-shadow:
      var(--elevation-medium),
      0 0 0 0 color-mix(in srgb, var(--color-primary) 0%, transparent),
      0 2px 10px 0 color-mix(in srgb, var(--color-primary) 15%, transparent);
  }
  50% {
    box-shadow:
      var(--elevation-medium),
      0 0 0 0 color-mix(in srgb, var(--color-primary) 10%, transparent),
      0 4px 20px 0 color-mix(in srgb, var(--color-primary) 30%, transparent);
  }
}

[data-theme="dark"] .pagination .active {
  animation: pagination-glow-dark 8s ease-in-out infinite;
}

@keyframes pagination-glow-dark {
  0%, 100% {
    box-shadow:
      var(--elevation-medium),
      0 0 0 0 color-mix(in srgb, var(--color-primary) 5%, transparent),
      0 2px 12px 0 color-mix(in srgb, var(--color-primary) 20%, transparent);
  }
  50% {
    box-shadow:
      var(--elevation-medium),
      0 0 0 0 color-mix(in srgb, var(--color-primary) 15%, transparent),
      0 5px 25px 0 color-mix(in srgb, var(--color-primary) 40%, transparent);
  }
}

/* Disabled State */
.pagination .disabled {
  color: var(--color-text-tertiary);
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Pagination sub-elements */
.pagination-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.pagination-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination-quick-jump {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pagination-ellipsis {
  color: var(--color-text-tertiary);
  padding: 0 0.25rem;
  min-width: auto;
}

/* Ellipsis */
.pagination .ellipsis {
  color: var(--color-text-tertiary);
  padding: 0 0.25rem;
  min-width: auto;
  border: none;
  background: none;
  box-shadow: none;
}

/* ============================================
   PAGINATION NAVIGATION (Prev/Next)
   ============================================ */

.pagination__prev,
.pagination__next {
  font-weight: var(--weight-medium);
}

.pagination__prev svg,
.pagination__next svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   PAGINATION INFO
   ============================================ */

.pagination__info {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: center;
}

/* ============================================
   PAGINATION ICONS
   ============================================ */

.pagination svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ============================================
   PAGINATION VARIANTS
   ============================================ */

/* Compact Pagination */
.pagination--compact {
  margin: var(--space-8) 0;
}

.pagination--compact a,
.pagination--compact span {
  min-width: var(--space-8);
  height: var(--space-8);
  padding: 0 0.5rem;
  font-size: var(--text-xs);
}

/* Simple Pagination (just prev/next) */
.pagination--simple {
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
  max-width: 800px;
}

.pagination--simple ul {
  gap: 1rem;
  flex-wrap: nowrap;
}

.pagination--simple .pagination__prev,
.pagination--simple .pagination__next {
  flex: 1;
  max-width: 300px;
}

.pagination--simple a {
  width: 100%;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .pagination ul {
    gap: 0.25rem;
  }

  .pagination a,
  .pagination span {
    min-width: var(--space-8);
    height: var(--space-8);
    padding: 0 0.5rem;
    font-size: var(--text-xs);
  }

  .pagination svg {
    width: 14px;
    height: 14px;
  }

  /* Hide page numbers on mobile, keep only prev/next */
  .pagination li:not(.pagination__prev):not(.pagination__next):not(.active) {
    display: none;
  }

  .pagination .active {
    /* Keep active page visible */
    display: flex;
  }
}

/* ============================================
   KEYBOARD NAVIGATION ENHANCEMENT
   ============================================ */

.user-is-tabbing .pagination a:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 3px;
  border-radius: var(--border-radius-medium);
}

/* ============================================
   PRINT
   ============================================ */

@media print {
  .pagination {
    display: none;
  }
}
