/* ==========================================================================
   shelf.css - 3D Realistic Children's Wooden Bookshelf
   Faithfully inspired by the user's reference snapshot with:
   - Rich wood grain & layered 3D shelf ledges
   - Themed shelf plaques (CONTINUE READING, CLASSIC TALES, CHRISTMAS, etc.)
   - Snow wallpaper backdrop for Christmas shelf
   - 3D Hardcover books with spine highlights, page rims & golden lock tabs
   - Touch drag & arrow horizontal scrolling with hidden scrollbars
   - Standing shelf figurine (Santa/Elf)
   ========================================================================== */

/* Top Navigation Bar */
.shelf-header {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  gap: 16px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ⭐ COME ALIVE Header Call-To-Action (Warm Golden Pill matching Reference) */
.btn-come-alive-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fef08a 0%, #fde047 50%, #facc15 100%);
  border: 2px solid #f59e0b;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease, filter 0.2s ease;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.btn-come-alive-header:hover {
  transform: scale(1.05);
  filter: brightness(1.03);
  box-shadow: 0 5px 14px rgba(245, 158, 11, 0.45);
}

.btn-come-alive-header:active {
  transform: scale(0.97);
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.3);
}

.come-alive-sparkle {
  font-size: 16px;
  display: inline-block;
}

.come-alive-text {
  font-family: 'Fredoka', 'Quicksand', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #78350f;
  letter-spacing: 0.8px;
  text-shadow: none;
}

/* Center Frosted Rounded Navigation Capsule (Library, Create, Manage, Shelves, Settings) */
.header-nav-capsule {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-pill);
  padding: 4px 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

.nav-capsule-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-family: 'Fredoka', 'Quicksand', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-capsule-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #1e293b;
}

.nav-capsule-btn.active {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.35);
}

.nav-capsule-btn .nav-icon {
  font-size: 15px;
}

/* User Profile Header Group */
.user-header-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Avatar Circle (SM badge) */
.user-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  color: #ffffff;
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  border: 2px solid #ffffff;
  cursor: default;
}

/* Auth Header Container & Pill */
.auth-header-container {
  position: relative;
}

