/* BookCard styling */
.BookCard {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
  padding: 18px 16px 14px 16px;
  margin: 18px 12px 0 0;
  width: 210px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  border-color: #bdbdbd;
  transition: all 0.3s ease-in-out;
}
.BookCard .book-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #f5f5f5;
  display: block;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #024c75;
}

.card-text {
  font-size: 0.9rem;
}
/* Nội dung book card */
.BookCard p,
.BookCard h3 {
  text-align: left;
}
.BookCard h3 {
  font-size: 1.1rem;
  margin: 0 0 6px 0;
  color: #2d3748;
  font-weight: 600;
}
.BookCard p {
  margin: 4px 0;
  color: #555;
  font-size: 0.97rem;
}
.BookCard .short-desc {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #666;
}

/* Book list container */
#bookList {
  margin-top: 18px;
}

/* Dropdown menu improvements */
.main-nav ul {
  display: flex;
  align-items: center;  /* Vertically center <li> */
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 10px; /* Optional spacing between items */
}

.main-nav ul li {
  display: flex;
  align-items: center; /* Vertically center <a> inside <li> */
}
.main-nav ul li  a,
.main-nav ul li.dropdown > a {
  padding: 5px 8px 5px 8px !important;
  border-radius: 6px 6px 0 0;
  font-size: 1.04rem;
  min-width: 12px;
  display: inline-block;
}
.dropdown-menu {
  min-width: 180px;
  padding: 8px 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  background: #fff;
  border: 1px solid #e0e0e0;
  margin-top: 2px;
}
.dropdown-menu li a {
  padding: 8px 18px;
  display: block;
  color: #333;
  font-size: 1rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.dropdown-menu li a:hover {
  background: #f0f4fa;
  color: #1976d2;
}
/* reset & basics */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: sans-serif;
  line-height: 1.4;
}

/* HEADER TOP BAR */
.site-header .top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 10px 10px;
  border-bottom: 1px solid #eee;
}

.site-header .logo img {
  height: 90px;
}

/* Optional: size for spinner */
#loadingIndicator {
  width: 1rem;
  height: 1rem;
}

/* Hide icon and show spinner when loading */
#searchButton.loading #searchIcon {
  display: none;
}

#searchButton.loading #loadingIndicator {
  display: inline-block !important;
}

