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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #f5f5f5 0%, #e0e0e0 100%);
  min-height: 100vh;
}

.bookshelf-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.bookshelf-title {
  text-align: center;
  font-size: 2.5em;
  color: #333;
  margin-bottom: 40px;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

/* Shelf Row */
.shelf-row {
  position: relative;
  margin-bottom: 60px;
}

.books-container {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 20px 40px 30px;
  position: relative;
  z-index: 2;
}

/* Wooden Shelf */
.shelf {
  position: relative;
  height: 30px;
  background: linear-gradient(180deg, 
    #c9a66b 0%, 
    #b8956a 20%, 
    #a67c52 40%,
    #8b6914 60%,
    #a67c52 80%,
    #c9a66b 100%
  );
  border-radius: 3px;
  box-shadow: 
    0 8px 20px rgba(0,0,0,0.3),
    0 2px 4px rgba(0,0,0,0.2),
    inset 0 2px 3px rgba(255,255,255,0.3),
    inset 0 -2px 3px rgba(0,0,0,0.2);
}

.shelf::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(180deg, 
    rgba(255,255,255,0.3) 0%,
    rgba(255,255,255,0.1) 50%,
    transparent 100%
  );
  border-radius: 3px 3px 0 0;
}

.shelf::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 10px;
  right: 10px;
  height: 15px;
  background: linear-gradient(180deg, 
    rgba(0,0,0,0.2) 0%,
    transparent 100%
  );
  border-radius: 0 0 50% 50%;
}

/* Book/Magazine Item */
.book-item {
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  transform-origin: bottom center;
}

.book-item:hover {
  transform: translateY(-15px) scale(1.05);
  z-index: 10;
}

.book-item:hover .book-shadow {
  opacity: 0.6;
  transform: scale(1.1);
}

.book-cover {
  width: 160px;
  height: 220px;
  background-size: cover;
  background-position: center;
  border-radius: 2px 6px 6px 2px;
  box-shadow: 
    -3px 0 10px rgba(0,0,0,0.2),
    5px 5px 15px rgba(0,0,0,0.3),
    inset -2px 0 5px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

/* Book spine effect */
.book-cover::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(90deg, 
    rgba(0,0,0,0.3) 0%,
    rgba(0,0,0,0.1) 50%,
    transparent 100%
  );
}

/* Book shine effect */
.book-cover::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30%;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(255,255,255,0.1) 50%,
    rgba(255,255,255,0.2) 100%
  );
}

.book-shadow {
  position: absolute;
  bottom: -10px;
  left: 10%;
  width: 80%;
  height: 20px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
  transition: all 0.3s ease;
}

/* Book title overlay */
.book-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.book-item:hover .book-title {
  opacity: 1;
}

/* Loading state */
.book-item.loading .book-cover {
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader {
  width: 30px;
  height: 30px;
  border: 3px solid #ccc;
  border-top-color: #666;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Suggestion text */
.suggestion {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-top: 30px;
  font-style: italic;
}

/* Modal/Viewer for flipbook */
.flipbook-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  overflow: auto;
}

.flipbook-modal.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(rgba(0,0,0,0.8), transparent);
  z-index: 1001;
}

.modal-title {
  color: white;
  font-size: 1.2em;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 2em;
  cursor: pointer;
  padding: 5px 15px;
  transition: transform 0.2s;
}

.close-btn:hover {
  transform: scale(1.2);
}

.flipbook-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 20px 20px;
}

/* Navigation arrows */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 2em;
  padding: 20px 15px;
  cursor: pointer;
  transition: background 0.3s;
  z-index: 1002;
}

.nav-arrow:hover {
  background: rgba(255,255,255,0.4);
}

.nav-arrow.prev {
  left: 20px;
  border-radius: 0 5px 5px 0;
}

.nav-arrow.next {
  right: 20px;
  border-radius: 5px 0 0 5px;
}

/* Flipbook styles */
.flipbook {
  margin: 0 auto;
}

.flipbook .page {
  background: white;
}

.flipbook .page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Footer */
footer {
  text-align: center;
  padding: 30px;
  color: #666;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 900px) {
  .books-container {
    flex-wrap: wrap;
    gap: 30px;
  }
  
  .book-cover {
    width: 130px;
    height: 180px;
  }
}

@media (max-width: 600px) {
  .books-container {
    gap: 20px;
  }
  
  .book-cover {
    width: 100px;
    height: 140px;
  }
  
  .bookshelf-title {
    font-size: 1.8em;
  }
}
