/* Reset mặc định */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.hamburger {
  display: none;
}

:root {
  /* Các biến màu cho chế độ sáng */
  --bg-color: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --text-color: #333;
  --header-bg: #2c3e50;
  --header-text: #ecf0f1;
  --card-bg: #fff;
  --card-shadow: rgba(0, 0, 0, 0.1);
  --accent-color: #3498db;
  --accent-hover: #2980b9;
  --dropdown-bg: #34495e;
  --dropdown-hover: #3e5c76;
  --highlight-color: #f1c40f;
  --secondary-text: #7f8c8d;
  --border-color: #dfe6e9;
  --heart-color: #e74c3c;
}

/* Chế độ tối */
body.dark-mode {
  --bg-color: linear-gradient(135deg, #2c3e50 0%, #1a202c 100%);
  --text-color: #ecf0f1;
  --header-bg: #1a1a2e;
  --header-text: #f5f5f5;
  --card-bg: #2d3748;
  --card-shadow: rgba(0, 0, 0, 0.25);
  --accent-color: #4299e1;
  --accent-hover: #3182ce;
  --dropdown-bg: #2d3748;
  --dropdown-hover: #4a5568;
  --highlight-color: #f1c40f;
  --secondary-text: #a0aec0;
  --border-color: #4a5568;
  --heart-color: #e53e3e;
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
}

.header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header h1 i {
  font-size: 28px;
}

nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

nav a {
  color: var(--header-text);
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 500;
  transition: color 0.3s ease;
}

nav a:hover {
  color: var(--highlight-color);
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--dropdown-bg);
  min-width: 200px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1;
  border-radius: 8px;
  padding: 10px 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

.dropdown:hover .dropdown-content {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.dropdown-content a {
  color: var(--header-text);
  padding: 10px 20px;
  display: block;
  font-weight: 400;
  font-size: 14px;
}

.dropdown-content a:hover {
  background-color: var(--dropdown-hover);
  color: var(--highlight-color);
}

.user-account {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Nút chuyển đổi chế độ */
.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--header-text);
  margin-right: 15px;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

body.dark-mode .theme-toggle .theme-icon:before {
  content: "\f185"; /* sun icon */
}

.user-account .user-icon {
  font-size: 24px;
  color: var(--header-text);
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
}

.user-account .user-icon:hover {
  transform: scale(1.2);
  color: var(--highlight-color);
}

.user-account .user-links {
  display: flex;
  gap: 15px;
}

.user-account .user-links a {
  color: var(--header-text);
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.3s ease;
}

.user-account .user-links a:hover {
  color: var(--highlight-color);
}

/* Slideshow */
.slideshow-container {
  margin-top: 100px;
  padding: 20px 0;
}

.slideshow {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 6px 15px var(--card-shadow);
  height: 300px;
  margin-bottom: 30px;
}

.slide {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  transition: opacity 0.5s ease;
}

.slide.active {
  display: block;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-caption {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 600;
}

.slide-indicators {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.slide-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.slide-dot.active {
  background-color: white;
}

.fade {
  animation-name: fade;
  animation-duration: 1.5s;
}

@keyframes fade {
  from {opacity: 0.4}
  to {opacity: 1}
}

/* Slideshow Navigation */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -22px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
  background-color: rgba(0,0,0,0.3);
  text-decoration: none;
  z-index: 2;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.6);
}

.prev {
  left: 0;
}

/* Search Header */
.search-header {
  margin-top: 100px;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.search-header h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.search-box {
  position: relative;
  width: 300px;
}

.search-box .search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-text);
  transition: color 0.3s ease;
}

.search-box input {
  width: 100%;
  padding: 12px 20px 12px 40px;
  font-size: 16px;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  background: var(--card-bg);
  color: var(--text-color);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.2);
}

/* Book List */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.book {
  position: relative;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 4px 10px var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  cursor: pointer;
}

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

.book img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
}

