/* =====================
   BOOKS PAGE LAYOUT
===================== */

.books-page {
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* =====================
   BOOK GRID
===================== */

.books-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
}

/* =====================
   BOOK CARD
===================== */

.book-card {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform .2s ease, box-shadow .2s ease;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 22px rgba(0,0,0,.2);
}

.book-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 6px;
}

.book-card h3 {
  font-size: 14px;
  margin: 10px 0 4px;
}

.book-card p {
  font-size: 12px;
  color: #555;
}

/* =====================
   SEARCH BAR
===================== */

.book-search {
  max-width: 500px;
  margin: 0 auto 40px;
  position: relative;
}

.book-search input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--secondary);
  font-size: 16px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  max-height: 280px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
}

.search-results li {
  padding: 12px 16px;
  cursor: pointer;
}

.search-results li:hover {
  background: var(--card);
}

/* =====================
   RESPONSIVE
===================== */

@media (max-width: 1400px) {
  .books-container { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1100px) {
  .books-container { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
  .books-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .books-container { grid-template-columns: 1fr; }
}

/* =====================
   HOMEPAGE SLIDERS
===================== */

.homepage .book-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1rem 0 3rem;
}

.homepage .book-slider {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding: 10px 0;
  scroll-behavior: smooth;
}

.homepage .book-slider::-webkit-scrollbar {
  height: 6px;
}

.homepage .book-slider::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

.homepage .book-card {
  flex: 0 0 160px;      /* fixed width for sliders */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--card);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.homepage .book-card img {
  width: 100%;
  height: 220px;        /* fixed height */
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}

.homepage .book-card h3 {
  font-size: 14px;
  margin: 6px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.homepage .book-card p {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-detail-container {
  max-width: 800px;
  margin: 60px auto;
  padding: 20px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  text-align: center;
}

.book-detail-container img {
  width: 200px;
  height: auto;
  margin-bottom: 20px;
  border-radius: 8px;
}

.book-detail-container h1 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.book-detail-container h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--secondary);
}

.book-detail-container p {
  font-size: 1rem;
  color: var(--text);
}

.book-detail-container {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  width: 100%;
  max-width: 1400px; /* optional */
  margin: 60px auto;
  padding: 20px;
}

.book-detail-container img#book-cover {
  width: 220px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.book-detail-info {
  flex: 1;
}

.book-detail-info h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin: 0 0 10px;
  color: var(--primary);
}

.book-detail-info h3 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1.2rem;
  margin: 0 0 10px;
  color: var(--secondary);
}

.book-detail-info p#book-themes {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--accent);
  margin: 5px 0 15px;
}

.book-detail-info p#book-description {
  font-size: 1rem;
  line-height: 1.6;
  margin-top: 10px;
}

/* =====================
   BOOK DETAIL LAYOUT
===================== */

.book-detail-container {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  max-width: 1000px;
  margin: 60px auto;
  padding: 30px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.book-detail-left {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#book-cover {
  width: 220px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Add to Library Button */
#add-to-library-btn {
  margin-top: 14px;
  padding: 10px 18px;
  border-radius: 22px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

#add-to-library-btn i {
  margin-right: 6px;
}

#add-to-library-btn:hover {
  background: var(--secondary);
  transform: translateY(-1px);
}

/* Right-side info */
.book-detail-info {
  flex: 1;
}

.book-detail-info h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  margin-bottom: 8px;
  color: var(--primary);
}

.book-detail-info h3 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--secondary);
}

#book-themes {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--accent);
}

/* Book Actions Container */
.book-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
}

.action-btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.library-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
}

.library-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 58, 95, 0.3);
}

.wishlist-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
  color: white;
}

.wishlist-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.action-btn i {
  font-size: 1.1rem;
}