.btn-auth-header {
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth-header:hover {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Header Round Action Buttons (Sound, Settings) */
.header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.2s var(--ease-bounce), background 0.2s ease, box-shadow 0.2s ease;
}

.header-btn:hover {
  background: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: #1e293b;
}

/* Bookshelf Cabinet Wrapper */
.bookshelf-outer {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  position: relative;
  padding: 0 16px 16px 16px;
}

@media (min-width: 768px) {
  .bookshelf-outer {
    padding: 0 28px 18px 28px;
  }
}

/* Warm Honey-Oak Wooden Cabinet Frame */
.bookshelf-frame {
  width: 100%;
  max-width: 1400px;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 
    0 16px 45px rgba(180, 83, 9, 0.22),
    0 0 0 10px #c25e00,
    0 0 0 13px #9e3d00;
  border-radius: 20px;
  overflow: hidden;
  background: #fffcf7;
}

/* Wooden Side Pillars (Warm Honey Oak) */
.shelf-pillar-left, .shelf-pillar-right {
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22px;
  z-index: 35;
  background: linear-gradient(
    90deg, 
    #9e3d00 0%, 
    #c25e00 25%, 
    #ea6c00 50%, 
    #c25e00 75%, 
    #832f00 100%
  );
  pointer-events: none;
}

.shelf-pillar-left {
  left: 0;
  border-right: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset -2px 0 6px rgba(0, 0, 0, 0.25);
}

.shelf-pillar-right {
  right: 0;
  border-left: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 2px 0 6px rgba(0, 0, 0, 0.25);
}

@media (min-width: 768px) {
  .shelf-pillar-left, .shelf-pillar-right {
    width: 28px;
  }
}

/* ==========================================================================
   VERTICAL SCROLLING BOOKCASE CONTAINER
   ========================================================================== */
.bookshelf-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: 90px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bookshelf-viewport::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   INDIVIDUAL SHELF ROW UNIT & THEMATIC BACKDROPS
   ========================================================================== */
.shelf-unit {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  overflow: visible;
  min-height: 270px;
  flex-shrink: 0;
}

@media (min-width: 480px) {
  .shelf-unit {
    min-height: 285px;
  }
}

@media (min-width: 768px) {
  .shelf-unit {
    min-height: 295px;
  }
}

/* Shelf Thematic Scenic Backdrop */
.shelf-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 28px; /* Room for wooden ledge */
  z-index: 1;
  overflow: hidden;
  background: linear-gradient(180deg, #fef9c3 0%, #ecfdf5 100%);
}

/* Shelf 1: Continue Reading (Sunny Blue Sky & Cloud Backdrop) */
.shelf-unit[data-theme="continue_reading"] .shelf-backdrop,
.shelf-unit[data-shelf-id="continue_reading"] .shelf-backdrop {
  background: linear-gradient(180deg, #c7ecf8 0%, #e0f2fe 55%, #f0fdf4 100%);
}

/* Shelf 1 Top-Left Draping Tropical Leaves */
.shelf-leaves-top-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 175px;
  height: 125px;
  z-index: 6;
  pointer-events: none;
  background: url('../assets/images/shelf1_leaves_photo.png') no-repeat top left;
  background-size: contain;
}

/* Shelf 5 Crescent Moon with Face */
.shelf-moon-left {
  position: absolute;
  top: 14px;
  left: 18px;
  width: 110px;
  height: 110px;
  z-index: 6;
  pointer-events: none;
  background: url('../assets/images/shelf5_moon_photo.png') no-repeat center;
  background-size: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

/* Shelf 2: Classic Tales (Dreamy Fairytale Pink & Peach Sunset) */
.shelf-unit[data-theme="classic_tales"] .shelf-backdrop,
.shelf-unit[data-shelf-id="classic_tales"] .shelf-backdrop {
  background: linear-gradient(180deg, #fed7aa 0%, #fbcfe8 45%, #ffedd5 80%, #dcfce7 100%);
}

/* Shelf 3: Christmas (Magical Winter Twilight with Snow) */
.shelf-unit[data-theme="christmas_snow"] .shelf-backdrop,
.shelf-unit[data-shelf-id="christmas"] .shelf-backdrop {
  background: linear-gradient(180deg, #1e3a8a 0%, #2563eb 45%, #60a5fa 75%, #93c5fd 100%);
  background-image: 
    radial-gradient(2px 2px at 30px 25px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2.5px 2.5px at 70px 75px, rgba(255,255,255,0.85), rgba(0,0,0,0)),
    radial-gradient(2px 2px at 130px 40px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
    radial-gradient(3px 3px at 200px 85px, rgba(255,255,255,0.95), rgba(0,0,0,0)),
    radial-gradient(2px 2px at 290px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2.5px 2.5px at 370px 95px, rgba(255,255,255,0.8), rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 400px 140px;
}

/* Shelf 4: Activities (Sunny Meadow with Lush Green Foliage) */
.shelf-unit[data-theme="activities"] .shelf-backdrop,
.shelf-unit[data-shelf-id="activities"] .shelf-backdrop {
  background: linear-gradient(180deg, #fef9c3 0%, #fef08a 40%, #ecfdf5 75%, #dcfce7 100%);
}

/* Shelf 5: Bedtime Magic (Starry Royal Indigo Twilight) */
.shelf-unit[data-theme="bedtime_magic"] .shelf-backdrop,
.shelf-unit[data-shelf-id="bedtime_magic"] .shelf-backdrop {
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 40%, #4338ca 70%, #6366f1 100%);
  background-image: 
    radial-gradient(2px 2px at 60px 30px, #fef08a, transparent),
    radial-gradient(2px 2px at 150px 80px, #ffffff, transparent),
    radial-gradient(3px 3px at 280px 45px, #fed7aa, transparent),
    radial-gradient(2px 2px at 380px 90px, #fbcfe8, transparent);
  background-size: 320px 120px;
}

/* ==========================================================================
   FLOATING CENTERED GLOSSY CATEGORY PLAQUES
   ========================================================================== */
.shelf-category-plaque {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  border-radius: var(--radius-pill);
  padding: 6px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease;
  white-space: nowrap;
}

.shelf-category-plaque:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.shelf-category-plaque .plaque-icon {
  font-size: 15px;
}

.shelf-category-plaque .plaque-title {
  font-weight: 700;
}

.shelf-category-plaque .plaque-chevron {
  font-size: 16px;
  font-weight: 800;
  margin-left: 2px;
  opacity: 0.9;
}

/* Plaque Theme Colors */
.plaque-continue_reading {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
}

.plaque-classic_tales {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 50%, #db2777 100%);
}

.plaque-christmas {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #b91c1c 100%);
}

.plaque-activities {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
}

.plaque-bedtime_magic {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #6366f1 100%);
}

/* ==========================================================================
   RIGHT SCENIC DIORAMA ILLUSTRATIONS
   ========================================================================== */
.shelf-diorama {
  position: absolute;
  right: 8px;
  bottom: 28px;
  height: 205px;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .shelf-diorama {
    right: 18px;
    height: 220px;
  }
}

.diorama-art {
  height: 100%;
  max-height: 220px;
  width: auto;
  object-fit: contain;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.25s var(--ease-bounce);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.16));
}

.diorama-art-bunny {
  max-height: 215px;
}

.diorama-art-castle {
  max-height: 220px;
  filter: none !important;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 32px, #000 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 32px, #000 100%);
}

.diorama-art-xmas {
  max-height: 220px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}

.diorama-art-monkey {
  max-height: 215px;
}

.diorama-art-bedtime {
  max-height: 205px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.3));
}

.diorama-art:hover {
  transform: scale(1.05);
}

.diorama-bounce {
  animation: dioramaBounce 0.5s var(--ease-bounce);
}

@keyframes dioramaBounce {
  0% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.15) translateY(-14px); }
  100% { transform: scale(1) translateY(0); }
}

/* ==========================================================================
   HORIZONTAL SCROLLABLE ROW FOR BOOKS
   ========================================================================== */
.shelf-books-row-wrapper {
  position: relative;
  width: 100%;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  min-height: 245px;
}

.shelf-books-row {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 48px 0 6px 52px;
  overflow-x: auto;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  width: 100%;
  min-height: 245px;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: grab;
}

.shelf-books-row:active {
  cursor: grabbing;
}

.shelf-books-row::-webkit-scrollbar {
  display: none;
}

/* Circular White Navigation Chevron Buttons (< and >) */
.shelf-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: none;
  color: #475569;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  opacity: 0.95;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s var(--ease-bounce), box-shadow 0.2s ease, color 0.2s ease;
}

.shelf-arrow:hover {
  opacity: 1;
  background: #ffffff;
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
  color: #1e293b;
}

.shelf-arrow-left {
  left: 14px;
}

.shelf-arrow-right {
  right: 14px;
}

/* ==========================================================================
   3D HARDCOVER BOOK STYLING
   ========================================================================== */
.shelf-book {
  position: relative;
  flex: 0 0 112px;
  height: 162px;
  border-radius: 6px 10px 10px 6px;
  overflow: visible;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.22s var(--ease-bounce), box-shadow 0.22s ease;
  perspective: 600px;
}

@media (min-width: 480px) {
  .shelf-book {
    flex: 0 0 130px;
    height: 188px;
  }
}

@media (min-width: 768px) {
  .shelf-book {
    flex: 0 0 148px;
    height: 215px;
  }
}

/* Book Hover / Active Touch Lift */
.shelf-book:hover {
  transform: translateY(-8px) scale(1.04);
}

.shelf-book:active {
  transform: translateY(-3px) scale(0.98);
}

/* Book 3D Inner Container & Cover Image */
.book-spine-cover {
  width: 100%;
  height: 100%;
  border-radius: 5px 9px 9px 5px;
  position: relative;
  overflow: hidden;
  box-shadow: 
    -3px 4px 10px rgba(0, 0, 0, 0.6),
    0 10px 20px rgba(0, 0, 0, 0.45);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Realistic 3D Rounded Book Spine on the Left */
.book-spine-shine {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  bottom: 0;
  background: linear-gradient(
    90deg, 
    rgba(0, 0, 0, 0.4) 0%, 
    rgba(255, 255, 255, 0.35) 28%, 
    rgba(255, 255, 255, 0.08) 55%, 
    rgba(0, 0, 0, 0.3) 85%, 
    rgba(255, 255, 255, 0.15) 100%
  );
  border-right: 1px solid rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 3;
}

/* Book Top & Bottom Paper Page Edge Trims */
.book-page-trim-top {
  position: absolute;
  top: 0;
  left: 10px;
  right: 0;
  height: 4px;
  background: linear-gradient(180deg, #fef3c7 0%, #d4b584 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 2;
}

.book-page-trim-bottom {
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 0;
  height: 5px;
  background: linear-gradient(180deg, #b89868 0%, #fef3c7 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 2;
}

/* ==========================================================================
   BOOK EXPERIENCE LEVEL BADGES (FREE, COME ALIVE, CINEMATIC)
   ========================================================================== */
.book-tier-badge {
  position: absolute;
  top: 8px;
  right: 6px;
  z-index: 12;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: badgePop 0.3s var(--ease-bounce);
}

.book-tier-badge.tier-come-alive {
  background: linear-gradient(135deg, #db2777 0%, #7c3aed 100%);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.book-tier-badge.tier-cinematic {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #d97706 100%);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@keyframes badgePop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   BOOKSHELF SELECTION MODE (Choosing Books to Upgrade)
   ========================================================================== */
.selection-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 45;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto 12px auto;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid #ec4899;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(236, 72, 153, 0.35);
  border-radius: 16px;
  align-items: center;
  justify-content: space-between;
  animation: slideDownBanner 0.3s var(--ease-bounce);
}

.selection-banner.active {
  display: flex;
}

@keyframes slideDownBanner {
  0% { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.selection-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.selection-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.5);
  animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.selection-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.selection-counter {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: #fde047;
  margin: 2px 0 0 0;
}

.selection-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-selection-action {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease;
  border: none;
}

.btn-selection-confirm {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4), 0 0 15px rgba(16, 185, 129, 0.4);
  animation: pulseConfirm 1.8s infinite ease-in-out;
}

.btn-selection-confirm:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

@keyframes pulseConfirm {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.btn-selection-change {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: #f1f5f9;
}

.btn-selection-change:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.04);
}

.btn-selection-cancel {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  color: #fca5a5;
}

.btn-selection-cancel:hover {
  background: rgba(239, 68, 68, 0.4);
  transform: scale(1.04);
}

/* Books Selected State in Selection Mode */
.shelf-book.is-selected {
  transform: translateY(-14px) scale(1.08) !important;
}

.shelf-book.is-selected .book-spine-cover {
  outline: 4px solid #facc15;
  box-shadow: 0 0 25px rgba(250, 204, 21, 0.8), 0 14px 28px rgba(0, 0, 0, 0.8) !important;
}

/* Checkmark Badge on Selected Book */
.book-selection-check {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 3px solid #ffffff;
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 20px rgba(16, 185, 129, 0.8);
  z-index: 20;
  pointer-events: none;
  animation: checkPop 0.3s var(--ease-bounce);
}

@keyframes checkPop {
  0% { transform: translate(-50%, -50%) scale(0.3); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Books Dimmed when Limit Reached */
.shelf-book.selection-dimmed {
  opacity: 0.4;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.shelf-book.selection-dimmed:hover {
  transform: none;
}

/* Book Soft Cast Shadow on Wooden Shelf Ledge */
.book-cast-shadow {
  position: absolute;
  bottom: -6px;
  left: 8px;
  right: 8px;
  height: 10px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.7) 0%, transparent 75%);
  pointer-events: none;
  z-index: 1;
}

/* Standing Decorative Figurine (Like Santa/Elf in the screenshot) */
.shelf-figurine {
  position: relative;
  flex: 0 0 65px;
  height: 120px;
  margin-bottom: 2px;
  cursor: pointer;
  z-index: 4;
  animation: figurineIdle 3s ease-in-out infinite alternate;
  transform-origin: bottom center;
}

.shelf-figurine img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

@keyframes figurineIdle {
  0% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(-2deg) translateY(-2px); }
  100% { transform: rotate(2deg) translateY(0); }
}

.shelf-figurine:active {
  animation: figurineJump 0.4s var(--ease-bounce);
}

@keyframes figurineJump {
  0% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.15) translateY(-14px); }
  100% { transform: scale(1) translateY(0); }
}

/* ==========================================================================
   3D WARM HONEY OAK WOODEN SHELF LEDGE
   ========================================================================== */
.shelf-wood-ledge {
  position: relative;
  width: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 24px rgba(120, 53, 15, 0.22);
}

/* Top Lip / Surface of the Shelf (Warm golden highlight) */
.shelf-surface-top,
.shelf-ledge-lip {
  width: 100%;
  height: 8px;
  background: linear-gradient(
    180deg, 
    #fef3c7 0%, 
    #fde68a 50%, 
    #f59e0b 100%
  );
  box-shadow: 
    inset 0 1.5px 1.5px rgba(255, 255, 255, 0.85),
    0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Front Face Bevel of the Shelf (Rich honey-maple wood grain) */
.shelf-surface-front,
.shelf-ledge-face {
  width: 100%;
  height: 22px;
  background: linear-gradient(
    180deg, 
    #ea6c00 0%, 
    #c25e00 60%, 
    #832f00 100%
  );
  box-shadow: 
    0 8px 18px rgba(120, 53, 15, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 0 0 4px 4px;
}

/* Add Book Quick Button at end of shelf (Vertically centered dashed container matching reference) */
.shelf-add-book-card {
  align-self: center;
  flex: 0 0 135px;
  height: 195px;
  border: 2px dashed rgba(180, 130, 95, 0.65);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #78350f;
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  transition: all 0.2s var(--ease-bounce);
  scroll-snap-align: start;
  margin-bottom: 2px;
}

@media (min-width: 480px) {
  .shelf-add-book-card {
    flex: 0 0 142px;
    height: 205px;
  }
}

.shelf-add-book-card:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: #d97706;
  color: #92400e;
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(180, 83, 9, 0.15);
}

.shelf-add-book-card .plus-icon {
  font-size: 26px;
  font-weight: 900;
  color: #b45309;
  line-height: 1;
}

/* Empty Shelf Slot & Frosted Card (Matching Bedtime Magic in reference) */
.shelf-empty-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
}

.empty-slot-card {
  width: 250px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 24px;
  margin: 0 auto;
  align-self: center;
  animation: floatCard 3s ease-in-out infinite alternate;
}

@keyframes floatCard {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.empty-slot-moon-icon {
  font-size: 34px;
  margin-bottom: 6px;
  display: inline-block;
}

.empty-slot-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}

.empty-slot-hint {
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 14px;
}

.empty-slot-add-btn {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  color: #ffffff;
  border-radius: var(--radius-pill);
  padding: 8px 22px;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(139, 92, 246, 0.4);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease;
}

.empty-slot-add-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 5px 16px rgba(139, 92, 246, 0.55);
}

/* ==========================================================================
   COME ALIVE & CINEMATIC PACKAGES MODAL STYLING
   ========================================================================== */
#come-alive-modal.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 8, 20, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#come-alive-modal.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.come-alive-card {
  background: linear-gradient(180deg, #111827 0%, #0b0f19 100%);
  border: 2px solid rgba(236, 72, 153, 0.6);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 40px rgba(236, 72, 153, 0.25);
  border-radius: 28px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px 32px 28px 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: scaleInCard 0.35s var(--ease-bounce);
}

@keyframes scaleInCard {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.package-close-btn {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.package-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: rotate(90deg);
}

.package-header-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.free-notice-pill {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.package-main-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.package-subtitle {
  font-family: var(--font-body);
  font-size: 15px;
  color: #cbd5e1;
  max-width: 600px;
  line-height: 1.45;
  margin: 0;
}

/* Packages 2-Card Grid */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
  margin-bottom: 20px;
}

.package-card {
  background: rgba(30, 41, 59, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  text-align: left;
  transition: transform 0.25s var(--ease-bounce), border-color 0.25s ease, box-shadow 0.25s ease;
}

.package-card:hover {
  transform: translateY(-6px);
  border-color: rgba(254, 240, 138, 0.5);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.package-card.tier-come-alive {
  border-color: rgba(236, 72, 153, 0.4);
}

.package-card.tier-cinematic.featured-card {
  border: 2px solid #06b6d4;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.3) 0%, rgba(15, 23, 42, 0.9) 100%);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.25);
}

.package-card.tier-cinematic.featured-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.45);
}

.best-value-ribbon {
  position: absolute;
  top: -13px;
  right: 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.5);
}

.package-card-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.package-card-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.package-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px 0;
}

.package-price {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  color: #fde047;
  line-height: 1.1;
  margin-bottom: 4px;
}

.package-books-count {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #67e8f9;
  letter-spacing: 0.3px;
}

.package-plus-tag {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.package-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.package-features-list li {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: #e2e8f0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}

.feat-check {
  color: #10b981;
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.btn-package-choose {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease;
  text-align: center;
}

.btn-choose-come-alive {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}

.btn-choose-come-alive:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

.btn-choose-cinematic {
  background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #f59e0b 100%);
  background-size: 200% 200%;
  animation: shimmerGlow 4s ease infinite;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.5);
}

.btn-choose-cinematic:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 22px rgba(6, 182, 212, 0.7);
}

.package-footer-note {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 18px;
  width: 100%;
}

.package-footer-note p {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0;
}

.package-footer-note strong {
  color: #fde047;
}

/* ==========================================================================
   USER AUTHENTICATION (HEADER BUTTON & USER PROFILE DROPDOWN)
   ========================================================================== */
.auth-header-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-auth-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-auth-header:hover {
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(253, 224, 71, 0.6);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.btn-auth-header.is-logged-in {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(59, 130, 246, 0.25) 100%);
  border-color: rgba(52, 211, 153, 0.7);
  color: #ecfdf5;
}

.btn-auth-header.is-logged-in:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4) 0%, rgba(59, 130, 246, 0.4) 100%);
  box-shadow: 0 0 15px rgba(52, 211, 153, 0.4);
}

.auth-icon {
  font-size: 16px;
  line-height: 1;
}

.btn-manage-shelf-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: rgba(254, 240, 138, 0.6);
  color: #fff;
  font-size: 18px;
}

