html, body {
  height: 100%;
  margin: 0;
}
body {
  font-family: Arial, sans-serif;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;

}
#list-container {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0;
  width:100%; 
  overflow-y:auto; 
  background:#fff; 
  padding:24px 18px 18px 18px;
}
/* Node circle appearance in the D3 graph */
.node circle {
    fill: #69b3a2;
    stroke: #333;
    stroke-width: 1.5px;
}

/* Node label text styling */
.node text {
    font-size: 12px;
    pointer-events: none; /* Prevent text from capturing mouse events */
}

/* Link (edge) appearance */
.link {
    stroke: #999;
    stroke-opacity: 0.6;
}

/* Search bar container: stays above SVG, styled background */
#search-bar-container {
    position: relative;
    width: 25vw;
    z-index: 20;
    background: #f5f5f5;
    padding: 12px 18px 0 18px; /* Add padding for spacing */
}

/* Hide reset button on all screen sizes */
#reset-btn {
    display: none !important;
}

/* Search form layout - always vertical */
#search-form form {
    flex-direction: column !important;
    width: 75% !important;
}

/* Search form input container - horizontal on desktop */
.search-input-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    align-items: stretch !important;
}

@media (max-width: 768px) {
    .search-input-container {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    /* Form full width on mobile */
    #search-form form {
        width: 100% !important;
    }
}

/* Fixed height for search button */
#search-btn {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3) !important;
    transition: all 0.2s ease !important;
}

#search-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,123,255,0.4) !important;
}

#search-input {
    border: 2px solid #d1ecf1 !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
}

#search-input:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.15) !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .mobile-header {
    flex-direction: row !important;
    text-align: left !important;
    padding: 10px !important;
    align-items: center !important;
  }
  
  .mobile-logo {
    height: 50px !important;
    margin-right: 12px !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
  }
  
  .mobile-title {
    font-size: 1.0rem !important;
    line-height: 1.2 !important;
    flex: 1 !important;
  }
  
  .mobile-search-form {
    padding: 15px 10px !important;
    margin: 0 5px !important;
  }
  
  .mobile-search-input {
    min-width: auto !important;
    width: 100% !important;
    margin-bottom: 10px !important;
    font-size: 0.9rem !important;
    padding: 12px 15px !important;
    height: auto !important;
    min-height: 45px !important;
  }
  
  .mobile-btn-group {
    width: 100% !important;
    justify-content: center !important;
  }
  
  .mobile-container {
    height: calc(100vh - 260px) !important;
    /* Fallback for browsers that don't support dvh */
    height: calc(100dvh - 260px) !important;
    padding: 15px 10px !important;
    overflow-y: auto !important;
    /* Ensure smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch !important;
  }

  /* Mobile book list styling */
  .list-group-item {
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    margin-bottom: 15px !important;
    padding: 15px !important;
  }

  /* Mobile book list container */
  #book-list {
    max-height: calc(100dvh - 260px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 5px !important;
  }

  /* iOS Safari specific adjustments */
  @supports (-webkit-touch-callout: none) {
    .mobile-container {
      height: calc(100vh - 300px) !important;
    }
    
    #book-list {
      max-height: calc(100vh - 260px) !important;
    }
  }

  /* Mobile book layout - main info always visible */
  .mobile-book-main {
    display: block !important;
    margin-bottom: 10px;
  }

  .mobile-book-header {
    display: flex !important;
    gap: 12px !important;
    margin-bottom: 10px !important;
    align-items: flex-start !important;
  }

  .mobile-book-cover {
    flex-shrink: 0 !important;
    width: 60px !important;
    height: 90px !important;
    border-radius: 4px !important;
    object-fit: cover !important;
    border: 1px solid #ddd !important;
  }

  .mobile-book-info {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .mobile-book-title {
    font-size: 1.1rem !important;
    font-weight: bold !important;
    color: #333 !important;
    margin-bottom: 5px !important;
    line-height: 1.3 !important;
  }

  .mobile-book-author {
    font-size: 0.95rem !important;
    color: #666 !important;
    margin-bottom: 8px !important;
    font-style: italic !important;
  }

  .mobile-book-category {
    font-size: 0.85rem !important;
    background: #e8f4fd !important;
    color: #0066cc !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    display: inline-block !important;
    margin-bottom: 10px !important;
  }

  .mobile-book-description-main {
    font-size: 0.9rem !important;
    color: #555 !important;
    line-height: 1.4 !important;
    margin-bottom: 10px !important;
    /* Removed truncation - show full description */
  }

  /* Collapsible "Plus" section */
  .mobile-more-toggle {
    background: none !important;
    border: none !important;
    color: #0066cc !important;
    font-size: 0.9rem !important;
    padding: 5px 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    justify-content: space-between !important;
  }

  .mobile-more-toggle:hover {
    color: #004499 !important;
  }

  .mobile-more-content {
    display: none !important;
    padding-top: 10px !important;
    border-top: 1px solid #e0e0e0 !important;
    margin-top: 10px !important;
  }

  .mobile-more-content.show {
    display: block !important;
  }

  .mobile-book-description {
    font-size: 0.9rem !important;
    color: #555 !important;
    line-height: 1.4 !important;
    margin-bottom: 10px !important;
  }

  .mobile-book-meta {
    font-size: 0.8rem !important;
    color: #777 !important;
  }

  .mobile-book-meta strong {
    color: #333 !important;
  }

  /* Rotate arrow icon */
  .mobile-more-toggle .bi-chevron-down {
    transition: transform 0.2s ease !important;
  }

  .mobile-more-toggle.expanded .bi-chevron-down {
    transform: rotate(180deg) !important;
  }
}

@media (max-width: 480px) {
  .mobile-title {
    font-size: 1rem !important;
  }
  
  .mobile-search-form {
    padding: 10px 5px !important;
  }
}

/* Cookie notification styling */
#cookie-warning {
    animation: slideDown 0.5s ease-out;
    border-left: 4px solid #f39c12 !important;
}

#first-visit-notice {
    animation: slideInRight 0.5s ease-out;
    border-left: 4px solid #17a2b8 !important;
}

#cookie-consent-banner {
    animation: slideUp 0.5s ease-out;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15) !important;
}

#cookie-declined-notice {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Cookie notice responsive design */
@media (max-width: 768px) {
    #first-visit-notice {
        position: fixed !important;
        bottom: 10px !important;
        left: 10px !important;
        right: 10px !important;
        max-width: none !important;
    }
    
    #cookie-warning {
        font-size: 0.9rem !important;
    }
    
    #cookie-warning .container {
        padding: 0 10px !important;
    }
    
    #cookie-consent-banner .col-md-8,
    #cookie-consent-banner .col-md-4 {
        text-align: center !important;
    }
    
    #cookie-consent-banner .btn {
        width: 45% !important;
        margin: 2px !important;
    }
    
    #cookie-consent-banner small {
        display: block !important;
        margin-top: 5px !important;
    }
}

/* Ensure cookie notices don't interfere with main content */
.cookie-notice-visible {
    padding-top: 70px;
}

/* Dark mode cookie notices (if you plan to implement dark mode) */
@media (prefers-color-scheme: dark) {
    #cookie-warning {
        background-color: #2c2c2c !important;
        color: #f8f9fa !important;
        border-color: #f39c12 !important;
    }
    
    #first-visit-notice {
        background-color: #2c2c2c !important;
        color: #f8f9fa !important;
        border-color: #17a2b8 !important;
    }
}