/* =============================================================================
   ISPAE — header / thanh menu / giao diện kiểu app (nạp sau main/menu/bootstrap/media.css)
   Desktop (>1200px): logo ISPAE + tên viện dạng chữ, ô tìm kiếm + nút ngôn ngữ; thanh menu xanh navy.
   App (≤1200px): app bar trắng (biểu tượng + tên viện + 2 nút Tìm kiếm / Ngôn ngữ), thanh tab dưới,
   bottom sheet. JS: js/ispae-mobile.js. Theo mẫu CIAT (css/ciat-theme.css).
   ========================================================================== */
:root {
  --i-navy: #2b3990;
  --i-navy-dark: #1d2768;
  --i-navy-deep: #141b4d;
  --i-green: #16a04b;
  --i-green-dark: #0f7a38;
  --i-ink: #1b2233;
  --i-muted: #5d6680;
  --i-line: #e3e6ef;
  --i-soft: #f3f5fa;
  --i-font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --i-tab-h: 62px;
}

/* ---------- Header desktop ---------- */
#gop_top.isp-top {
  padding: 0;
  background: #fff !important;
  border-bottom: 1px solid var(--i-line);
}

.isp-top__row {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 96px;
}

.isp-brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  margin-right: auto;
  text-decoration: none !important;
}

.isp-brand__logo {
  flex: 0 0 auto;
  height: 62px;
  width: auto;
}

.isp-brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 18px;
  border-left: 2px solid var(--i-line);
  line-height: 1.2;
}

.isp-brand__vi {
  font-family: var(--i-font);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.005em;
  color: var(--i-navy);
  text-transform: uppercase;
  white-space: nowrap;
}

.isp-brand__en {
  margin-top: 5px;
  font-family: var(--i-font);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--i-green-dark);
  text-transform: uppercase;
  white-space: nowrap;
}

.isp-top__tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

/* Ô tìm kiếm (asp:Panel + TextBox + LinkButton của master) */
.isp-search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 280px;
  height: 42px;
  padding: 0 4px 0 14px;
  background: var(--i-soft);
  border: 1.5px solid transparent;
  border-radius: 999px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.isp-search:focus-within {
  background: #fff;
  border-color: var(--i-navy);
  box-shadow: 0 0 0 3px rgba(43, 57, 144, 0.12);
}

.isp-search > .fa {
  color: #8a92a8;
  font-size: 15px;
}

.isp-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  font-family: var(--i-font);
  font-size: 14.5px;
  color: var(--i-ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.isp-search input::placeholder {
  color: #8a92a8;
}

.isp-search .isp-search__go {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  font-family: var(--i-font);
  font-size: 13.5px;
  font-weight: 700;
  color: #fff !important;
  background: var(--i-navy);
  border-radius: 999px;
}

.isp-search .isp-search__go:hover {
  background: var(--i-navy-dark);
}

/* Nút tròn (ngôn ngữ, …) */
.isp-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  min-width: 42px;
  padding: 0 12px;
  font-family: var(--i-font);
  font-size: 13px;
  font-weight: 700;
  color: var(--i-navy);
  background: var(--i-soft);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.isp-iconbtn .fa {
  font-size: 18px;
}

.isp-iconbtn:hover,
.isp-iconbtn[aria-expanded="true"] {
  color: #fff;
  background: var(--i-navy);
}

/* Giữ khung Google Translate (doGTranslate cần) nhưng không hiện */
#google_translate_element2,
#google_translate {
  display: none !important;
}

/* ---------- Thanh menu desktop ---------- */
#nav.menu_top,
#nav {
  background: var(--i-navy) !important;
  box-shadow: 0 6px 16px -10px rgba(20, 27, 77, 0.6);
}

