/* flipbook.css */
.book-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
  backdrop-filter: blur(10px);
}

.book-overlay.active {
  opacity: 1;
  visibility: visible;
}

.book-container {
  width: 900px;
  height: 600px;
  position: relative;
  perspective: 2000px;
  transition: transform 0.5s;
}

.book {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s;
}

.page {
  width: 50%;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  transform-origin: left;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
  z-index: 1;
  cursor: pointer;
}

.page-front,
.page-back {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden;
  padding: 40px;
  background: #fff;
  box-shadow: inset 3px 0 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.page-back {
  transform: rotateY(180deg);
}

.page.flipped {
  transform: rotateY(-180deg);
}

/* Page layering */
.page:nth-child(1) {
  z-index: 10;
}
.page:nth-child(2) {
  z-index: 9;
}
.page:nth-child(3) {
  z-index: 8;
}
/* ... and so on ... */

.book-cover {
  background: linear-gradient(135deg, #26a69a 0%, #00796b 100%);
  color: white;
  border-radius: 0 5px 5px 0;
}

.book-cover-back {
  background: #004d40;
  border-radius: 5px 0 0 5px;
}

.page-content {
  font-family: "Roboto", sans-serif;
  color: #334155;
}

.page-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  color: #0f172a;
}

.page-text {
  font-size: 1.125rem;
  line-height: 1.6;
  font-style: italic;
}

.close-book {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 50%;
  transition: background 0.3s;
}

.close-book:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1024px) {
  .book-container {
    width: 95%;
    height: 70vh;
  }
}

/* Mobile Responsive - Single Page View */
@media (max-width: 768px) {
  .book-container {
    width: 90%;
    height: 80vh;
    perspective: 1500px; /* Slightly reduced for mobile */
  }

  .page {
    width: 100%; /* Single page takes full container width */
    left: 0;
    right: auto;
    transform-origin: left center;
    overflow: hidden;
  }

  .page-front,
  .page-back {
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .page-text {
    font-size: 1rem;
    line-height: 1.5;
  }

  /* Adjust flipped position for single page to stay centered or move away */
  .page.flipped {
    transform: rotateY(-180deg);
    z-index: 100;
  }
}

.page-number {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: center;
  font-family: "Roboto", sans-serif;
}
