/* ==========================================================================
   Thư viện Khoa Văn học - USSH VNU-HANOI
   Styles cho Trang chủ (Homepage)
   Định hướng: Academic & Institutional, tinh tế, giữ trọn vẹn bố cục truyền thống
   ========================================================================== */

/* Header: Nhận diện & Điều hướng */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px max(24px, calc((100% - 1180px) / 2));
  background: #fffdf6;
  border-bottom: 1px solid #e9dfbf;
  box-shadow: 0 1px 3px rgba(36, 68, 92, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  text-decoration: none;
}

.brand-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-label {
  display: block;
  margin-bottom: 4px;
  color: #637786;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
}

.brand strong {
  font-size: 16.5px;
  color: #24445c;
  font-weight: 700;
}

.navigation {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13.5px;
}

.navigation a,
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #24445c;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 4px;
  transition: color 0.15s ease;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
}

.navigation a:hover,
.navigation .active,
.nav-dropdown:hover .nav-dropdown-trigger,
.nav-dropdown.is-active .nav-dropdown-trigger {
  color: #1e5c8c;
}

.navigation .active,
.nav-dropdown.is-active .nav-dropdown-trigger {
  font-weight: 600;
}

/* Menu thả xuống */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-chevron {
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 1px;
}

.nav-dropdown:hover .nav-dropdown-chevron,
.nav-dropdown:focus-within .nav-dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid #dfd6bc;
  border-radius: 8px;
  box-shadow: 0 10px 24px -4px rgba(36, 68, 92, 0.12), 0 2px 6px rgba(36, 68, 92, 0.04);
  padding: 6px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 9px 12px !important;
  border-radius: 6px;
  color: #24445c !important;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown-item:hover {
  background: #f4eee0 !important;
  color: #1e5c8c !important;
}

.nav-dropdown-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #ebf3f8;
  color: #1e5c8c;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-dropdown-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.nav-dropdown-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.nav-dropdown-desc {
  font-size: 11px;
  color: #617584;
  line-height: 1.25;
}

.login-button {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border: 1px solid #d6cbb1;
  border-radius: 6px;
  color: #245d88;
  background: #fffdf6;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.login-button:hover {
  background: #f4eee0;
  border-color: #c4b89b;
  color: #1a496f;
}

/* ==========================================================================
   Khung chứa nội dung chính
   ========================================================================== */
.page {
  max-width: 1236px;
  margin: 0 auto;
  padding: 36px 28px;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  align-items: center;
  gap: 36px;
  padding: 46px 48px;
  border-radius: 12px;
  background: rgba(245, 239, 216, 0.85);
  border: 1px solid #e5dcbf;
}

.hero-content {
  display: flex;
  flex-direction: column;
}

.faculty-brand {
  position: relative;
  left: -20px;
  top: -15px;
  width: min(100%, 540px);
  margin-bottom: 0;
}

.faculty-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.hero h1 {
  margin: 12px 0 16px;
  font-family: 'Literata', Georgia, serif;
  font-size: clamp(32px, 3.8vw, 44px);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.2px;
  color: #24445c;
}

.hero h1 span {
  color: #245d88;
}

.hero-content > p {
  max-width: 460px;
  color: #475e6f;
  font-size: 14.5px;
  line-height: 1.75;
  margin: 0 0 24px;
}

/* Thanh tìm kiếm mẫu */
.search-box {
  display: flex;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid #dcd3ba;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(36, 68, 92, 0.04);
}

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  border: none;
  border-radius: 4px;
  color: #24445c;
  background: transparent;
  font-size: 14.5px;
}

.search-box input::placeholder {
  color: #7b8e9c;
}

.search-box input:focus {
  outline: none;
}

.search-box button {
  flex-shrink: 0;
  padding: 11px 22px;
  border: 1px solid #dec383;
  border-radius: 6px;
  background: #efd097;
  color: #24445c;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.search-box button:hover {
  background: #e5c37f;
  border-color: #d1b16e;
}

.search-box button:active {
  transform: scale(0.98);
}

.home-search {
  width: min(100%, 680px);
  margin: 18px auto 0;
}

.search-box {
  box-sizing: border-box;
  width: 100%;
}

.search-hint {
  max-width: none;
  margin: 10px 0 0;
  color: #556c7d;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.search-hint em {
  font-style: italic;
}

/* Minh họa kệ sách (Hero Art) */
.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
  padding-bottom: 20px;
}

.arch {
  position: relative;
  width: 270px;
  height: 300px;
  padding: 65px 24px 20px;
  border-radius: 140px 140px 8px 8px;
  background: #d7e6f1;
  border: 1.5px solid rgba(88, 134, 164, 0.35);
}

.sparkle {
  position: absolute;
  top: 10px;
  right: -20px;
  color: #c99a32;
  font-size: 34px;
  user-select: none;
}

.shelf {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 62px;
  margin-bottom: 8px;
  padding: 0 8px;
  border-bottom: 6px solid #5a7f98;
}