@media (min-width: 1201px) {
  #nav .menu-content {
    background: transparent !important;
  }

  #nav .menu > ul {
    align-items: stretch;
    gap: 2px;
  }

  #nav .menu > ul > li > a {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
    padding: 13px 16px;
    font-family: var(--i-font) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: #fff !important;
    border-bottom: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
  }

  #nav .menu > ul > li > a:hover,
  #nav .menu > ul > li:hover > a,
  #nav .menu > ul > li > a.is-active {
    background: rgba(255, 255, 255, 0.1) !important;
    border-bottom-color: var(--i-green);
  }

  #nav .menu > ul > li > a img {
    height: 18px;
    width: auto;
    filter: brightness(0) invert(1);
  }

  #nav .menu > ul > li > a .fa-sort-down {
    position: static !important;
    margin: -4px 0 0 4px;
    opacity: 0.8;
  }

  /* Rộng theo nội dung mục dài nhất (mục không xuống dòng) */
  #nav .menu > ul > li > .menu__sub-menu {
    top: 100% !important;
    width: max-content !important;
    min-width: 180px;
    max-width: 420px;
    padding: 6px;
    background: #fff !important;
    border-top: 3px solid var(--i-green);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 18px 36px -14px rgba(20, 27, 77, 0.45);
  }

  /* menu.css cũ đặt li line-height: 30px → mỗi dòng menu con rất cao; đưa về sát nội dung */
  #nav .menu__sub-menu .menu__sub-menu__item {
    min-width: 0 !important; /* menu.css cũ ép min-width: 280px → menu không co theo nội dung */
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
    background: transparent !important;
    border: 0 !important;
  }

  #nav .menu__sub-menu .menu__sub-menu__item > a,
  #nav .menu__sub-menu .menu__sub-menu__item > a.dropdown-item {
    display: block;
    margin: 0 !important;
    padding: 10px 16px !important;
    font-family: var(--i-font) !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4 !important;
    color: var(--i-ink) !important;
    white-space: nowrap;
    border: 0 !important;
    border-radius: 8px;
  }

  /* "Thoát" (font đỏ) giữ màu đỏ */
  #nav .menu__sub-menu .menu__sub-menu__item > a font[color] {
    color: #c0392b;
  }

  #nav .menu__sub-menu .menu__sub-menu__item > a:hover {
    color: var(--i-navy) !important;
    background: var(--i-soft) !important;
  }

  /* Ô tìm kiếm cũ trong thanh menu đã chuyển lên header */
  #nav .timkiem,
  #nav .logo_mobile {
    display: none !important;
  }
}

@media (min-width: 1201px) and (max-width: 1399px) {
  .isp-brand__vi { font-size: 18px; }
  .isp-brand__en { font-size: 11px; letter-spacing: 0.04em; }
  .isp-search { width: 220px; }
}

/* =============================================================================
   Giao diện kiểu app (≤1200px)
   ========================================================================== */
.isp-appbar__act,
.isp-tabbar,
.isp-sheet {
  display: none;
}

/* Sheet ngôn ngữ dùng cả trên desktop: hộp thoại giữa màn hình */
.isp-sheet {
  position: fixed;
  inset: 0;
  z-index: 100000;
}

.isp-sheet:not([hidden]) {
  display: block;
}

.isp-sheet__nen {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 46, 0.45);
  opacity: 0;
  transition: opacity 0.2s;
}

.isp-sheet__khung {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-family: var(--i-font);
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.isp-sheet.is-mo .isp-sheet__nen { opacity: 1; }
.isp-sheet.is-mo .isp-sheet__khung { transform: translateY(0); }

@media (min-width: 1201px) {
  .isp-sheet__khung {
    top: 50%;
    bottom: auto;
    max-width: 420px;
    border-radius: 18px;
    transform: translateY(-46%) scale(0.98);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
  }

  .isp-sheet.is-mo .isp-sheet__khung {
    transform: translateY(-50%);
    opacity: 1;
  }

  .isp-sheet__keo { display: none; }
}

.isp-sheet__dau {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 12px 8px 18px;
  touch-action: none;
}

.isp-sheet__keo {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  background: #d5d9e5;
  border-radius: 2px;
}

.isp-sheet__dau h2 {
  margin: 0;
  font-family: var(--i-font);
  font-size: 18px;
  font-weight: 800;
  color: var(--i-navy-deep);
}

.isp-sheet__dong {
  width: 40px;
  height: 40px;
  font-size: 16px;
  color: #3b4360;
  background: var(--i-soft);
  border: 0;
  border-radius: 50%;
}

.isp-sheet__than {
  padding: 4px 14px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.isp-sheet__h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 4px 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--i-muted);
}

.isp-sheet__xemhet {
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--i-navy) !important;
}