.btn-manage-shelf-header:hover {
  transform: scale(1.08) rotate(10deg);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.6);
}

/* User Profile Dropdown */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  z-index: 100;
  overflow: hidden;
  animation: fadeInDown 0.2s ease-out;
}

.user-dropdown-header {
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-dropdown-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  font-family: var(--font-body);
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.user-dropdown-menu {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.user-dropdown-item.item-logout {
  color: #f87171;
}

.user-dropdown-item.item-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 6px;
}

/* ==========================================================================
   BOOK MANAGEMENT MODE FLOATING BANNER
   ========================================================================== */
.management-banner {
  display: none;
  position: relative;
  z-index: 45;
  width: calc(100% - 36px);
  max-width: 1200px;
  margin: 0 auto 10px auto;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.96) 0%, rgba(49, 46, 129, 0.96) 100%);
  border: 2px solid rgba(129, 140, 248, 0.7);
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.35);
  padding: 10px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  animation: slideDownBanner 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.management-banner.active {
  display: flex;
}

.management-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.management-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.management-banner-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.management-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #e0e7ff;
  margin: 0;
  letter-spacing: 0.3px;
}

.management-subtitle {
  font-family: var(--font-body);
  font-size: 12px;
  color: #c7d2fe;
  margin: 0;
}

