/* Reset */
* {
  /*  box-sizing: border-box;*/
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
html,
body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1; /* Đẩy footer xuống cuối nếu nội dung ngắn */
}

/* Background */
body {
  background: url("https://cdn2.fptshop.com.vn/unsafe/1920x0/filters:format(webp):quality(75)/2024_1_3_638398372645747982_hinh-nen-hoa-sen.jpg")
    no-repeat center center fixed;
  background-size: cover;
  color: #333;
  line-height: 1.6;
}

/* Navbar */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: #00796b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.nav-container {
  width: 50%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  padding: 0 2rem;
  flex-wrap: wrap; /* Cho phép các phần tử xuống dòng khi không đủ chỗ */
}
.nav-container .logo img {
  height: 35px;
}
.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.nav-links li a {
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border-radius: 30px;
  transition: background 0.3s;
  word-break: break-word;
}
.nav-links li a:active {
  background: #004d40;
}

/* Hero Banner */
.hero-banner {
  position: relative;
  width: 100%;
  height: 40vh;
  background: rgba(0, 121, 107, 0.8);
  color: white;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.hero-wrapper {
  display: flex;
  width: calc(100% - 4rem);
  max-width: 800px;
  justify-content: flex-start;
  align-items: flex-end;
  position: relative;
  z-index: 2;
  margin-bottom: 1rem;
}
.hero-image {
  margin-right: 0.5rem;
  margin-top: 20px;
}
.hero-image img {
  max-width: 300px;
  max-height: 300px;
  object-fit: contain;
}
.hero-content {
  height: 100%;
  flex: 1;
  text-align: left;
  margin-left: 0.5rem;
  animation: none;
  margin-bottom: 10px;
}
.hero-content h1 {
  font-size: 30px;
  margin-top: 80px;
  animation: slideIn 1s ease-out;
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Search Box */
.search-wrapper {
  position: relative;
  margin-top: -40px;
  top: -60px; /* Đẩy lên chồng lên Banner khoảng 70% */
  margin: 0 auto;
  width: calc(100% - 6rem);
  max-width: 800px;
  background: #ffffffcc;
  backdrop-filter: blur(5px);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-align: center;
  z-index: 3;
}

#keywordSuggestions {
  margin-bottom: 1rem;
  text-align: center;
}
.keyword-btn {
  margin: 0.2rem;
  padding: 0.4rem 0.8rem;
  background: #00796b;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.keyword-btn:active {
  background: #004d40;
}
#searchBox {
  border: none;
  border-bottom: 2px solid #00796b;
  border-radius: 0;
  width: 80%;
  max-width: 500px;
  padding: 0.5rem 0;
  outline: none;
  transition: border-color 0.3s;
  background: transparent;
}
#searchBox::placeholder {
  color: transparent;
}
#searchBox:focus::placeholder {
  color: #aaa;
}

/* Main Content */
main {
  margin-top: -80px;
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
}

table {
  width: 100%;
  max-width: 1200px;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  animation: fadeIn 1s ease-in-out;
}
thead {
  background-color: #00796b;
  color: white;
}
th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}
tbody tr:active {
  background-color: #f1f1f1;
  transform: scale(1.01);
  transition: all 0.2s ease-in-out;
}
img.book-image {
  width: 80px;
  height: auto;
  border-radius: 5px;
  display: block;
  margin: 0 auto;
  transition: transform 0.3s ease;
}
img.book-image:active {
  transform: scale(1.3);
}

/* Action Buttons (Back to Top and Quiz) */
.action-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}
#backToTopBtn,
.fab {
  position: relative;
  width: 50px;
  height: 50px;
  background: #00796b;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.3s;
}
#backToTopBtn:active,
.fab:active {
  background: #004d40;
  transform: scale(1.05);
}

/* Quiz Popup */
.quiz-popup {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
}
.quiz-popup-content {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  position: relative;
}
.quiz-popup-content .close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  cursor: pointer;
}
.start-quiz-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #00796b;
  color: white;
  border-radius: 5px;
  text-decoration: none;
}
.start-quiz-btn:active {
  background: #004d40;
}

