.menu-porlet {
  z-index: 9999;
}

/* ------------------------------------------- */
/* CSS Tùy chỉnh cho Menu Chính */
/* Bọc CE để không “chạy tràn” style */
.navbar.main-menu-nav .container-fluid-max-xl {
  max-width: unset;
}

.main-menu-nav {
  background-color: #d9f1ff;
  border-bottom: 1px solid #d0e0f0;
  /* Rất quan trọng: Đặt Menu dính (sticky) ngay dưới Header. Giá trị này có thể cần điều chỉnh */
  top: 70px;
  /* Điều chỉnh giá trị này bằng chiều cao của Header để nó dính ngay dưới Header */
  z-index: 1020;
  /* Đảm bảo nó nằm dưới header và trên nội dung */
}

.navbar.main-menu-nav {
  padding: 0;
}

.navbar-nav .nav-link {
  color: #195a94 !important;
  font-weight: bold;
  font-size: 14px;
  padding: 8px 15px;
}

.navbar-nav .nav-link.active {
  color: #f65050 !important;
  font-weight: bold;
  position: relative;
}

.navbar-nav .nav-link.active::after {
  content: "";
  display: block;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 2px;
  background-color: #e60000;
}

/* ... Các style Dropdown và Chức năng khác giữ nguyên ... */
.main-menu-nav .dropdown-menu {
  border-radius: 8px;
  box-shadow: 2px 10px 25px rgba(0, 0, 0, 0.3);
  border: none;
}

.main-menu-nav .dropdown-item {
  font-size: 16px;
  color: #195a94;
  padding: 7px 24px;
  font-weight: 500;
}

.menu-functions {
  display: flex;
  align-items: center;
  padding-right: 150px;
  gap: 8px;
}

.menu-functions .btn,
.search-container {
  font-size: 14px;
  font-weight: 400;
  padding: 2px 10px;
  border-radius: 4px;
  height: 30px; /* Đảm bảo chiều cao đồng nhất */
  display: flex;
  align-items: center;
}

.menu-functions .btn {
  background-color: #d3efff;
  border: 1px solid #bcdfff;
  color: #004d99;
  gap: 8px;
}

/* --- CSS cho ô tìm kiếm mới --- */
.search-container {
  position: relative;
  border: 1px solid #0d6efd !important;
  background-color: #fff !important;
  width: 100px; /* Chiều rộng ban đầu */
  transition: width 0.4s ease-in-out;
  cursor: text;
  justify-content: flex-end; /* Đẩy icon sang phải */
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%; /* Ban đầu ẩn input */
  transition: width 0.4s ease-in-out;
  color: #004d99;
  padding: 0 !important;
}

.search-input::placeholder {
  color: #004d99;
}

/* Khi focus vào container (click vào), mở rộng nó và input bên trong */
.search-container:focus-within {
  width: 300px;
}

.search-container:focus-within .search-input {
  padding: 0 5px;
}

.date-info {
  font-size: 14px;
  color: #4a647b;
  font-weight: 600;
  background-color: #bee7ff;
  padding: 5px 10px;
  position: absolute;
  right: 0;
  top: 0px;
  bottom: 0px;
  display: flex;
  align-items: center;
  width: 140px;
}

.nav-item.dropdown.show .nav-link {
  background: #fff;
}

.navbar-nav .nav-link:hover {
  background: #fff;
}

.nav-item {
  padding-right: 12px;
}

.navbar-nav .dropdown-menu {
  margin-left: -10px;
  margin-top: -2px;
}

.nav-item.dropdown.show .dropdown-menu {
  display: block;
}

.navbar-nav {
  margin-bottom: -1px !important;
}

.navbar-nav .dropdown-menu {
  width: auto;
  max-width: unset;
  white-space: nowrap;
}

.navbar-nav .dropdown-item {
  padding-right: 50px;
}

.menu-functions .btn:hover {
  background-color: #fff;
  border-color: #1a6fe2;
}

.menu-functions .btn:hover i {
  color: #f65050;
}

/* LIGHT SIDEBAR 70vh + SHADOW + SCROLL */
.sidebar-left-menu {
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  position: sticky; /* bám theo viewport */
  top: 0; /* sẽ bị JS override theo chiều cao header */
  margin-top: 0;
  height: 70vh;
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px 0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.sidebar-left-menu .nav {
  margin: 0;
}

.sidebar-left-menu .nav-item {
  position: relative;
}

.sidebar-left-menu .nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: bolder;
  color: #374151;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-left-menu .nav-link:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

.sidebar-left-menu .nav-link.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

/* SUBMENU */
.sidebar-left-menu .submenu {
  display: none;
  padding-left: 14px;
  margin-top: 4px;
  border-left: 1px solid #e5e7eb;
}

.sidebar-left-menu .submenu.show {
  display: block;
}

.sidebar-left-menu .submenu .nav-link {
  font-size: 13px;
  padding-top: 6px;
  padding-bottom: 6px;
  color: #4b5563;
}

.sidebar-left-menu .submenu .nav-link:hover {
  background: #e5e7eb;
  color: #111827;
}

.sidebar-left-menu .submenu .nav-link.active {
  background: #1d4ed8;
  color: #ffffff;
}

.sidebar-left-menu .caret-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.sidebar-left-menu .fas.fa-chevron-down {
  font-size: 10px;
  color: #9ca3af;
  transition: transform 0.2s ease, color 0.15s ease;
}

.sidebar-left-menu .toggle-btn.open .fas.fa-chevron-down {
  transform: rotate(180deg);
  color: #4b5563;
}

.sidebar-left-menu .nav-item.has-children {
  margin-bottom: 2px;
}

/* ===== Scrollbar nhỏ, bo tròn, chỉ hiện khi hover ===== */
/* Firefox */
.sidebar-left-menu {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.sidebar-left-menu:hover {
  scrollbar-color: #9ca3af transparent;
}

/* WebKit (Chrome, Edge, Safari) */
.sidebar-left-menu::-webkit-scrollbar {
  width: 0;
}

.sidebar-left-menu:hover::-webkit-scrollbar {
  width: 6px;
}

.sidebar-left-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-left-menu::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 999px;
}

.sidebar-left-menu:hover::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
}

.sidebar-left-menu:hover::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af;
}

@media (max-width: 991.98px) {
  .menuttcp .collapse {
    display: block !important;
  }
  .menu-functions {
    padding: 5px 0;
  }
  .an-mobile {
    display: none !important;
  }
  .search-container,
  .search-container:focus-within {
    width: 100%;
  }
  .menu-functions .btn {
    padding: 0;
    min-width: 30px;
    justify-content: center;
    font-size: 18px;
  }
  .navbar.main-menu-nav {
    border-bottom: none;
  }
}