.site-header .header-buttons .btn {
  background: #006eff;
  color: white;
  border: none;
  padding: 8px 14px;
  margin-left: 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* NAVIGATION */
.main-nav {
  background: #e8f6f4;
  padding: 8px 20px;
}
.main-nav ul {
  list-style: none;
  display: flex;
}
.main-nav li {
  position: relative;
  margin-right: 8px;
}

/* .main-nav li:hover > a{
  color: rgba(10, 180, 69, 0.8);
  transition-duration: .3s;
  transition-timing-function: linear;
  
} */

.main-nav a {
  text-decoration: none;
  color: #003f3f;
  font-weight: 500;
  padding: 6px 4px;
}

.main-nav a::after{
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0%;
  background-color: #66cc99; /* màu xanh mint như hình */
  transition: width 0.3s ease;
}

/* Hover: đổi màu và hiện gạch */
.main-nav a:hover {
  color: #66cc99;
}

.main-nav a:hover::after {
  width: 100%;
}

/* Mục đang active */
.main-nav a.active {
  color: #66cc99;
}

.main-nav a.active::after {
  width: 100%;
}



.main-nav .dropdown-menu {
  position: absolute;
  top: 30px;
  left: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  list-style: none;
  display: none;
  min-width: 150px;
  z-index: 1000;
}
.main-nav .dropdown-menu li {
  margin: 0;
}
.main-nav .dropdown-menu a {
  display: block;
  padding: 8px 12px;
  color: #333;
}
.main-nav .dropdown-menu a:hover {
  background: #f0f0f0;
}

.main-nav li:hover .dropdown-menu {
  display: block;
}

/* --- Biến CSS để quản lý màu sắc dễ dàng hơn --- */
:root {
  --primary-color: #007bff; /* Xanh dương chủ đạo */
  --primary-dark: #0056b3;
  --secondary-color: #6c757d; /* Xám phụ trợ */
  --accent-color: #28a745; /* Xanh lá cho button thành công */
  --text-dark: #343a40; /* Chữ tối */
  --text-light: #6f7478; /* Chữ nhạt */
  --bg-light: #f8f9fa; /* Nền nhạt */
  --border-color: #e9ecef; /* Màu viền */
  --shadow-light: rgba(0, 0, 0, 0.08);
  --shadow-medium: rgba(0, 0, 0, 0.15);
}

/* --- Thiết lập font chữ chung (có thể dùng Google Fonts) --- */
body {
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
}

.book-detail {
  display: flex;
  gap: 40px;
  margin: 40px auto;
  background: #fff;
  padding: 30px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  align-items: center;
  max-width: 1200px;
}

.book-image img {
  width: 400px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  object-fit: cover;
}

.book-info a {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #008cff, #00c6ff);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.book-info a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #006fee, #00aaff);
}

.qr-section {
  margin-top: 30px;
  text-align: center;
}

.qr-section canvas {
  margin-top: 10px;
  width: 200px;
  height: 200px;
}
.book-detail {
  display: flex;
  gap: 40px;
  margin: 40px auto;
  background: #f7eeee;
  padding: 30px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  align-items: center;
  max-width: 1200px;
}

.book-info {
  flex: 1;
  font-size: 18px;
  line-height: 1.6;
}

.book-info h1 {
  color: #008cff;
  margin-bottom: 20px;
}

.book-info p {
  margin-bottom: 10px;
}

.book-image img {
  width: 400px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  object-fit: cover;
}

.book-info a {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #008cff, #00c6ff);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.book-info a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #006fee, #00aaff);
}

.main-nav li:hover .dropdown-menu {
  display: block;
}

/* --- Thanh hành động (chứa nút Quay lại, QR và Tải xuống) --- */
.action-bar {
  width: 100%;
  display: flex; /* Sắp xếp các phần tử con theo chiều ngang */
  flex-direction: row;
  justify-content: center; /* Căn giữa các phần tử */
  align-items: flex-end; /* Căn chỉnh theo đáy để nút và QR thẳng hàng */
  gap: 40px; /* Khoảng cách giữa các nhóm */
  padding-top: 30px;
  border-top: 2px solid var(--border-color);
  margin-top: 30px;
  flex-wrap: wrap; /* Cho phép xuống dòng trên màn hình nhỏ */
}
.back-to-home-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px var(--shadow-medium);
  background: linear-gradient(135deg, #5a6268, #7c838a);
}
.book-detail {
  display: flex;
  gap: 40px;
  margin: 40px auto;
  background: #fff;
  padding: 30px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  align-items: center;
  max-width: 1200px;
}

.book-info {
  flex: 1;
  font-size: 18px;
  line-height: 1.6;
}

.book-info h1 {
  color: #024c75;
  margin-bottom: 20px;
}

.book-info p {
  margin-bottom: 10px;
}

.book-image img {
  width: 400px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  object-fit: cover;
}

.book-info a {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #008cff, #00c6ff);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.book-info a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #006fee, #00aaff);
}

.qr-section {
  margin-top: 30px;
  text-align: center;
}

.qr-section canvas {
  margin-top: 10px;
  width: 200px;
  height: 200px;
}

.main-nav li:hover .dropdown-menu {
  display: block;
}
/* Nút quay lại & tải xuống giống nhau */
.back-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #008cff, #00c6ff);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #006fee, #00aaff);
}

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
  text-align: center;
  border-top: 1px solid #eee;
  padding-top: 30px;
}

/* Tiêu đề QR */
.qr-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: #024c75;
  margin-bottom: 10px;
}

/* QR Code đẹp */
#qrcode {
  display: inline-block;
  padding: 60px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  width: 260px;
}

/* Nút tải xuống giống nút quay lại */
.downloadButton {
  display: inline-block;
  margin-top: 0;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #008cff, #00c6ff);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  width: 260px;
}

.downloadButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #006fee, #00aaff);
}

/* Spinner nằm bên phải */
.downloadButton .spinner {
  margin-left: 10px;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

.errorMessage {
  margin-top: 8px;
  color: red;
  font-size: 14px;
  text-align: center;
}
/* Animation quay spinner */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* SPINNER */
.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}