/* Preloader */
.preloader {
  position: fixed;
  z-index: 9999;
  background: #00796b;
  color: white;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.preloader.hidden {
  opacity: 0;
  visibility: hidden;
}
.preloader-content p {
  font-size: 1.5rem;
  text-align: center;
}
.preloader-content span {
  font-size: 1rem;
}
.skip-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

/* Footer */
/* Footer */
.site-footer {
  background: #004d40;
  color: #fff;
  padding: 2rem 1rem;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
  font-size: 0.95rem;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 2rem;
}

.footer-column {
  flex: 1 1 250px;
}

.footer-column h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.footer-column p,
.footer-column a {
  color: #ddd;
  margin: 0.3rem 0;
  line-height: 1.5;
}

.footer-column a {
  text-decoration: underline;
}
.footer-column a:active {
  color: #fff;
}

.footer-column img {
  margin: 0.5rem 0;
  max-width: 100%;
  height: auto;
}

.footer-bottom {
  margin-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding: 1rem 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  text-align: center;
  color: #bbb;
  font-size: 0.85rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.footer-bottom p {
  white-space: normal;
  word-break: break-word;
}

/* Responsive: Mobile */
@media (max-width: 768px) {
  .nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    padding: 2 1rem;
    position: relative;
  }

  .nav-container .logo img {
    height: 30px;
  }

  .nav-links {
    flex-direction: column;
    position: fixed;
    top: 50px;
    right: 0;
    width: 100%;
    background: #00796b;
    display: none;
    text-align: center;
    padding: 1rem;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: none !important;
  }

  .nav-links.show {
    display: flex;
  }
  .hero-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 1rem auto;
    width: 95%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 1rem 0 !important;
  }

  .hero-image img {
    max-width: 150px !important;
    max-height: 150px !important;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
  }

  .hero-content {
    /*    margin: 0;*/
    margin-top: -50px;
  }

  .hero-content h1 {
    font-size: 1.5rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  .hero-content p {
    margin-bottom: 30px;
    font-size: 0.9rem;
    color: #e0f2f1;
  }
  .search-wrapper {
    position: relative;
    bottom: 0;
    margin-top: 0.5rem;
    width: 92%;
    left: 0;
    transform: none;
  }
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }
  thead {
    display: none;
  }
  tbody tr {
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
  }
  tbody td {
    padding: 0.5rem 0;
    border: none;
  }
  tbody td:nth-child(3)::before {
    content: "Tóm tắt: ";
    font-weight: bold;
    display: block;
    margin-bottom: 0.3rem;
  }
  img.book-image {
    width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
  }
  .action-buttons {
    flex-direction: column;
    gap: 10px;
  }
  .footer-bottom {
    padding: 0.5rem 0.5rem;
  }
}

/* Responsive: Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-container {
    padding: 0 1rem;
  }
  /*   
  Trùng
  .hero-wrapper {
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
  } */
  .hero-content h1 {
    font-size: 24px;
  }
  table {
    font-size: 0.95rem;
  }
  /*.footer-container {
        flex-wrap: wrap;
        justify-content: space-around;
    }*/
  .search-wrapper {
    width: 95%;
    max-width: 700px;
  }
}
/* Hover Effect Optimized */
@media (min-width: 1025px) {
  tbody tr:active {
    background-color: #f9f9f9;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, box-shadow 0.2s;
    transform: none;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  tbody tr:active {
    background-color: #f9f9f9;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: background-color 0.2s, box-shadow 0.2s;
    transform: none;
  }
  .footer-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
  }

  .footer-column {
    flex: 1 1 300px;
    text-align: center;
  }

  .footer-column img {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
}

@media (max-width: 768px) {
  tbody tr:active {
    background: #e0f2f1 !important;
    transform: scale(0.98);
    box-shadow: 0 0 15px rgba(0, 121, 107, 0.3);
    transition: all 0.2s ease-in-out;
  }

  img.book-image:active {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 121, 107, 0.5);
    transition: transform 0.2s ease;
  }
}
/* Desktop Nav mặc định */
/*Trùng .desktop-nav {
  display: flex;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #00796b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
} */
.desktop-nav {
  display: flex;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #00796b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}
/* Trùng */
/* .nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  padding: 0 2rem;
} */
/*Trùng */
.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
}

/* =======================
   Footer Fixed Menu Mobile
======================= */

/* Mặc định: Ẩn menu dưới */
.mobile-bottom-nav {
  display: none;
}

/* Hiển thị trên thiết bị nhỏ */
@media (max-width: 768px) {
  /* Trùng.desktop-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    background: #00796b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  } */
  .desktop-nav {
    align-items: center;
    height: 50px;
  }
  nav-container {
    justify-content: center;
  }

  .nav-links {
    display: none !important;
  }

  .nav-container .logo img {
    height: 30px;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #00796b;
    justify-content: space-around;
    align-items: center;
    padding: 1.5rem 0;
    z-index: 9999;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
  }

  .mobile-bottom-nav a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .mobile-bottom-nav a span {
    font-size: 0.7rem;
    margin-top: 0.2rem;
  }
}
/* Đưa Action Buttons lên cao hơn */
@media (max-width: 768px) {
  .action-buttons {
    bottom: 100px;
    right: 20px;
    position: fixed;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1001;
  }
}
/* ___ */
/* Ẩn mặc định, chỉ hiện trên Mobile */
/* Trùng
/* .mobile-only {
  display: none;
} */
.mobile-only {
  display: none !important;
}