.book-info h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 5px;
  transition: color 0.3s ease;
}

.book-info p {
  font-size: 14px;
  color: var(--secondary-text);
  margin: 5px 0;
  transition: color 0.3s ease;
}

.book-info p strong {
  color: var(--text-color);
  transition: color 0.3s ease;
}

.favorite-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  color: #bdc3c7;
  transition: color 0.3s ease, transform 0.3s ease;
}

.favorite-icon:hover {
  transform: scale(1.2);
}

.favorite-icon.liked {
  color: var(--heart-color);
}

.favorite-icon.liked::before {
  content: "\f004";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

/* Pagination */
.pagination {
  text-align: center;
  padding: 20px 0;
}

.pagination button {
  margin: 0 5px;
  padding: 10px 15px;
  cursor: pointer;
  border: none;
  background: var(--accent-color);
  color: white;
  border-radius: 5px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.pagination button:hover {
  background: var(--accent-hover);
}

.pagination button.active {
  background: var(--highlight-color);
  color: var(--header-bg);
  font-weight: bold;
}

/* Popup */
.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.popup-content {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  position: relative;
  animation: fadeIn 0.3s ease;
  transition: background-color 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.popup-content h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  color: var(--text-color);
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.popup-content p {
  font-size: 14px;
  color: var(--secondary-text);
  margin: 5px 0;
  transition: color 0.3s ease;
}

.popup-content p strong {
  color: var(--text-color);
  transition: color 0.3s ease;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  color: var(--secondary-text);
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-btn:hover {
  color: var(--heart-color);
}

/* Rating Popup */
.rating-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 1000;
  width: 90%;
  max-width: 400px;
  animation: fadeIn 0.3s ease;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.rating-popup h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  color: var(--text-color);
  margin-bottom: 15px;
  text-align: center;
  transition: color 0.3s ease;
}

.rating-popup label {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.rating-popup input,
.rating-popup textarea {
  width: 100%;
  padding: 10px;
  margin: 5px 0 10px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--text-color);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.rating-popup input:focus,
.rating-popup textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.2);
}

.stars {
  font-size: 24px;
  color: #bdc3c7;
  cursor: pointer;
  text-align: center;
  margin: 10px 0;
}

.stars .star {
  transition: color 0.3s ease;
}

.stars .star:hover,
.stars .star.selected {
  color: var(--highlight-color);
}

.rating-popup button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.rating-popup button:first-of-type {
  background: var(--accent-color);
  color: white;
  margin-right: 10px;
}

.rating-popup button:first-of-type:hover {
  background: var(--accent-hover);
}

.rating-popup button:last-of-type {
  background: var(--heart-color);
  color: white;
}

.rating-popup button:last-of-type:hover {
  background: #c0392b;
}

/* Footer */

.footer {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 30px 0;
  margin-top: 40px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
}

.footer-info {
  flex: 1;
  min-width: 300px;
}

.footer-info p {
  margin: 8px 0;
  line-height: 1.6;
}

.footer a {
  color: var(--highlight-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: #f39c12;
}

.social-links {
  text-align: center;
  min-width: 200px;
}

.social-links h4 {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--header-text);
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  color: white;
  text-decoration: none;
  font-size: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.social-icon:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.social-icon.zalo {
  background: linear-gradient(135deg, #0068ff, #0099ff);
}

.social-icon.facebook {
  background: linear-gradient(135deg, #1877f2, #42a5f5);
}

.social-icon.instagram {
  background: linear-gradient(135deg, #e4405f, #fd1d1d, #fcb045);
}

/* Zalo icon custom (since Font Awesome doesn't have Zalo) */
.fa-zalo::before {
  content: "Z";
  font-family: 'Poppins', sans-serif;
  font-weight: bold;
  font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 10px;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .search-header {
    flex-direction: column;
    text-align: center;
  }

  .search-box {
    width: 100%;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .rating-popup {
    width: 95%;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 20px;
  }

  nav a {
    font-size: 14px;
  }

  .user-account .user-links a {
    font-size: 12px;
  }

  .search-header h2 {
    font-size: 22px;
  }

  .book-info h3 {
    font-size: 16px;
  }

  .book-info p {
    font-size: 12px;
  }
}
  /* Responsive adjustments */
@media (max-width: 768px) {

  .hamburger {
    display: block;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--header-text);
    cursor: pointer;
    padding: 10px;
  }

nav {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  width: 100%;
  flex-direction: column;
  background: var(--dropdown-bg);
  position: absolute;
  top: 100%;
  left: 0;
  padding: 0;
}

nav.active {
  max-height: 500px; /* đủ để chứa các link */
  padding: 10px 0;
}

  nav.active {
    display: flex;
  }

  nav a {
    padding: 10px 20px;
    width: 100%;
    text-align: center;
  }

  /* Dropdown adjustments */
  .dropdown {
    width: 100%;
  }

  .dropdown-content {
    position: static;
    transform: none;
    background: var(--dropdown-hover);
    box-shadow: none;
    border-radius: 0;
  }

  .dropdown-content a {
    padding: 8px 30px;
  }

  /* Slideshow */
  .slideshow {
    height: 200px;
  }

  .slide-caption {
    font-size: 16px;
    padding: 8px;
  }

  .prev, .next {
    font-size: 16px;
    padding: 10px;
  }

  /* User account */
  .user-account {
    justify-content: center;
    width: 100%;
    padding: 10px 0;
  }

  .user-account .user-links {
    gap: 10px;
  }

  /* Footer */
  .footer {
    padding: 15px 10px;
    font-size: 14px;
  }

  .footer p {
    margin: 5px 0;
  }
}

@media (max-width: 480px) {
  /* Header */
  .header h1 i {
    font-size: 24px;
  }

  /* Slideshow */
  .slideshow {
    height: 150px;
  }

  .slide-caption {
    font-size: 14px;
    bottom: 10px;
    padding: 5px;
  }

  .slide-dot {
    width: 10px;
    height: 10px;
  }

  /* Search box */
  .search-box input {
    padding: 10px 15px 10px 35px;
    font-size: 14px;
  }

  .search-box .search-icon {
    left: 10px;
    font-size: 14px;
  }

  /* Book grid */
  .book {
    padding: 10px;
  }

  .book img {
    height: 150px;
  }

  /* Pagination */
  .pagination button {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Rating popup */
  .rating-popup {
    padding: 15px;
  }

  .rating-popup h3 {
    font-size: 18px;
  }

  .stars {
    font-size: 20px;
  }
}

@media (min-width: 769px) {
  .hamburger {
    display: none;
  }

  nav {
    display: flex !important;
    position: static;
    background: none;
    flex-direction: row;
  }
}

@media (max-width: 768px) {
  .dropdown {
    width: 100%;
    text-align: center;
  }

  .dropdown > a {
    display: block;
    padding: 10px 20px;
    width: 100%;
  }

  .dropdown-content {
    background: var(--dropdown-hover);
  }

  .dropdown-content a {
    padding: 8px 30px;
    text-align: left;
  }
}

html { scroll-behavior: smooth; }


.suggestions-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border-radius: 0 0 8px 8px;
}

/*Gợi ý sách cần tìm kiếm*/
.suggestions-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  max-height: 250px;
  overflow-y: auto;
  z-index: 999;
  display: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border-radius: 0 0 8px 8px;
}

.suggestions-box div {
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-color);
  transition: background 0.2s ease;
}

.suggestions-box div:hover {
  background: var(--accent-hover);
  color: #fff;
}

/*Hình ảnh nhỏ gợi ý sách*/
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggestion-item img.suggestion-thumb {
  width: 40px;
  height: 55px;
  object-fit: cover;
  border-radius: 4px;
}
