/* Bookshelf remove button hover effect */
.remove-btn-hover:hover {
  opacity: 1 !important;
  background: var(--danger-bg) !important; /* error/warning background */
  transform: scale(1.1);
}

/* Bookshelf grid styles */
.bookshelf-book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.bookshelf-remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--text-color-secondary);
  color: var(--button-text-color);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: var(--card-shadow);
  opacity: 0;
}

.bookshelf-book-card:hover .bookshelf-remove-btn {
  opacity: 1;
}

.bookshelf-book-card:hover img {
  transform: scale(1.02);
}

/* Bookshelf page container and layout */
.bookshelf-app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Page title */
.bookshelf-main-title {
  text-align: center;
  color: var(--text-color);
}

/* Tabs container tweaks */
.bookshelf-tabs-container {
  display: flex;
  justify-content: center;
  margin-bottom: 0px; /* Remove gap to attach to content */
  border-bottom: 2px solid var(--link-color); /* Blue border */
  padding-bottom: 0px; /* Remove padding to attach tabs to border */
}
.bookshelf-tab:not(:last-child) {
  margin-right: 5px;
}

/* Book card layout */
.bookshelf-book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
  height: 100%;
  overflow: hidden;
  width: 160px;
  margin: 0 auto;
}

/* Cover image */
.cover-wrapper {
  margin-bottom: 5px;
  text-align: center;
  display: flex;
  justify-content: center;
}
.book-cover {
  width: 120px;
  height: 180px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s;
  display: block;
  background-color: var(--background-color);
  margin: 0 auto;
}

/* Title & author */
.bookshelf-book-title {
  margin: 0;
  font-size: 14px;
  color: var(--text-color);
  font-weight: 600;
  line-height: 1;
  height: 2em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  text-align: center;
}
.bookshelf-book-author {
  margin: 1px 0 3px 0;
  font-size: 12px;
  color: var(--text-color-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Metadata: rating and added date */
.book-rating-block {
  text-align: center;
  margin-bottom: 4px;
}
.book-rating {
  font-size: 11px;
  font-weight: bold;
}
.not-rated {
  font-size: 10px;
  color: var(--text-color-secondary);
}
.added-label { font-size: 9px; color: var(--text-color-secondary); }
.added-date { font-size: 9px; color: var(--text-color-secondary); }

.added-info { text-align: center; margin-bottom: 2px; }

/* Expiry info for rented books */
.expiry-info { text-align: center; margin-bottom: 1px; }
.expiry-label-small { font-size: 10px; color: var(--text-color-secondary); }
.expiry-days { font-size: 11px; color: var(--text-color-secondary); font-weight: bold; }
.expiry-date-line { text-align: center; margin-top: 1px; }
.expiry-date-small { font-size: 9px; color: var(--text-color-secondary); }

/* Review indicator */
.book-review-indicator { text-align: center; }
.review-icon { font-size: 12px; margin-right: 3px; }
.review-text { font-size: 10px; color: var(--success-color); }

/* Link wrapper */
.book-link { text-decoration: none; color: inherit; display: block; }

/* Grid for books */
.bookshelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  padding: 10px 0;
}

/* Empty and error states */
.bookshelf-login-message,
.bookshelf-empty-message,
.bookshelf-error { text-align: center; }
.bookshelf-login-message { color: var(--text-color-secondary);}
.bookshelf-error { color: var(--danger-color);}
.bookshelf-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;}
.bookshelf-empty-icon { font-size: 4rem; opacity: 0.3; }
.bookshelf-empty-message { color: var(--text-color-secondary); font-size: 16px; line-height: 1.5; max-width: 400px; }

/* Modal styles */
.remove-confirmation-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.remove-modal-content {
  padding: 25px;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  max-width: 400px;
  width: 90%;
}
.confirm-modal-title { margin: 0 0 15px 0; color: var(--text-color); }
.btn-cancel { padding: 10px 20px; margin-right: 10px; background: var(--text-color-secondary); color: var(--button-text-color); border: none; border-radius: 4px; cursor: pointer; }
.btn-remove { padding: 10px 20px; background: var(--danger-color); color: var(--button-text-color); border: none; border-radius: 4px; cursor: pointer; }

/* Bookshelf tab styles */
.bookshelf-tab {
  padding: 12px 24px;
  margin: 0 2px;
  border: none;
  background: var(--secondary-bg);
  color: var(--text-color-secondary);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
}

.bookshelf-tab:hover {
  background: var(--tab-hover-bg);
  color: var(--text-color);
}

.bookshelf-tab.active-tab {
  background: var(--link-color);
  color: var(--button-text-color);
  border-bottom: 3px solid var(--link-color);
  font-weight: 600;
}

/* Tab content background */
#bookshelf-tab-content {
  background: var(--secondary-bg);
}

/* Remove background from book cards to match content background */
.bookshelf-book-card {
  background: var(--secondary-bg) !important;
  box-shadow: none !important; /* Remove shadow */
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    /* Mobile adjustments for bookshelf grid */
    .bookshelf-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
        gap: 0 !important; /* No gap between cards */
    }

    .bookshelf-book-card {
        width: 95% !important; /* Slightly wider cards */
        height: 95% !important; /* Reduced height */
        padding: 10px !important; /* Less padding */
    }

    .book-cover {
        width: 60px !important; /* Smaller image */
        height: 80px !important; /* Maintain aspect ratio */
    }

    .bookshelf-book-title {
        font-size: 0.75rem !important; /* Smaller title */
        height: auto !important; /* Allow flexible height */
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    }

    .bookshelf-book-author {
        font-size: 0.65rem !important; /* Smaller author text */
        margin: 1px 0 2px 0 !important;
    }

    .book-rating {
        font-size: 0.7rem !important; /* Smaller rating */
    }

    .added-label,
    .added-date,
    .expiry-label-small,
    .expiry-days,
    .expiry-date-small {
        font-size: 0.6rem !important; /* Smaller metadata text */
    }

    .review-text {
        font-size: 0.65rem !important; /* Smaller review text */
    }

    /* Mobile adjustments for bookshelf tabs */
    .bookshelf-tabs-container {
        flex-wrap: nowrap; /* Prevent tabs from wrapping */
    }

    .bookshelf-tab {
        flex: 1;
        max-width: 120px; /* Limit max width */
        padding: 6px 10px !important; /* Reduced padding */
        font-size: 0.75rem !important; /* Smaller font */
        margin: 0 1px !important; /* Smaller margin */
    }
}