/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  background-color: #f0e6d2;
  color: #5d4037;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url('/api/placeholder/800/600');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Book Container */
.book-container {
  width: 90%;
  max-width: 1000px;
  height: 80vh;
  perspective: 2000px;
  position: relative;
}

.book {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform 0.7s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}

/* Page Styles */
.page {
  width: 50%;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  transform-origin: left center;
  transition: transform 0.7s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  transform-style: preserve-3d;
  background-color: #fff8e1;
  border-radius: 0 10px 10px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 20px;
  z-index: 1;
}

.page-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  position: relative;
  z-index: 2;
}

.page-front,
.page-back {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  padding: 2rem;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.page-back {
  transform: rotateY(180deg);
}

/* Cover Page */
.cover {
  width: 50%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: #4a5568;
  border-radius: 10px 0 0 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  color: #f0e6d2;
  background-image: url('/api/placeholder/500/600');
  background-size: cover;
  background-position: center;
}

.cover h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.cover p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Page Content Styling */
.page-title {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #5d4037;
}

.page-text {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.image-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  margin: 1rem 0;
  border: 3px solid #f0e6d2;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.memory-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Navigation */
.nav-buttons {
  position: absolute;
  bottom: 20px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10%;
  z-index: 100;
}

.nav-btn {
  background-color: #76a9a3;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
  background-color: #5d8c88;
  transform: translateY(-2px);
}

.nav-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Ghibli-inspired Decorative Elements */
.decoration {
  position: absolute;
  z-index: 1;
  opacity: 0.15;
}

.soot-sprite {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #333;
  position: absolute;
}

.soot-sprite.s1 {
  top: 10%;
  left: 10%;
}

.soot-sprite.s2 {
  top: 20%;
  right: 15%;
}

.soot-sprite.s3 {
  bottom: 25%;
  left: 20%;
}

.soot-sprite.s4 {
  bottom: 10%;
  right: 10%;
}

.leaf {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50% 0 50% 50%;
  background-color: #76a9a3;
  transform: rotate(45deg);
}

.leaf.l1 {
  top: 15%;
  right: 20%;
}

.leaf.l2 {
  bottom: 30%;
  left: 15%;
}

/* Page number */
.page-number {
  position: absolute;
  bottom: 10px;
  right: 20px;
  font-size: 0.9rem;
  color: #888;
}

/* Animation for page turn */
.turn {
  transform: rotateY(-180deg);
  z-index: 0;
}

/* Back Cover */
.back-cover {
  width: 50%;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  background-color: #4a5568;
  border-radius: 0 10px 10px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  color: #f0e6d2;
  background-image: url('/api/placeholder/500/600');
  background-size: cover;
  background-position: center;
  z-index: -1;
}

.music-player {
  position: fixed;
  bottom: -80px;
  right: 20px;
  width: 300px;
  background-color: rgba(118, 169, 163, 0.9);
  border-radius: 20px 20px 0 0;
  padding: 10px;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
  color: white;
  transition: bottom 0.5s ease;
  z-index: 1000;
}

.music-player.show {
  bottom: 0;
}

.player-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.song-info {
  text-align: center;
  font-size: 0.9rem;
  font-weight: bold;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.player-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.player-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 80%;
}

.volume-icon {
  font-size: 0.8rem;
}

#volume-slider {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  outline: none;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.toggle-player {
  position: absolute;
  top: -30px;
  right: 20px;
}

#toggle-player-btn {
  background-color: rgba(118, 169, 163, 0.9);
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  font-size: 1rem;
  transition: all 0.3s ease;
}

#toggle-player-btn:hover {
  transform: scale(1.1);
}