/* Menu "KHÁC" dạng mega menu trên máy tính.
   Chỉ áp dụng từ 821px để giữ nguyên cách hiển thị trên điện thoại. */
/* Khung canh le dung chung tren may tinh.
   Menu, hang ngay - tin chay va noi dung luon dung cung hai mep. */
@media (min-width: 821px) {
  :root {
    --portal-shell-max: 1480px;
    --portal-shell-gutter: 24px;
  }

  .nav-container,
  .top-marquee-container,
  .main-content {
    width: 100%;
    max-width: var(--portal-shell-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--portal-shell-gutter);
    padding-right: var(--portal-shell-gutter);
    box-sizing: border-box;
  }

  .top-marquee-container {
    min-width: 0;
  }

  .top-marquee-container > marquee {
    min-width: 0;
    flex: 1 1 auto;
  }

  /* Cac trang co khung noi dung rieng van canh chinh xac theo khung do. */
  body.radio-view-active,
  body.media-view-active {
    --portal-shell-max: 1480px;
    --portal-shell-gutter: 22px;
  }

  body.article-view-active {
    --portal-shell-max: 1540px;
    --portal-shell-gutter: 22px;
  }

  body.quiz-page-active {
    --portal-shell-max: 1420px;
    --portal-shell-gutter: 28px;
  }

  body.glossary-page-active .nav-container,
  body.glossary-page-active .top-marquee-container {
    width: min(1380px, calc(100% - 40px));
    max-width: 1380px;
    padding-left: 0;
    padding-right: 0;
  }

  /* Trang Lien he dung bo khung rieng. */
  .main-nav .nav-inner {
    width: min(1240px, calc(100% - 48px));
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 821px) {
  #nav-more > .dropdown-menu,
  #moreMenuItem > .nav-dropdown {
    left: auto;
    right: 0;
    width: min(520px, calc(100vw - 32px));
    min-width: 0;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
  }

  #nav-more > .dropdown-menu > li,
  #moreMenuItem > .nav-dropdown > li {
    min-width: 0;
    height: 100%;
  }

  #nav-more > .dropdown-menu > li > a,
  #moreMenuItem > .nav-dropdown > li > a {
    width: 100%;
    min-height: 52px;
    height: 100%;
    padding: 11px 18px !important;
    display: flex !important;
    align-items: center;
    line-height: 1.35;
    white-space: normal !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09) !important;
  }

  #nav-more > .dropdown-menu > li:nth-child(odd) > a,
  #moreMenuItem > .nav-dropdown > li:nth-child(odd) > a {
    border-right: 1px solid rgba(255, 255, 255, 0.09) !important;
  }

  #nav-more > .dropdown-menu > li:nth-last-child(-n + 2) > a,
  #moreMenuItem > .nav-dropdown > li:nth-last-child(-n + 2) > a {
    border-bottom: 0 !important;
  }

  #nav-more > .dropdown-menu > li > a:hover,
  #moreMenuItem > .nav-dropdown > li > a:hover {
    padding-left: 22px !important;
  }

  /* Hỗ trợ mở menu bằng bàn phím, không chỉ bằng rê chuột. */
  #nav-more:focus-within > .dropdown-menu,
  #moreMenuItem:focus-within > .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translate(0);
  }

  /* Khi header thu gọn thành thanh dọc sau khi cuộn trang. */
  body.header-scrolled #nav-more > .dropdown-menu {
    left: 100% !important;
    right: auto !important;
    width: min(520px, calc(100vw - 340px)) !important;
    min-width: 0 !important;
    max-height: none !important;
    padding: 8px !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow: hidden !important;
  }
}