/* Hiện ảnh nhỏ trong lời ngỏ trên Mobile */
@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }

  /* Ẩn ảnh to ở Banner */
  .hero-image {
    display: none !important;
  }

  /* Chữ nhỏ lại trong lời ngỏ */
  main section {
    font-size: 0.9rem;
  }
}
@media (max-width: 768px) {
  main {
    margin-top: 20px !important;
    padding-top: 1rem !important;
  }
}

/* Mặc định cho desktop */
.hero-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
  text-align: left;
}

.hero-image img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
}

.hero-content h1 {
  font-size: 2rem;
  font-weight: bold;
  line-height: 1.3;
}

.hero-content p {
  font-size: 1rem;
  margin-top: 0.5rem;
}

/* Mobile cải tiến UX/UI */
@media (max-width: 768px) {
  .hero-wrapper {
    flex-direction: column;
    padding: 1rem;
    text-align: center;
  }

  .hero-image img {
    max-width: 150px;
    max-height: 150px;
    margin-bottom: 1rem;
  }

  .hero-content h1 {
    font-size: 1.5rem;
    line-height: 1.4;
  }

  .hero-content p {
    font-size: 0.9rem;
    color: #e0f2f1;
  }
}
@media (max-width: 768px) {
  /* Trùng
  .hero-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 95%;
    margin: 1rem auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .hero-image {
    margin: 0 0 1rem 0 !important;
  }

  .hero-image img {
    max-width: 150px !important;
    max-height: 150px !important;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }

  .hero-content {
    margin: 0;
  }

  .hero-content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .hero-content p {
    font-size: 0.9rem;
    color: #e0f2f1;
  } */
}
@media (max-width: 768px) {
  #sharePage .feedback-btn {
    bottom: 100px !important; /* Đẩy lên trên menu đáy */
    right: 20px;
    position: fixed;
    z-index: 1001;
  }
}
/*Đoạn cần sửa*/
/* #bookTable th:nth-child(2),
#bookTable td:nth-child(2) {
  width: auto;
  white-space: normal;
  word-break: break-word;
} */
#bookTable th:nth-child(2),
#bookTable td:nth-child(2) {
  min-width: 500px;
  white-space: normal;
  word-break: break-word;
}

.book-label {
  font-weight: bold;
  color: #555555; /* Hoặc #00796b hoặc #607d8b */
}
@media (max-width: 768px) {
  #bookTable {
    width: 100%;
    overflow-x: hidden;
    table-layout: fixed;
    word-wrap: break-word;
  }

  #bookTable td {
    width: 100%;
    display: block;
    word-break: break-word;
  }

  #bookTable td::before {
    content: attr(data-label);
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
    color: #00796b;
  }

  #bookTable img.book-image {
    width: 100px;
    height: auto;
    margin: 0 auto;
  }
}
/* Wrapper chứa toàn bộ header + nội dung */
.book-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
}

/* Header mô phỏng dòng tiêu đề bảng */
/*.book-header {
  display: flex;
  background: #00796b;
  color: white;
  font-weight: bold;
  border-radius: 8px 8px 0 0;
  padding: 1rem;
  margin-top: 1rem;
}*/
.book-header {
  position: sticky;
  top: 70px; /* Điều chỉnh tùy theo chiều cao navbar */
  z-index: 10;
  background: #00796b;
  display: flex;
  color: white;
  font-weight: bold;
  border-radius: 8px 8px 0 0;
  padding: 1rem;
}

.book-header .book-col {
  padding: 0 0.5rem;
  word-break: break-word;
}

.book-header .book-img {
  flex: 0 0 100px;
}
.book-header .book-info {
  flex: 2;
}
.book-header .book-summary {
  flex: 2;
}
.book-header .book-ebook {
  flex: 0.5;
  text-align: center;
}

/* Danh sách các sách */
.book-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* Mỗi dòng sách */
.book-row {
  display: flex;
  background: white;
  border-radius: 0; /* Không bo vì dùng chung với header */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  align-items: flex-start;
  gap: 1rem;
}

.book-col {
  flex: 1;
  word-break: break-word;
}

.book-img {
  flex: 0 0 100px;
}

.book-img img.book-image {
  width: 80px;
  height: auto;
  border-radius: 5px;
  display: block;
  margin: 0 auto;
}

.book-info {
  flex: 2;
}

.book-summary {
  flex: 2;
}

.book-ebook {
  flex: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-ebook a,
.book-ebook button {
  font-size: 1.2rem;
}

/* Hiển thị trên mobile */
@media (max-width: 768px) {
  .book-header {
    display: none;
  }

  .book-row {
    flex-direction: column;
    padding: 1rem;
    border-radius: 10px;
  }

  .book-col {
    width: 100%;
  }

  .book-img {
    text-align: center;
    margin-bottom: 1rem;
  }

  .book-img img.book-image {
    width: 100px;
  }

  .book-ebook {
    justify-content: flex-start;
    margin-top: 0.5rem;
  }
}