.book-spine {
  width: 26px;
  height: 46px;
  border-top: 4px solid rgba(239, 208, 151, 0.7);
  border-radius: 2px 2px 0 0;
  background: #2a5b7d;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.2), inset -1px 0 0 rgba(0, 0, 0, 0.12);
}

.book-spine:nth-child(2n) {
  height: 40px;
  background: #cf9e3e;
}

.book-spine:nth-child(3n) {
  height: 52px;
  background: #4a7462;
}

.book-spine:nth-child(4n) {
  height: 44px;
  background: #8b5143;
}

.art-caption {
  position: absolute;
  right: 0;
  bottom: 6px;
  padding: 12px 18px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e0d7bd;
  box-shadow: 0 2px 8px rgba(36, 68, 92, 0.06);
  font-size: 12px;
  font-weight: 500;
  color: #24445c;
}

/* ==========================================================================
   Section: Sách nổi bật
   ========================================================================== */
.featured {
  margin-top: 46px;
  scroll-margin-top: 24px;
}

.featured-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  display: block;
  color: #245d88;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.featured-heading h2 {
  margin: 0;
  font-family: 'Literata', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: #24445c;
}

.featured-note {
  color: #586c7c;
  font-size: 12.5px;
}

/* Lưới sách (Books Grid) */
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.book-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5dcbf;
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.96);
  box-shadow: 0 1px 3px rgba(36, 68, 92, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.book-card:hover {
  transform: translateY(-2px);
  border-color: #d6cbb1;
  box-shadow: 0 6px 16px rgba(36, 68, 92, 0.08);
}

.book-cover-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 224px;
  padding: 22px;
  background: #f1ede1;
  border-bottom: 1px solid #e8dfc5;
}

.book-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 138px;
  min-height: 182px;
  padding: 16px 12px;
  border-left: 5px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  background: #345e76;
  color: #ffffff;
  text-align: left;
  box-shadow: 2px 4px 10px rgba(36, 68, 92, 0.16), 0 1px 3px rgba(36, 68, 92, 0.08);
}

.cover-label {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  opacity: 0.9;
}

.book-cover strong {
  font-family: 'Literata', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin: 8px 0;
}

.cover-decoration {
  color: #efd097;
  font-size: 26px;
  line-height: 1;
}

.featured-book-cover {
  display: block;
  width: 138px;
  height: 194px;
  object-fit: cover;
  object-position: center;
  border: 1px solid #e2dac0;
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(36, 68, 92, 0.08);
}

/* Thông tin sách */
.book-information {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.book-category {
  margin: 0 0 8px;
  color: #245d88;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.book-information h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: #24445c;
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  margin: 0 0 16px;
  color: #556c7d;
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 500;
}

.book-status {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  padding: 4px 9px;
  border-radius: 4px;
  background: #edf6f0;
  border: 1px solid #cce5d6;
  color: #215d3b;
  font-size: 11px;
  font-weight: 600;
}

.book-status.unavailable {
  background: #fdf3dc;
  border: 1px solid #f6deb0;
  color: #7f5c12;
}

.books-empty {
  padding: 24px;
  border: 1px dashed #d6cbb1;
  border-radius: 8px;
  color: #637786;
  background: rgba(255, 254, 250, 0.7);
}

.preview-note {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid #e9dfbf;
  color: #637786;
  font-size: 12px;
  line-height: 1.6;
}

/* ==========================================================================
   Trạng thái tìm kiếm động & Responsive
   ========================================================================== */
[hidden] {
  display: none !important;
}

#search-summary {
  margin-bottom: 20px;
  color: #556c7d;
  font-size: 13px;
}

/* Tablet và màn hình vừa */
@media (max-width: 900px) {
  .header {
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
  }

  .navigation {
    order: 3;
    justify-content: center;
    width: 100%;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 32px 24px;
    gap: 28px;
  }

  .hero-art {
    display: none;
  }

  .faculty-brand {
    left: 0;
    top: 0;
    margin-bottom: 8px;
  }

  .hero-content > p {
    max-width: 100%;
  }

  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .featured-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

/* Điện thoại di động */
@media (max-width: 480px) {
  .header {
    padding: 14px 16px;
    gap: 14px 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .brand-label {
    font-size: 8.5px;
  }

  .brand strong {
    font-size: 13px;
  }

  .login-button {
    padding: 7px 12px;
    font-size: 12px;
  }

  .navigation {
    gap: 16px;
    font-size: 12px;
  }

  .page {
    padding: 20px 14px;
  }

  .hero {
    padding: 22px 18px;
    border-radius: 8px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .search-box {
    flex-direction: column;
    padding: 8px;
  }

  .search-box button {
    width: 100%;
  }

  .books-grid {
    gap: 12px;
  }

  .book-cover-area {
    min-height: 180px;
    padding: 14px 8px;
  }

  .book-cover {
    width: 110px;
    min-height: 150px;
    padding: 12px 8px;
  }

  .book-cover strong {
    font-size: 13px;
  }

  .book-information {
    padding: 14px;
  }

  .book-information h3 {
    font-size: 13.5px;
    min-height: 38px;
  }
}

@media (max-width: 360px) {
  .books-grid {
    grid-template-columns: 1fr;
  }
}