.management-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-mgmt-action {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-mgmt-done {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-mgmt-done:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.6);
}

.btn-mgmt-restore {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
}

.btn-mgmt-restore:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

@media (max-width: 640px) {
  .management-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 14px;
    gap: 10px;
  }
  .management-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ==========================================================================
   SHELF & BOOK MANAGEMENT MODE STATES (DRAG & DROP, DELETE, REORDER)
   ========================================================================== */
.shelf-unit.is-management-mode {
  position: relative;
}

.shelf-unit.is-management-mode:first-child {
  margin-top: 10px;
}

.shelf-books-row.is-drag-target {
  background: rgba(99, 102, 241, 0.12);
  border: 2px dashed rgba(129, 140, 248, 0.6);
  border-radius: 14px;
}

/* Manageable Book Card */
.shelf-book.is-manageable {
  cursor: grab;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.shelf-book.is-manageable:active {
  cursor: grabbing;
}

.shelf-book.is-manageable:hover {
  transform: translateY(-8px) scale(1.03);
}

.shelf-book.is-dragging {
  opacity: 0.35;
  transform: scale(0.92);
  filter: grayscale(0.5);
}

/* Drop target insertion indicators */
.shelf-book.is-drag-over-before::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  bottom: 0;
  width: 5px;
  background: #38bdf8;
  border-radius: 4px;
  box-shadow: 0 0 12px #38bdf8, 0 0 20px #38bdf8;
  z-index: 40;
}

