/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Global Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.site-header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo .logo-link {
  text-decoration: none;
  color: white;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.logo h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: bold;
}

.logo .tagline {
  font-size: 0.9rem;
  color: #bdc3c7;
  font-style: normal;
  padding-bottom: 0.4rem;
}


.header-search {
  flex: 1;
  max-width: 400px;
}

.search-form-mini {
  display: flex;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border-radius: 6px;
  overflow: hidden;
}

.search-input-mini {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  font-size: 14px;
  outline: none;
}

.search-button-mini {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-button-mini:hover {
  background-color: #2980b9;
}

/* Main Content */
.main-content {
  flex: 1;
  min-height: calc(100vh - 200px);
}

/* Flash Messages */
.flash {
  padding: 12px 20px;
  margin: 20px auto;
  max-width: 1200px;
  border-radius: 6px;
  font-weight: 500;
  border: 1px solid;
}

.flash-notice {
  background-color: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.flash-alert {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.flash-error {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

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

.search-header {
  text-align: center;
  margin-bottom: 40px;
}

.search-header h1 {
  color: #2c3e50;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.search-header p {
  color: #7f8c8d;
  font-size: 1.1em;
}

.search-form {
  margin-bottom: 40px;
}

.search-input-group {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.search-input {
  flex: 1;
  padding: 15px 20px;
  border: none;
  font-size: 16px;
  outline: none;
}

.search-button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-button:hover {
  background-color: #2980b9;
}

.search-results h2 {
  color: #2c3e50;
  margin-bottom: 30px;
  text-align: center;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.book-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.book-cover {
  width: 100%;
  height: 200px;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #f8f9fa;
}

.no-cover {
  width: 100%;
  height: 200px;
  background-color: #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f8c8d;
  font-size: 14px;
}

.book-info {
  padding: 20px;
}

.book-title {
  color: #2c3e50;
  font-size: 1.3em;
  margin: 0 0 10px 0;
  font-weight: bold;
}

/* Common Book Metadata Styles */
.book-author,
.book-author-large {
  color: #3498db;
  line-height: 1.4;
}

.book-author {
  margin: 5px 0;
  font-size: 1em;
}

.book-author-large {
  font-size: 1.3em;
  margin: 0 0 25px 0;
}

.book-isbn,
.book-date,
.book-publisher,
.book-pages,
.book-size {
  color: #7f8c8d;
  font-size: 0.9em;
  margin: 5px 0;
  line-height: 1.4;
}

.book-price,
.book-price-large {
  color: #e74c3c;
  font-weight: bold;
  line-height: 1.4;
}

.book-price {
  font-size: 0.9em;
  margin: 5px 0;
}

.book-price-large {
  font-size: 1.2em;
  margin: 8px 0;
}

/* Metadata container consistency */
.book-metadata p {
  margin: 8px 0;
  color: #555;
}

.book-metadata .book-isbn,
.book-metadata .book-date,
.book-metadata .book-publisher,
.book-metadata .book-pages,
.book-metadata .book-size {
  color: #7f8c8d;
}

.book-metadata .book-price-large {
  color: #e74c3c;
}

.book-description {
  color: #555;
  margin-top: 15px;
  line-height: 1.5;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: #7f8c8d;
}

.no-results p {
  font-size: 1.2em;
}

/* Clickable book cards */
.book-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.book-card-link:hover {
  text-decoration: none;
  color: inherit;
}

.book-card-link .book-card {
  cursor: pointer;
}

.book-card-link .book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Back button styling */
.book-detail-header {
  margin-bottom: 30px;
}

.back-link {
  display: inline-block;
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.back-link:hover {
  background-color: #2980b9;
  text-decoration: none;
  color: white;
}


/* Single book detailed view */
.book-detail {
  display: flex;
  gap: 40px;
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.book-detail-cover {
  flex-shrink: 0;
}

.book-cover-large {
  width: 300px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.image-container {
  position: relative;
  width: 300px;
  min-height: 420px;
}

.image-loading {
  width: 300px;
  height: 420px;
  background-color: #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f8c8d;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 2px dashed #bdc3c7;
}

.no-cover-large {
  width: 300px;
  height: 420px;
  background-color: #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f8c8d;
  font-size: 16px;
  border-radius: 8px;
  border: 2px dashed #bdc3c7;
}

.book-detail-info {
  flex: 1;
}

.book-title-large {
  color: #2c3e50;
  font-size: 2em;
  margin: 0 0 15px 0;
  font-weight: bold;
  line-height: 1.3;
}


.book-metadata {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 25px;
}


.book-description-full {
  margin-top: 25px;
}

.book-description-full h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.book-description-full {
  overflow: hidden; /* Clearfix for floating button */
}

.book-description-full p {
  color: #555;
  line-height: 1.6;
  font-size: 1.05em;
}

/* Expandable Book Description */
.book-description-content {
  position: relative;
  overflow: hidden;
  max-height: calc(1.6em * 15); /* 15 lines at 1.6 line-height */
  transition: max-height 0.3s ease-out;
}

.book-description-content.expanded {
  max-height: none;
}

.expand-button {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  margin-top: 10px;
  transition: background-color 0.2s ease;
  display: none; /* Initially hidden, shown by JavaScript if needed */
  float: right;
}

.expand-button:hover {
  background: #0056b3;
}

.expand-button:active {
  transform: none;
  box-shadow: none;
  outline: none;
}

/* Buy Links Styles */
.buy-links {
  margin-top: 30px;
  padding: 25px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.buy-links h3 {
  color: #2c3e50;
  margin: 0 0 20px 0;
  font-size: 1.3em;
}

.affiliate-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.buy-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  min-width: 100px;
  height: 40px;
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.buy-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.amazon-link {
  background-color: #ff9900;
  color: white;
}

.amazon-link:hover {
  background-color: #e68900;
  color: white;
}

.kinokuniya-link {
  background-color: #0066cc;
  color: white;
}

.kinokuniya-link:hover {
  background-color: #004499;
  color: white;
}

.dmm-link {
  background-color: white;
  color: black;
  border: 2px solid #ddd;
}

.dmm-link:hover {
  background-color: #f8f8f8;
  color: black;
  border: 2px solid #ccc;
}

.amazon-style {
  background-color: #ff9900 !important;
  color: white !important;
}

.amazon-style:hover {
  background-color: #e68900 !important;
  color: white !important;
}

.yahoo-style {
  background-color: white !important;
  color: rgb(255, 0, 51) !important;
  border: 2px solid rgb(255, 0, 51) !important;
}

.yahoo-style:hover {
  background-color: white !important;
  color: rgb(255, 0, 51) !important;
  border: 2px solid rgb(255, 0, 51) !important;
}

.rakuten-link {
  background-color: #bf0000;
  color: white;
}

.rakuten-link:hover {
  background-color: #990000;
  color: white;
}

.store-name {
  font-weight: bold;
}

.link-arrow {
  margin-left: 10px;
  font-size: 18px;
}

/* Pagination Styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 40px 0;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.pagination-link {
  display: inline-block;
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.pagination-link:hover {
  background-color: #2980b9;
  color: white;
}

.pagination-info {
  font-weight: 600;
  color: #2d3748;
  padding: 10px;
}

/* Footer Styles */
.site-footer {
  background-color: #2c3e50;
  color: white;
  padding: 2rem 0 1rem;
  margin-top: auto;
}

.footer-bottom {
  text-align: center;
}

.footer-bottom p {
  color: #95a5a6;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.affiliate-disclosure {
  font-size: 0.8rem;
  color: #7f8c8d;
}

.footer-bottom a {
  color: #95a5a6;
  text-decoration: none;
}

.footer-bottom a:hover {
  color: #bdc3c7;
}

.debug-info {
  background-color: #1a252f;
  border: 1px solid #34495e;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.debug-info h4 {
  color: #e74c3c;
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: bold;
}

.debug-details p {
  color: #ecf0f1;
  margin: 0.25rem 0;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
}

.debug-details strong {
  color: #3498db;
}

/* 2nd Hand Prices Styles */
.secondhand-prices {
  margin-top: 30px;
  padding: 25px;
  background-color: #fff5f5;
  border-radius: 8px;
  border: 1px solid #fed7d7;
}

.secondhand-prices h3 {
  color: #2c3e50;
  margin: 0 0 10px 0;
  font-size: 1.3em;
}

.secondhand-description {
  color: #666;
  margin: 0 0 20px 0;
  font-size: 0.95em;
  font-style: italic;
}

.price-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.price-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background-color: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.price-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.price-item.best-price {
  border-color: #48bb78;
  background-color: #f0fff4;
}

.price-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price-amount {
  font-size: 1.2em;
  font-weight: bold;
  color: #e53e3e;
}


.price-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  margin: 0 15px;
}

.shop-name {
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 2px;
}

.shipping-info {
  font-size: 0.75rem;
  color: #e53e3e;
  font-weight: 500;
  margin-left: 8px;
  display: inline;
}

.point-info {
  font-size: 0.75rem;
  color: #ff6b35;
  font-weight: 600;
  background-color: #fff5f5;
  border: 1px solid #ff6b35;
  border-radius: 12px;
  padding: 2px 6px;
  margin-left: 8px;
  display: inline;
}

.condition {
  font-size: 0.9em;
  color: #718096;
}

.price-action {
  flex-shrink: 0;
}

.price-link {
  background-color: #bf0000;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.price-link:hover {
  background-color: #990000;
  text-decoration: none;
  color: white;
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .search-header h1 {
    font-size: 2em;
  }
  
  .search-input-group {
    flex-direction: column;
  }
  
  .search-input,
  .search-button {
    border-radius: 0;
  }
  
  .books-grid {
    grid-template-columns: 1fr;
  }
  
  .book-detail {
    flex-direction: column;
    padding: 20px;
    gap: 20px;
  }
  
  .book-cover-large {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }
  
  .no-cover-large {
    width: 100%;
    max-width: 240px;
    height: 320px;
    margin: 0 auto;
  }
  
  .book-title-large {
    font-size: 1.6em;
  }
  
  .book-author-large {
    font-size: 1.1em;
  }
  
  .affiliate-links {
    flex-direction: column;
    align-items: center;
  }
  
  .buy-link {
    width: auto;
    max-width: 200px;
    min-width: 160px;
    justify-content: center;
  }
  
  .price-item {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
  }
  
  .price-details {
    margin: 0;
  }
  
  .price-main {
    justify-content: center;
  }
  
  /* Header responsive */
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .header-search {
    order: -1;
    max-width: 100%;
  }
  
  .logo h1 {
    font-size: 1.5rem;
  }
  
}

/* Library Search Section Styles */
.library-search-section {
  margin-top: 30px;
  padding: 25px;
  background-color: #f0f9ff;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}

.library-search-section h3 {
  color: #2c3e50;
  margin: 0 0 20px 0;
  font-size: 1.3em;
}

.library-search-form {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: end;
}

.form-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  font-size: 0.9em;
}

.form-group select,
.form-group input {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1em;
  background-color: white;
  transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group button {
  padding: 10px 20px;
  margin-top: auto;
  flex-shrink: 0;
}

/* Library Results Styles */
.library-results-list h4 {
  color: #2c3e50;
  margin: 0 0 15px 0;
  font-size: 1.1em;
}

.library-item {
  background-color: white;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 15px;
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.3s ease;
}

.library-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.library-item.available {
  border-left: 4px solid #10b981;
  background-color: #f0fdf4;
}

.library-item.checked-out {
  border-left: 4px solid #f59e0b;
  background-color: #fffbeb;
}

.library-item.unknown {
  border-left: 4px solid #6b7280;
  background-color: #f9fafb;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.library-header h5 {
  margin: 0;
  color: #1f2937;
  font-size: 1.1em;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.available {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.checked-out {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.unknown {
  background-color: #f3f4f6;
  color: #374151;
}

.library-details {
  color: #6b7280;
  font-size: 0.9em;
}

.library-details p {
  margin: 5px 0;
}

.reservation-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.reservation-link:hover {
  text-decoration: underline;
}

.library-error,
.library-no-results {
  text-align: center;
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  color: #6b7280;
}

.loading-state {
  text-align: center;
  padding: 20px;
  color: #6b7280;
}

/* Mobile responsive for library search */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }
  
  .form-group {
    min-width: auto;
    width: 100%;
  }
  
  .library-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .library-search-section {
    padding: 15px;
  }
}

/* Saved preferences indicator */
.saved-indicator {
  font-size: 0.8em;
  opacity: 0.7;
  margin-left: 5px;
  transition: opacity 0.3s ease;
}

/* Homepage content styles */
.homepage-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.homepage-content h1 {
  color: #2c3e50;
  font-size: 2.5em;
  margin-bottom: 30px;
  font-weight: bold;
}

.site-description {
  text-align: left;
}

.site-description > p {
  font-size: 1.2em;
  color: #555;
  margin-bottom: 40px;
  text-align: center;
  line-height: 1.6;
}

.features {
  margin-bottom: 40px;
}

.features h2 {
  color: #2c3e50;
  font-size: 1.8em;
  margin-bottom: 30px;
  text-align: center;
}

.feature-item {
  background-color: white;
  padding: 25px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.feature-item h3 {
  color: #3498db;
  font-size: 1.3em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-item p {
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.how-to-use {
  background-color: #f8f9fa;
  padding: 30px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.how-to-use h2 {
  color: #2c3e50;
  font-size: 1.6em;
  margin-bottom: 20px;
  text-align: center;
}

.how-to-use ol {
  font-size: 1.1em;
  line-height: 1.8;
  color: #555;
  padding-left: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.how-to-use li {
  margin-bottom: 8px;
}

/* Mobile responsive for homepage */
@media (max-width: 768px) {
  .homepage-content {
    padding: 20px 15px;
  }
  
  .homepage-content h1 {
    font-size: 2em;
  }
  
  .features h2 {
    font-size: 1.5em;
  }
  
  .feature-item {
    padding: 20px;
  }
  
  .feature-item h3 {
    font-size: 1.1em;
  }
  
  .how-to-use {
    padding: 20px;
  }
  
  .how-to-use h2 {
    font-size: 1.4em;
  }
  
  .how-to-use ol {
    font-size: 1em;
    padding-left: 15px;
  }
}

/* Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 999;
}

.back-to-top-btn:hover {
  background-color: #2980b9;
  transform: translateY(15px) scale(1.1);
  box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.back-to-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Mobile responsiveness for back to top button */
@media (max-width: 768px) {
  .back-to-top-btn {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
}

/* Book Ranking Section */
.book-ranking-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  border: 1px solid #dee2e6;
}

.book-ranking-section h2 {
  margin: 0 0 1.5rem 0;
  color: #2d3748;
  font-size: 1.5rem;
  text-align: center;
}

.ranking-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ranking-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 transparent;
  flex: 1;
}

.ranking-scroll-wrapper::-webkit-scrollbar {
  height: 8px;
}

.ranking-scroll-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.ranking-scroll-wrapper::-webkit-scrollbar-thumb {
  background-color: #cbd5e0;
  border-radius: 4px;
}

.ranking-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background-color: #a0aec0;
}

.ranking-books {
  display: flex;
  gap: 1rem;
  padding: 0 0.5rem;
  min-height: 280px;
}

.ranking-book {
  flex: 0 0 160px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.ranking-book:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: inherit;
}

.ranking-book-rank {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #bf0000;
  color: white;
  border-radius: 50%;
  min-width: 24px;
  height: 24px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.ranking-book-cover {
  width: 100%;
  height: 140px;
  position: relative;
  margin-bottom: 0.75rem;
  background: #f8f9fa;
  border-radius: 4px;
  overflow: hidden;
}

.ranking-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.ranking-book-cover .no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9ecef;
  color: #6c757d;
  font-size: 0.75rem;
  text-align: center;
}

.ranking-book-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: #2d3748;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ranking-book-author {
  font-size: 0.75rem;
  color: #718096;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ranking-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  color: #718096;
}

.ranking-error {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  color: #e53e3e;
  text-align: center;
}

/* Ranking Navigation Buttons */
.ranking-nav-btn {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.ranking-nav-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ranking-nav-btn:active {
  transform: scale(0.95);
}

.ranking-nav-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.ranking-nav-btn span {
  font-size: 1.5rem;
  font-weight: bold;
  color: #4a5568;
  line-height: 1;
}

/* Mobile responsiveness for ranking */
@media (max-width: 768px) {
  .book-ranking-section {
    margin: 1rem 0;
    padding: 1rem;
  }
  
  .ranking-book {
    flex: 0 0 140px;
    padding: 0.75rem;
  }
  
  .ranking-book-cover {
    height: 120px;
  }
  
  .ranking-book-title {
    font-size: 0.8rem;
  }
  
  .ranking-book-author {
    font-size: 0.7rem;
  }
  
  .ranking-nav-btn {
    width: 35px;
    height: 35px;
  }
  
  .ranking-nav-btn span {
    font-size: 1.3rem;
  }
}

/* Genre Tabs Styles */
.genre-tabs {
  margin-bottom: 20px;
}

.genre-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.genre-tab {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-family: inherit;
}

.genre-tab:hover {
  background: #e9ecef;
  border-color: #3498db;
}

.genre-tab.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

/* Genre Rankings Display */
.genre-rankings {
  min-height: 280px;
}

.genre-ranking {
  display: none;
}

.genre-ranking.active {
  display: block;
}

.genre-loading,
.genre-error {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.genre-error {
  color: #e53e3e;
}

/* Mobile responsiveness for genre tabs */
@media (max-width: 768px) {
  .genre-tab-list {
    gap: 6px;
  }
  
  .genre-tab {
    font-size: 0.8em;
    padding: 6px 12px;
  }
}

/* Simple Genre Rankings Styles */
.genre-rankings-simple {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.genre-row {
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 1rem;
}

.genre-row:last-child {
  border-bottom: none;
}

.genre-title {
  font-size: 1.2rem;
  color: #2d3748;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.genre-books {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.simple-book {
  flex: 0 0 160px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  padding: 0.75rem;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.simple-book:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: inherit;
}

.simple-book-rank {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #bf0000;
  color: white;
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.simple-book-cover {
  width: 100%;
  height: 160px;
  position: relative;
  margin-bottom: 0.5rem;
  background: #f8f9fa;
  border-radius: 4px;
  overflow: hidden;
}

.simple-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.simple-book-cover .no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9ecef;
  color: #6c757d;
  font-size: 0.7rem;
  text-align: center;
}

.simple-book-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  color: #2d3748;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Native browser tooltip for full title on hover - no custom CSS needed */

.simple-book-author {
  font-size: 0.7rem;
  color: #718096;
  line-height: 1.1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile responsiveness for simple rankings */
@media (max-width: 768px) {
  .genre-rankings-simple {
    gap: 1rem;
  }
  
  .simple-book {
    flex: 0 0 140px;
    padding: 0.5rem;
  }
  
  .simple-book-cover {
    height: 140px;
  }
  
  .simple-book-title {
    font-size: 0.75rem;
  }
  
  .simple-book-author {
    font-size: 0.65rem;
  }
  
  .genre-title {
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
  }
  
  .genre-books {
    gap: 0.6rem;
  }
}
