/* Book Showcase Styles */
.book-container {
  position: relative;
  width: 100%;
  height: 500px;
  perspective: 1000px;
}

.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 100%;
  z-index: 10;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.book-pages {
  position: absolute;
  left: 60px;
  top: 0;
  width: calc(100% - 60px);
  height: 100%;
}

.book-container {
  perspective: 1500px;
  transform-style: preserve-3d;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  height: 600px;
  position: relative;
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  display: flex;
  justify-content: center;
  gap: 0;
}

.book-page {
  width: 50%;
  height: 100%;
  position: relative;
  background: #fff;
  transform-origin: center;
  transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.book-page.left {
  border-radius: 15px 0 0 15px;
  transform: rotateY(0deg);
  border-right: 2px solid #ddd;
}

.book-page.right {
  border-radius: 0 15px 15px 0;
  transform: rotateY(0deg);
}

.book-content {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.book-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.page-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 10%);
  border-radius: inherit;
  pointer-events: none;
}

.book-navigation {
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 10;
}

.book-nav-btn {
  background: #FCD34D;
  color: #000;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-nav-btn:hover {
  background: #F59E0B;
  transform: translateY(-2px);
}

.book-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.page-number {
  position: absolute;
  bottom: 20px;
  font-size: 14px;
  color: #666;
}

.left .page-number {
  right: 20px;
}

.right .page-number {
  left: 20px;
}

@media (max-width: 768px) {
  .book-container {
    height: 400px;
  }
  
  .book-navigation {
    bottom: -60px;
  }
  
  .book-nav-btn {
    padding: 8px 16px;
    font-size: 14px;
  }
}

.book-page.active {
  transform: rotateY(0deg) translateZ(0px);
}

.book-page.inactive {
  transform: rotateY(-10deg) translateZ(-50px);
}

.book-controls {
  z-index: 20;
}

.prev-page, .next-page {
  transition: all 0.3s ease;
}

.prev-page:hover {
  transform: scale(1.1) translateY(-2px);
}

.next-page:hover {
  transform: scale(1.1) translateY(2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .book-container {
    height: 400px;
  }

  .book-spine {
    width: 40px;
  }

  .book-pages {
    left: 40px;
    width: calc(100% - 40px);
  }

  .book-controls {
    right: -12px;
  }

  .prev-page, .next-page {
    width: 40px;
    height: 40px;
  }
}

/* Page flip animation rules */
.book-page {
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.book-page.left { transform-origin: right center; }
.book-page.right { transform-origin: left center; }

.book-content {
  position: relative;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

/* flip forward (right page turns to the left) */
.book-page.right.flip {
  transform: rotateY(-180deg);
  z-index: 30;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

/* flip backward (left page turns to the right) */
.book-page.left.flip-left {
  transform: rotateY(180deg);
  z-index: 30;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

.book-page .book-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

.book-page .book-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

/* smooth transition timing */
.book-page {
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
