/* Overall page background */
.bookshelf-page {
  min-height: 100vh;
  background: url('/images/wood-bg.png') center/cover fixed;
  padding: 18px;
  box-sizing: border-box;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.search { display: flex; align-items: center; }

.logo { display: flex; align-items: center; gap: 10px; margin-right: auto; }

.logo-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.logo-text {
  font-weight: 800;
  color: #fff;
  letter-spacing: .5px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.topbar img.topbar-icon {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1) !important;
  opacity: 0.9;
  cursor: pointer;
  transition: opacity 0.2s;
}

.topbar img.topbar-icon:hover {
  opacity: 1;
}

/* Wood frame around all shelves */
.shelf-frame {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, #7a4a2d 0%, #4a2b1a 55%, #2f1b11 100%);
  box-shadow:
    0 18px 34px rgba(0,0,0,.55),
    inset 0 0 0 2px rgba(255,255,255,.08),
    inset 0 10px 30px rgba(0,0,0,.35);
}

/* Inner shelf area */
.shelf-area {
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

/* Fixed-height shelf */
.shelf {
  height: 340px;
  margin: 14px 0 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Books row within fixed lane */
.shelf-books {
  height: 285px;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 14px 10px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
}

.shelf-books::-webkit-scrollbar { height: 10px; }
.shelf-books::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.22);
  border-radius: 10px;
}

.book {
  flex: 0 0 130px;
  max-width: 130px;
  cursor: pointer;
  user-select: none;
  transform: translateZ(0);
  transition: transform .18s ease, filter .18s ease;
  scroll-snap-align: start;
}

.book img {
  width: 100%;
  height: 195px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 4px 8px 16px rgba(0,0,0,.55);
}

.book:hover {
  transform: scale(1.06);
  filter: brightness(1.05);
}

.book-label {
  margin-top: 6px;
  text-align: center;
  color: rgba(255,255,255,.92);
  font-size: 12px;
  text-shadow: 0 2px 3px rgba(0,0,0,.8);
}

/* Shelf plank */
.shelf-plank {
  height: 16px;
  background: linear-gradient(180deg, #7b4a2e 0%, #4f2e1c 55%, #3a2216 100%);
  border-radius: 8px;
  box-shadow:
    0 12px 18px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -2px 0 rgba(0,0,0,.35);
}

.empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(0,0,0,.45);
  color: #fff;
}

/* Preview modal */
.preview {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  padding: 10px;
}

.preview-cover {
  width: 100%;
  border-radius: 8px;
  box-shadow: 6px 10px 20px rgba(0,0,0,.6);
}

.preview-meta h2 { margin: 0 0 8px 0; }

/* Modal overlay */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog-box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 720px;
  max-width: 95vw;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  color: #555;
}

@media (min-width: 1100px) {
  .book { flex-basis: 150px; max-width: 150px; }
  .book img { height: 225px; aspect-ratio: 2 / 3; }
  .shelf { height: 360px; }
  .shelf-books { height: 305px; }
}
