
/* 1. Desktop & iPad Landscape Header: Giữ toàn bộ menu trên 1 dòng gọn đẹp (không rớt 2 dòng che nội dung) */
@media (min-width: 850px) {
  .header-nav-main { flex-wrap: nowrap !important; }
  .header-nav-main > li { margin: 0 3px !important; flex-shrink: 0; }
  .header-nav-main > li > a {
    font-size: 12.5px !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    white-space: nowrap !important;
    letter-spacing: 0 !important;
  }
  .header-main .header-button a.button {
    font-size: 12px !important;
    padding: 0 12px !important;
    white-space: nowrap !important;
  }
  #masthead .flex-col.hide-for-medium.flex-right { flex-shrink: 0; }
}
/* Tối ưu riêng cho iPad ngang (1024px) & Laptop nhỏ (850px–1220px): 100% 1 dòng, không rớt mục Thi CBT */
@media (min-width: 850px) and (max-width: 1220px) {
  #masthead .header-inner { padding-left: 10px !important; padding-right: 10px !important; }
  #logo { width: 142px !important; min-width: 132px !important; margin-right: 8px !important; }
  #logo img { max-height: 46px !important; width: auto !important; }
  .header-nav-main > li { margin: 0 1.5px !important; }
  .header-nav-main > li > a {
    font-size: 11px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  .header-nav-main .header-search { margin-left: 0 !important; }
  .header-main .header-button { margin-left: 4px !important; }
  .header-main .header-button a.button {
    font-size: 11px !important;
    padding: 0 10px !important;
    min-height: 32px !important;
    line-height: 30px !important;
  }
}
@media (min-width: 850px) and (max-width: 960px) {
  #logo { width: 118px !important; min-width: 110px !important; margin-right: 4px !important; }
  .header-nav-main > li { margin: 0 1px !important; }
  .header-nav-main > li > a {
    font-size: 10.2px !important;
    padding-left: 2.5px !important;
    padding-right: 2.5px !important;
  }
  .header-main .header-button a.button {
    font-size: 10.5px !important;
    padding: 0 8px !important;
  }
}

/* 2. Khắc phục lỗi tam giác đen ▼ bị lặp & lệch dưới thẻ <select> toàn site */
select, .wpcf7 select {
  background-image: none !important;
  -webkit-appearance: auto !important;
  appearance: auto !important;
  height: auto !important;
  min-height: 42px;
  line-height: 1.45 !important;
  padding: 8px 10px !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
}

/* 3. Khắc phục P0 Trang Kết Quả Tìm Kiếm (?s=...) bị height: 0px do Masonry */
body.search .row-masonry,
body.search-results .row-masonry {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)) !important;
  gap: 20px !important;
  height: auto !important;
  min-height: 200px !important;
  position: relative !important;
}
body.search .row-masonry > .col,
body.search-results .row-masonry > .col {
  position: static !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 100% !important;
  flex-basis: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
body.search .row-masonry > .col .col-inner,
body.search-results .row-masonry > .col .col-inner {
  padding: 16px !important;
  height: 100%;
}

/* 4. Khắc phục chữ trắng trên nền trắng ở Form /dang-ky/, /lien-he/ & Banner /tin-tuc/ */
body.page-id-dang-ky .entry-content p,
body.page .wpcf7-form p,
.wpcf7-form label {
  color: #1e293b !important;
}
.page-template-default .section-content p[style*="#ffffff"],
.page-template-default .section-content span[style*="#ffffff"] {
  color: #1e293b !important;
}
body.page .page-title,
body.page .banner {
  background-color: #0f172a;
}

/* 5. Trang chủ: Cải thiện độ tương phản khu vực HỆ THỐNG LỚP HỌC & vị trí chấm Slider */
.flickity-page-dots {
  bottom: 6px !important;
}
.home .tabbed-content,
.home .section .tabbed-content {
  background: rgba(11, 31, 58, 0.84) !important;
  border-radius: 14px;
  padding: 18px !important;
  color: #ffffff !important;
}
.home .tabbed-content .nav-tabs > li > a {
  color: #f8fafc !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border-radius: 8px !important;
  margin: 3px !important;
  padding: 7px 12px !important;
  font-weight: 700 !important;
}
.home .tabbed-content .nav-tabs > li.active > a {
  background: #dc2626 !important;
  color: #ffffff !important;
}
.home .tabbed-content .button,
.home .section a.button {
  white-space: nowrap !important;
}

/* 6. Mobile: Chống tràn bảng trong bài viết & dọn rác Mobile Drawer */
@media (max-width: 768px) {
  .entry-content table,
  .page-inner table,
  article table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .off-canvas .header-newsletter-item,
  .off-canvas a[href="#header-newsletter-signup"],
  .off-canvas a[href="https://zalo.me/0986683218" target="_blank" rel="noopener"] {
    display: none !important;
  }
  .mfp-wrap {
    z-index: 99999 !important;
  }
}

/* 7. Modal Tìm Kiếm Nhanh (Thay thế nút Search Header bị chết) */
#vs-search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 20px;
}
#vs-search-modal.is-open { display: flex; }
#vs-search-dialog {
  width: 100%;
  max-width: 620px;
  background: #ffffff;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  color: #0f172a;
}
#vs-search-dialog form {
  display: flex;
  gap: 8px;
  margin: 12px 0 14px;
}
#vs-search-dialog input[type="search"] {
  flex: 1;
  height: 44px;
  padding: 8px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  margin: 0;
}
#vs-search-dialog input[type="search"]:focus {
  border-color: #059669;
  outline: none;
}
#vs-search-dialog button[type="submit"] {
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 10px;
  background: #059669;
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
}
.vs-search-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.vs-search-chips a {
  padding: 5px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #1e293b !important;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none !important;
}
.vs-search-chips a:hover { background: #ecfdf5; color: #047857 !important; }
