
:root {
    --shelf-top: #4a2e18;
    --shelf-face: #271609;
    --shelf-edge: #150b04;
    --gold-foil: #e2c98a;
}

/* =========================================
   SWARAJ'S LIBRARY
   ========================================= */
  
  
.library {
  max-width: 1000px;
  margin: auto;
  
  font-family: Georgia, "Times New Roman", serif;
  
}


/* =========================================
   HEADER
   ========================================= */

.library-header {
  text-align: center;
  padding: 45px 20px 35px;
  border-bottom: 1px solid #dddddd;
}

.library-title {
  font-family: 'Great Vibes', serif;
  font-size: 100px;
  font-weight: normal;
  letter-spacing: 2px;
  margin: 0 0 12px;
}

.library-subtitle {
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: #777777;
  margin: 0;
}


/* =========================================
   SEARCH and FILTER
   ========================================= */

.controls-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 14px;
      background: var(--card-bg);
      padding: 14px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 2px 4px rgba(254, 254, 254, 0.5);
      margin: 40px auto;
      align-items: center;
    }

.search-input {
      flex: 1;
      min-width: 200px;
      background: #0f1115;
      border: 1px solid rgba(255, 255, 255, 0.12);
      padding: 10px 16px;
      border-radius: 8px;
      color: #fff;
      font-size: 0.9rem;
      outline: none;
      transition: border-color 0.2s;
    }

    .search-input:focus {
      border-color: var(--accent);
    }

    .filter-group {
      display: flex;
      gap: 8px;
    }

    .filter-btn {
      background: #0f1115;
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--text-muted);
      padding: 8px 14px;
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .filter-btn:hover {
      background: rgba(255, 255, 255, 0.05);
      color: #fff;
    }

    .filter-btn.active {
      background: #000;
      border-color: var(--accent);
      color: #ceebcc;
      box-shadow: 0 2px 4px rgba(254, 254, 254, 0.5);
    }


    /* =========================================
       3. BOOKSHELF SECTIONS
       ========================================= */
    .shelf-section {
      margin-bottom: 50px auto;
      position: relative;
    }

    .shelf-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      padding: 0 6px;
    }

    .shelf-title {
      font-family: 'Lora', serif;
      font-size: 1.35rem;
      font-weight: 500;
      letter-spacing: 0.5px;
      color: #ffffff;
    }

    .shelf-count {
      font-size: 0.8rem;
      color: var(--text-muted);
      background: var(--card-bg);
      padding: 3px 8px;
      border-radius: 20px;
    }

    /* Track Container & Scrollable Shelf */
    .shelf-viewport {
      position: relative;
    }

    .book-track {
      display: flex;
      align-items: flex-end;
      gap: 12px;
      overflow-x: auto;
      overflow-y: visible;
      padding: 30px 16px 0 16px;
      scroll-behavior: smooth;
      scrollbar-width: thin;
      scrollbar-color: #3b2210 transparent;
      min-height: 270px;
    }


    .book-track::-webkit-scrollbar {
      height: 6px;
    }

    .book-track::-webkit-scrollbar-thumb {
      background: #4a2e18;
      border-radius: 4px;
    }

    /* Wooden Shelf Plank */
    .shelf-plank {
      position: relative;
      height: 16px;
      margin-bottom: 50px;
      background: linear-gradient(180deg, var(--shelf-top) 0%, var(--shelf-face) 100%);
      border-radius: 2px 2px 4px 4px;
      box-shadow: 
        0 12px 24px -4px rgba(0, 0, 0, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
      z-index: 5;
    }

    .shelf-plank::before {
      content: '';
      position: absolute;
      top: -8px;
      left: 0;
      right: 0;
      height: 8px;
      background: #5c391e;
      transform: perspective(80px) rotateX(25deg);
      transform-origin: bottom;
      box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.15);
    }

    /* =========================================
       4. REALISTIC BOOK SPINES
       ========================================= */
    .book-spine {
      position: relative;
      width: var(--spine-w, 42px);
      height: var(--spine-h, 230px);
      background: var(--spine-color, #1e293b);
      border-radius: 3px 6px 6px 3px;
      cursor: pointer;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      user-select: none;
      
      /* Tactile depth & lighting */
      box-shadow: 
        inset 4px 0 6px rgba(255, 255, 255, 0.15),
        inset -4px 0 6px rgba(0, 0, 0, 0.5),
        4px 8px 15px rgba(0, 0, 0, 0.4);
      
      transition: transform 0.22s cubic-bezier(0.2, 0.2, 0.2, 1), box-shadow 0.22s ease;
      z-index: 2;
    }

    /* Spine Leather Stitch Bands */
    .book-spine::before,
    .book-spine::after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      height: 3px;
      background: rgba(0, 0, 0, 0.4);
      border-top: 1px solid rgba(255, 255, 255, 0.15);
    }
    .book-spine::before { top: 22px; }
    .book-spine::after { bottom: 22px; }

    .book-spine:hover {
      transform: translateY(-16px) scale(1.03);
      box-shadow: 
        inset 4px 0 8px rgba(255, 255, 255, 0.25),
        inset -4px 0 6px rgba(0, 0, 0, 0.5),
        0 20px 25px rgba(0, 0, 0, 0.6);
      z-index: 20;
    }

    .spine-title {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      font-family: 'Cinzel', serif;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 1.2px;
      color: var(--gold-foil);
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-height: 170px;
      pointer-events: none;
    }

    /* =========================================
       5. SIDEWAYS HOVER TOOLTIP
       ========================================= */
    .spine-tooltip {
      position: absolute;
      left: calc(100% + 14px);
      top: 50%;
      transform: translateY(-50%) translateX(-8px);
      background: rgba(22, 27, 34, 0.94);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      padding: 12px 16px;
      min-width: 170px;
      max-width: 240px;
      white-space: normal;
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 100;
    }

    .book-spine:hover .spine-tooltip {
      opacity: 1;
      transform: translateY(-50%) translateX(0);
    }

    .tooltip-title {
      font-size: 0.85rem;
      font-weight: 600;
      color: #fff;
      line-height: 1.3;
      margin-bottom: 4px;
    }

    .tooltip-author {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    /* Status Badges */
    .status-badge {
      display: inline-block;
      font-size: 0.65rem;
      text-transform: uppercase;
      font-weight: 700;
      letter-spacing: 0.5px;
      padding: 2px 7px;
      border-radius: 4px;
    }

    .status-badge.reading { background: #15803d; color: #dcfce7; }
    .status-badge.read { background: #0369a1; color: #e0f2fe; }
    .status-badge.to-read { background: #b45309; color: #fef3c7; }

    /* =========================================
       6. 3D COVER INSPECT MODAL
       ========================================= */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.75);
      backdrop-filter: blur(8px);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
      z-index: 1000;
      padding: 20px;
    }

    .modal-overlay.active {
      opacity: 1;
      pointer-events: auto;
    }

    .modal-container {
      background: var(--card-bg);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 16px;
      width: 100%;
      max-width: 580px;
      padding: 32px;
      position: relative;
      display: flex;
      gap: 28px;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
      transform: scale(0.9) perspective(1000px) rotateY(-10deg);
      transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .modal-overlay.active .modal-container {
      transform: scale(1) perspective(1000px) rotateY(0deg);
    }

    .modal-close {
      position: absolute;
      top: 14px;
      right: 18px;
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-size: 1.5rem;
      cursor: pointer;
      line-height: 1;
    }

    .modal-close:hover { color: #fff; }

    /* 3D Realistic Book Front Cover */
    .modal-cover-3d {
      width: 160px;
      height: 240px;
      flex-shrink: 0;
      border-radius: 3px 10px 10px 3px;
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding: 16px;
      box-shadow: 
        -4px 0 0 rgba(0,0,0,0.4),
        -8px 0 8px rgba(0,0,0,0.5),
        8px 12px 24px rgba(0,0,0,0.6);
      border-left: 5px solid rgba(255, 255, 255, 0.12);
    }

    .modal-cover-3d .cover-title {
      font-family: 'Cinzel', serif;
      font-size: 0.95rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.3;
    }

    .modal-cover-3d .cover-author {
      font-family: 'Lora', serif;
      font-style: italic;
      font-size: 0.8rem;
      color: rgba(255, 255, 255, 0.7);
    }

    .modal-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .modal-content h3 {
      font-size: 1.4rem;
      margin-bottom: 6px;
      line-height: 1.2;
    }

    .modal-content .author-label {
      color: var(--text-muted);
      font-size: 0.95rem;
      margin-bottom: 16px;
    }

    .modal-meta-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin-bottom: 20px;
    }

    .meta-box {
      background: #0f1115;
      padding: 10px;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .meta-box span {
      display: block;
      font-size: 0.7rem;
      color: var(--text-muted);
      text-transform: uppercase;
      margin-bottom: 2px;
    }

    .meta-box strong {
      font-size: 0.85rem;
      color: #fff;
    }




    /* Responsiveness */
    @media (max-width: 600px) {
      .modal-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px;
      }
      .modal-cover-3d { width: 140px; height: 200px; }
      .modal-meta-grid { width: 100%; }
    }