.isp-sheet__luoi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.isp-sheet__o {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 82px;
  padding: 8px 4px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: var(--i-ink) !important;
  text-decoration: none !important;
  background: var(--i-soft);
  border-radius: 14px;
}

.isp-sheet__o .fa {
  font-size: 22px;
  color: var(--i-navy);
}

.isp-sheet__o .fa-external-link {
  font-size: 10px;
  color: var(--i-muted);
}

.isp-sheet__ds {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--i-line);
  border-radius: 14px;
}

.isp-sheet__ds a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 14px;
  font-size: 14.5px;
  color: var(--i-ink) !important;
  text-decoration: none !important;
  border-top: 1px solid #eef0f6;
}

.isp-sheet__ds a:first-child { border-top: 0; }

.isp-sheet__ds a .fa {
  width: 12px;
  color: var(--i-green);
}

/* Tìm kiếm trong sheet */
.isp-msearch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  background: #fff;
  border: 1.5px solid #cfd4e3;
  border-radius: 999px;
}

.isp-msearch:focus-within {
  border-color: var(--i-navy);
  box-shadow: 0 0 0 3px rgba(43, 57, 144, 0.14);
}

.isp-msearch > .fa { color: #8a92a8; }

.isp-msearch input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  font-family: var(--i-font);
  font-size: 16px;
  color: var(--i-ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.isp-msearch input.is-loi { animation: isp-lac 0.3s 2; }

@keyframes isp-lac {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.isp-msearch button {
  height: 40px;
  padding: 0 18px;
  font-family: var(--i-font);
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  background: var(--i-navy);
  border: 0;
  border-radius: 999px;
}

.isp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.isp-chips button {
  padding: 8px 14px;
  font-family: var(--i-font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--i-navy);
  background: #eef0f9;
  border: 0;
  border-radius: 999px;
}

/* Ngôn ngữ */
.isp-lang {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--i-line);
  border-radius: 14px;
}

.isp-lang button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 16px;
  font-family: var(--i-font);
  font-size: 15.5px;
  font-weight: 600;
  text-align: left;
  color: var(--i-ink);
  background: #fff;
  border: 0;
  border-top: 1px solid #eef0f6;
}

.isp-lang button:first-child { border-top: 0; }
.isp-lang button:hover { background: var(--i-soft); }

.isp-lang img {
  width: 28px;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.isp-lang span { flex: 1; }

.isp-lang .fa {
  visibility: hidden;
  color: var(--i-green);
}

.isp-lang .is-chon {
  color: var(--i-navy-deep);
  background: #f2f4fb;
}

.isp-lang .is-chon .fa { visibility: visible; }

.isp-sheet__note {
  margin: 12px 4px 0;
  font-size: 12.5px;
  color: var(--i-muted);
}

body.isp-sheet-mo { overflow: hidden; }

@media (max-width: 1200px) {
  body.isp-app {
    padding-bottom: calc(var(--i-tab-h) + env(safe-area-inset-bottom, 0px));
  }

  /* App bar: #nav thành thanh trắng dính đỉnh */
  body.isp-app #nav,
  body.isp-app #nav.menu_top {
    position: sticky;
    top: 0;
    height: auto !important;
    background: #fff !important;
    border-bottom: 1px solid var(--i-line);
    box-shadow: 0 4px 14px -10px rgba(20, 27, 77, 0.35);
    transform: none !important;
  }

  body.isp-app #nav .container {
    width: auto !important;
    max-width: none !important;
    padding-left: 10px !important;
    padding-right: 6px !important;
  }

  body.isp-app #nav .container > .row { margin: 0; }
  body.isp-app #nav .container > .row > [class*="col-"] { padding: 0; }

  /* Ẩn nút ☰, menu thả xuống, ô tìm kiếm cũ: thay bằng thanh tab + sheet */
  body.isp-app #nav .menu-button,
  body.isp-app #nav #nav-icon,
  body.isp-app #nav_sticky,
  body.isp-app #nav .timkiem {
    display: none !important;
  }

  body.isp-app #nav .isp-appbar {
    display: flex;
    align-items: center;
    min-height: 58px;
  }

  body.isp-app #nav .logo_mobile {
    display: block;
    position: static;
    top: 0 !important;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 !important;
    container: ispbrand / inline-size;
  }

  .isp-mbrand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    text-decoration: none !important;
  }

  /* Logo đầy đủ (quả cầu + chữ ISPAE), tỉ lệ ~3.1:1 */
  .isp-mbrand img.isp-mbrand__logo {
    flex: 0 0 auto;
    width: auto !important;
    height: 34px;
  }

  .isp-mbrand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    padding-left: 9px;
    border-left: 1.5px solid var(--i-line);
    line-height: 1.18;
  }

  .isp-mbrand__l1,
  .isp-mbrand__l2 {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    font-family: var(--i-font);
    font-size: 14px;
    font-weight: 800;
    color: var(--i-navy);
    text-transform: uppercase;
    letter-spacing: 0.005em;
  }

  .isp-mbrand__l2 {
    margin-top: 1px;
    color: var(--i-green-dark);
  }

  /* Bản rộng: tên VI một dòng + tên tiếng Anh (chỉ hiện khi khối logo đủ rộng, xem @container dưới) */
  .isp-mbrand__vi,
  .isp-mbrand__en {
    display: none;
    overflow: hidden;
    white-space: nowrap;
    font-family: var(--i-font);
    text-transform: uppercase;
  }

  .isp-mbrand__vi {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.005em;
    color: var(--i-navy);
  }

  .isp-mbrand__en {
    margin-top: 3px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--i-green-dark);
  }

  @container ispbrand (min-width: 660px) {
    .isp-mbrand__l1,
    .isp-mbrand__l2 {
      display: none;
    }

    .isp-mbrand__vi,
    .isp-mbrand__en {
      display: block;
    }
  }

  .isp-appbar__act {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
    margin-left: 6px;
  }

  .isp-appbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 19px;
    color: var(--i-navy);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .isp-appbar__btn:active,
  .isp-appbar__btn[aria-expanded="true"] {
    background: var(--i-soft);
  }

  /* ----- Thanh tab dưới ----- */
  body.isp-app .isp-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99990;
    display: flex;
    height: calc(var(--i-tab-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid var(--i-line);
    box-shadow: 0 -4px 16px rgba(20, 27, 77, 0.08);
  }

  .isp-tabbar > a,
  .isp-tabbar > button {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding: 0;
    font-family: var(--i-font);
    font-size: 11.5px;
    font-weight: 600;
    color: #646c84;
    text-decoration: none !important;
    background: transparent;
    border: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .isp-tabbar > * .fa {
    font-size: 20px;
    line-height: 1;
  }

  .isp-tabbar > * span {
    max-width: 100%;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .isp-tabbar > .is-active,
  .isp-tabbar > [aria-expanded="true"] {
    color: var(--i-navy);
  }

  .isp-tabbar > .is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 28%;
    right: 28%;
    height: 3px;
    background: var(--i-green);
    border-radius: 0 0 3px 3px;
  }

  .isp-tabbar > .is-loading .fa { animation: isp-xoay 0.8s linear infinite; }
  .isp-tabbar > .is-loading .fa::before { content: "\f110"; }

  @keyframes isp-xoay {
    to { transform: rotate(360deg); }
  }

  /* Bàn phím ảo mở: ẩn thanh tab */
  body.isp-app.isp-kb-mo .isp-tabbar { display: none; }
  body.isp-app.isp-kb-mo { padding-bottom: 0; }
}

@media (max-width: 1200px) and (min-width: 768px) {
  .isp-mbrand img.isp-mbrand__logo { height: 42px; }
  .isp-mbrand__l1, .isp-mbrand__l2 { font-size: 16px; }
}

@media (max-width: 400px) {
  .isp-mbrand { gap: 7px; }
  .isp-mbrand img.isp-mbrand__logo { height: 28px; }
  .isp-mbrand__text { padding-left: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .isp-sheet__khung,
  .isp-sheet__nen {
    transition: none;
  }
}

/* Thanh thông báo Google Translate: không đẩy trang xuống */
.goog-te-banner-frame,
iframe.goog-te-banner-frame,
.VIpgJd-ZVi9od-ORHb-OEVmcd {
  display: none !important;
}

body {
  top: 0 !important;
}
