/* Book Shelf Styles */

.featured-books-shelves {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  margin-bottom: -128px;
  /* padding: 0 20px; */
}

.shelf-container {
  position: relative;
  margin-bottom: 40px;
  padding-bottom: 20px;
}

.shelf-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  display: flex;
  /* justify-content: center; */
}

.shelf-scroll-wrapper::-webkit-scrollbar {
  height: 8px;
}

.shelf-scroll-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.shelf-scroll-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.shelf-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.shelf-content {
  display: inline-block;
  min-width: min-content;
  margin: 0 auto;
}

.books-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 36px;
  padding: 0 40px 15px;
  min-height: 280px;
  margin: 0 auto;
}

.book-card {
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  flex-shrink: 0;
}

.shelf-content:has(.book-card:hover) .book-card:not(:hover) {
  opacity: 0.3;
}

.shelf-content .book-card:hover {
  opacity: 1;
}

.empty-shelf-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  font-family: 'Alice', serif;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.6);
}

/* Shelf Image */
.shelf-image {
  display: flex;
  align-items: flex-end;
  height: 106px;
  margin-top: -20px;
  position: relative;
  /* padding: 0 80px; */
}

.shelf-left-edge {
  width: 120px;
  height: 106px;
  background: url('/images/shelf-left-edge.png') no-repeat left center;
  background-size: contain;
  flex-shrink: 0;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .shelf-left-edge {
    background-image: url('/images/shelf-left-edge@2x.png');
  }
}

.shelf-middle {
  flex: 1;
  height: 106px;
  background: url('/images/shelf-middle.png') repeat-x center center;
  background-size: auto 106px;
  min-width: 0;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .shelf-middle {
    background-image: url('/images/shelf-middle@2x.png');
  }
}

.shelf-right-edge {
  width: 120px;
  height: 106px;
  background: url('/images/shelf-right-edge.png') no-repeat right center;
  background-size: contain;
  flex-shrink: 0;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .shelf-right-edge {
    background-image: url('/images/shelf-right-edge@2x.png');
  }
}

/* Book Card */
.book-card {
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  perspective: 1200px;
}

.book-link {
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  transform-style: preserve-3d;
}

.book-spine {
  position: absolute;
  left: 0;
  background: linear-gradient(90deg, #8B4513 0%, #654321 50%, #8B4513 100%);
  border-radius: 4px 4px 0 0;
  z-index: 0;
}

.book-cover-container {
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  will-change: transform;
  transform-origin: left center;
  z-index: 4;
  border-radius: 4px 4px 0 0;
}

.book-cover-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  border: 3px solid #000000;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px 4px 0 0;
}

.book-cover-front {
  position: absolute;
  left: 0;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px 4px 0 0;
}

.book-cover-back {
  position: absolute;
  left: 0;
  background: #000000;
  border-radius: 4px 4px 0 0;
  border: 3px solid #000000;
  transform: rotateY(180deg);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  opacity: 1;
  z-index: 1;
}

.book-cover-image {
  position: absolute;
  left: 0;
  object-fit: cover;
  object-position: center;
  border-radius: 4px 4px 0 0;
}

.book-cover-layer {
  position: absolute;
  left: 0;
  z-index: 10;
  object-fit: contain;
  object-position: center;
  border-radius: 4px 4px 0 0;
}

/* Book Info */
.book-info {
  margin-bottom: 12px;
  text-align: center;
  padding: 0 8px;
}

.book-title {
  font-family: 'Alice', serif;
  font-size: 16px;
  color: white;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-category {
  font-family: 'Alice', serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Book Shine Overlay */
.book-shine {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px 4px 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 15;
  mix-blend-mode: overlay;
}

/* Book Pages for Opening Effect */
.book-page {
  position: absolute;
  left: 0;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.5s ease-in-out, box-shadow 0.35s ease-in-out;
  background: #f5f5f5;
  border-radius: 4px 4px 0 0;
}

.book-page-1 { background: #efefef; z-index: 3; }
.book-page-2 { background: #f0f0f0; z-index: 2; }
.book-page-3 { background: #f5f5f5; z-index: 1; }

/* Hover Effects */
.book-card:hover .book-cover-container {
  transform: rotateY(-179deg) scale(1.05);
}

.book-card:hover .book-page-1 {
  transform: rotateY(-50deg) scale(1.02);
}

.book-card:hover .book-page-2 {
  transform: rotateY(-35deg) scale(1.02);
}

.book-card:hover .book-page-3 {
  transform: rotateY(-20deg) scale(1.02);
}


/* Responsive Design */
@media (max-width: 1400px) {
  .books-row {
    gap: 30px;
  }
}

@media (max-width: 1024px) {
  .books-row {
    gap: 24px;
  }

  .shelf-container {
    margin-bottom: -60px;
    padding-bottom: 80px;
  }

  .book-title {
    font-size: 14px;
  }

  .book-category {
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .books-row {
    gap: 20px;
    min-height: 240px;
    padding: 0 40px 15px;
  }

  .shelf-container {
    margin-bottom: -50px;
    padding-bottom: 70px;
  }
  .shelf-image{
    padding: 0;
  }

  .shelf-image img {
    max-width: 500px;
  }

  .book-title {
    font-size: 13px;
  }

  .book-category {
    font-size: 10px;
  }

  .book-info {
    margin-top: 8px;
  }
}

@media (max-width: 480px) {


  .books-row {
    gap: 16px;
    /* padding: 0 10px 15px; */
    min-height: 220px;
  }

  .shelf-image img {
    max-width: 400px;
  }
}

/* Loading State */
.shelf-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  font-family: 'Alice', serif;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
}

/* Animation */
@keyframes fadeIn {
  from {
    transform: translateY(20px);
  }
  to {
    transform: translateY(0);
  }
}

.book-card {
  animation: fadeIn 0.5s ease forwards;
}

.book-card:nth-child(1) { animation-delay: 0.1s; }
.book-card:nth-child(2) { animation-delay: 0.2s; }
.book-card:nth-child(3) { animation-delay: 0.3s; }
.book-card:nth-child(4) { animation-delay: 0.4s; }