.shelf-book.is-drag-over-after::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  bottom: 0;
  width: 5px;
  background: #38bdf8;
  border-radius: 4px;
  box-shadow: 0 0 12px #38bdf8, 0 0 20px #38bdf8;
  z-index: 40;
}

/* Drag Handle Badge */
.book-drag-handle {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 25;
  pointer-events: none;
}

/* Delete / Remove Book Badge */
.book-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(239, 68, 68, 0.6);
  cursor: pointer;
  z-index: 30;
  transition: transform 0.2s var(--ease-bounce), background 0.2s ease;
}

.book-delete-btn:hover {
  transform: scale(1.22);
  background: #dc2626;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6), 0 0 14px rgba(239, 68, 68, 0.9);
}

.book-delete-btn:active {
  transform: scale(0.95);
}

/* Move to Shelf Category Selector */
.book-move-wrap {
  position: absolute;
  bottom: 8px;
  left: 6px;
  right: 6px;
  z-index: 25;
}

.book-move-select {
  width: 100%;
  padding: 4px 6px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  outline: none;
}

.book-move-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

/* ==========================================================================
   AUTHENTICATION MODAL (LOGIN & REGISTRATION)
   ========================================================================== */
#auth-modal.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 3000 !important;
  background: rgba(10, 5, 2, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: none;
  opacity: 0;
  pointer-events: none;
  align-items: center;
  justify-content: center;
}

