/* Library Page Layout */
.library-container {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-width: 1400px;
  margin: 0 auto;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
}

/* Clickable Stats Filters */
.library-stats-filters {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.stat-filter {
  flex: 1;
  min-width: 140px;
  background: #f8fafc;
  padding: 15px 20px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s;
  border: 2px solid transparent;
  cursor: pointer;
}

.stat-filter:hover {
  background: #eef2ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.stat-filter.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.stat-filter.active .stat-num,
.stat-filter.active .stat-label {
  color: white;
}

.library-stats-filters .stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.85rem;
  color: #4a5568;
  font-weight: 500;
}

/* Library Controls */
.library-controls {
  margin-bottom: 30px;
}

.library-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 250px;
}

.search-form input {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.95rem;
}

.search-form button {
  padding: 10px 15px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.sort-select {
  padding: 10px 15px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

/* Book Cover Link */
.library-container .book-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  border-radius: 8px 8px 0 0; /* Only round top corners */
  text-decoration: none;
  cursor: pointer;
  background: #f7fafc;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.book-cover:hover img {
  transform: scale(1.05);
}

.cover-placeholder-small {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
}



/* Book Card Info */
.book-card-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-title-link {
  text-decoration: none;
  color: inherit;
}

.book-title-link h4 {
  margin: 0;
  font-size: 1rem;
  color: #2d3748;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-title-link:hover h4 {
  color: #667eea;
}

.book-author {
  margin: 0;
  font-size: 0.85rem;
  color: #718096;
}

.book-series {
  margin: 0;
  font-size: 0.85rem;
}

.series-link {
  color: #667eea;
  text-decoration: none;
  font-style: italic;
}

.series-link:hover {
  text-decoration: underline;
}

.book-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #a0aec0;
  margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .library-stats-filters {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }
  
  .library-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .search-form {
    width: 100%;
  }
  
  .sort-select {
    width: 100%;
  }
}
/* Hide duplicate text that appears outside cards */
.books-grid > a,
.books-grid > p,
.books-grid > h4 {
  display: none;
}
