/* BookShelf Pagination - Unique class names to avoid conflicts */
.zb-library {
  --zb-primary: #2563eb;
  --zb-primary-dark: #1d4ed8;
  --zb-secondary: #f97316;
  --zb-background: #f8fafc;
  --zb-surface: #ffffff;
  --zb-text-primary: #0f172a;
  --zb-text-secondary: #64748b;
  --zb-text-tertiary: #94a3b8;
  --zb-border: #e2e8f0;
  --zb-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --zb-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --zb-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --zb-radius-sm: 4px;
  --zb-radius-md: 8px;
  --zb-radius-lg: 12px;
  --zb-radius-full: 9999px;
  --zb-book-width: clamp(130px, 20vw, 180px);
  --zb-transition: 0.2s ease-in-out;
  
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
  background-color: var(--zb-background);
  position: relative;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.zb-library * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.zb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.zb-title {
  position: relative;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 800;
  color: var(--zb-text-primary);
  letter-spacing: -0.01em;
}

.zb-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 4px;
  background-color: var(--zb-secondary);
  border-radius: var(--zb-radius-full);
}

.zb-categories {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
  margin-bottom: 1.25rem;
}

.zb-categories::-webkit-scrollbar {
  display: none;
}

.zb-category {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--zb-surface);
  border: 1px solid var(--zb-border);
  border-radius: var(--zb-radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--zb-text-secondary);
  cursor: pointer;
  transition: var(--zb-transition);
  white-space: nowrap;
}

.zb-category.active {
  background-color: var(--zb-primary);
  color: white;
  border-color: var(--zb-primary);
}

.zb-category:hover:not(.active) {
  background-color: var(--zb-border);
}

.zb-book-container {
  position: relative;
}

.zb-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--zb-book-width), 1fr));
  gap: 1.5rem;
  margin: 0 auto;
}

.zb-book {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.zb-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: var(--zb-radius-md);
  overflow: hidden;
  box-shadow: var(--zb-shadow-md);
  transform-origin: center bottom;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.zb-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.zb-book-spine {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 100%);
}

.zb-book-shine {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, 
    rgba(255,255,255,0.3) 0%, 
    rgba(255,255,255,0) 50%, 
    rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.zb-book:hover .zb-cover-wrap {
  transform: translateY(-8px) rotateX(10deg);
}

.zb-book:hover .zb-book-shine {
  opacity: 1;
}

.zb-book:hover .zb-cover-img {
  transform: scale(1.05);
}

.zb-book-info {
  margin-top: 0.75rem;
  text-align: left;
}

.zb-book-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--zb-text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.zb-book-author {
  font-size: 0.8rem;
  color: var(--zb-text-secondary);
}

.zb-book-rating {
  display: flex;
  align-items: center;
  margin-top: 0.5rem;
  gap: 0.25rem;
}

.zb-book-stars {
  color: var(--zb-secondary);
  font-size: 0.75rem;
}

.zb-book-reviews {
  font-size: 0.75rem;
  color: var(--zb-text-tertiary);
}

.zb-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--zb-secondary);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--zb-radius-sm);
  z-index: 10;
}

/* PAGINATION SECTION - ENHANCED FOR BETTER VISIBILITY */
.zb-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--zb-border);
}

.zb-page-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.zb-page-buttons form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* Ensure buttons have proper sizing and visibility */
.zb-page-btn,
#zb-prev-page,
#zb-next-page {
  background-color: var(--zb-surface);
  border: 1px solid var(--zb-border);
  color: var(--zb-text-secondary);
  min-width: 40px;
  height: 40px;
  border-radius: var(--zb-radius-md);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--zb-transition);
  padding: 0 0.75rem !important;
}

.zb-page-btn.active {
  background-color: var(--zb-primary);
  color: white;
  border-color: var(--zb-primary);
}

.zb-page-btn:hover:not(:disabled):not(.active) {
  background-color: var(--zb-border);
}

.zb-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Style for navigation buttons specifically */
.zb-nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  min-width: 100px !important;
}

.zb-page-info {
  font-size: 0.875rem;
  color: var(--zb-text-secondary);
}

.zb-loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 4px solid var(--zb-border);
  border-top-color: var(--zb-primary);
  border-radius: 50%;
  animation: zb-spin 1s linear infinite;
  z-index: 10;
}

@keyframes zb-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.zb-view-all-container {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1rem;
}

.zb-viewall-btn {
  padding: 0.75rem 2rem;
  background: #2c3e50;
  color: #fff;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zb-viewall-btn:hover {
  background: #1a252f;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.zb-viewall-btn:active {
  transform: translateY(0);
}

/* Add an icon to the View All button */
.zb-viewall-btn::after {
  content: "→";
  margin-left: 0.5rem;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.zb-viewall-btn:hover::after {
  transform: translateX(4px);
}

/* Media Queries */
@media (max-width: 768px) {
  .zb-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .zb-page-info {
    display: none;
  }
  
  .zb-pagination {
    flex-direction: column;
    gap: 1rem;
  }
  
  .zb-page-buttons {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .zb-book-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 1rem;
  }
  
  /* Ensure at least Previous, Next, and active buttons are visible on mobile */
  .zb-page-buttons .zb-page-btn:not(.zb-nav-btn):not(.active) {
    display: none;
  }
  
  .zb-page-buttons .zb-page-btn.zb-nav-btn,
  .zb-page-buttons .zb-page-btn.active {
    display: inline-flex !important;
  }
}