#auth-modal.modal-backdrop.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.auth-modal-card {
  position: relative;
  width: 92%;
  max-width: 440px;
  background: #0f172a;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 30px 28px 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(59, 130, 246, 0.15);
  animation: zoomIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #f8fafc;
}

.auth-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #cbd5e1;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-modal-logo {
  font-size: 34px;
  margin-bottom: 8px;
}

.auth-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px 0;
}

.auth-modal-subtitle {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

.auth-modal-notice {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  color: #93c5fd;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
  font-weight: 600;
}

.auth-modal-error {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.auth-tabs-nav {
  display: flex;
  background: #1e293b;
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tab-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.auth-tab-btn.active {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: #cbd5e1;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  background: #1e293b;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #f8fafc;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.btn-auth-submit {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease;
}

.btn-auth-submit:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.6);
}

.auth-demo-hint {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

.auth-demo-hint strong {
  color: #fde047;
}

.auth-form-footer {
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

.auth-form-footer a {
  color: #60a5fa;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   EMPTY SHELF SLOT PLACEHOLDER & BOTTOM CLEARANCE
   ========================================================================== */
.shelf-empty-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 160px;
  height: 100%;
  align-self: center;
  padding: 12px 24px;
}

.empty-slot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 32px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  color: #94a3b8;
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
}

.empty-slot-content.is-management {
  border-color: rgba(129, 140, 248, 0.6);
  background: rgba(49, 46, 129, 0.25);
  color: #c7d2fe;
  pointer-events: none; /* Let drag and drop events pass directly to shelf booksRow */
}

.empty-slot-icon {
  font-size: 26px;
  line-height: 1;
}

.empty-slot-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: #f1f5f9;
}

.empty-slot-hint {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: #94a3b8;
}

.empty-slot-content.is-management .empty-slot-title {
  color: #e0e7ff;
}

.empty-slot-content.is-management .empty-slot-hint {
  color: #a5b4fc;
}

.empty-slot-add-btn {
  margin-top: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
}

.empty-slot-add-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.05);
}

.shelf-unit:last-of-type {
  margin-bottom: 24px;
}

/* Generous bottom spacer so the bottom-most shelf and plaque are 100% visible when scrolled down */
.bookshelf-bottom-spacer {
  width: 100%;
  height: 120px;
  min-height: 120px;
  flex-shrink: 0;
  pointer-events: none;
}


