/* ===========================================
   HEADER CHÍNH - Container tổng thể
   =========================================== */
.header {
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  color: black;
  border-bottom: 1px solid rgba(0, 159, 201, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.28s ease,
    backdrop-filter 0.28s ease, background-color 0.28s ease;
  will-change: transform, opacity;
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  box-shadow: 0 12px 32px rgba(15, 33, 58, 0.1);
}

/* ===========================================
   HEADER CONTAINER - Bố cục trong header
   =========================================== */
.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 10px;
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  gap: 16px;
  min-height: 60px;
}

#nav-placeholder {
  flex: 1;
}

/* ===========================================
   LOGO - Phần bên trái header
   =========================================== */
.logo {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 159, 201, 0.14);
  box-shadow: 0 6px 16px rgba(15, 33, 58, 0.1);
  backdrop-filter: blur(6px);
}

.logo a {
  text-decoration: none;
  color: inherit;
}

.logo h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
}

.logo img {
  height: 46px;
  width: auto;
  transition: opacity 0.3s ease;
}

.logo img:hover {
  opacity: 0.8;
}

/* ===========================================
   NAVIGATION - Menu desktop với nền viên thuốc
   =========================================== */
.nav {
  position: absolute;
  display: flex;
  justify-content: center;
  background-color: #f8f9fa;
  border-radius: 45px;
  padding: 12px 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  align-items: center;
}

/* ===========================================
   MENU LINKS - Desktop
   =========================================== */
.nav-menu li a {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  transition: all 0.3s ease;
  font-size: 14px;
  white-space: nowrap;
}

.nav-menu li a:hover {
  background-color: white;
  color: #009fc9;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.nav-menu li a.active {
  background-color: #009fc9;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* ===========================================
   MOBILE MENU BUTTON - Ẩn trên desktop
   =========================================== */
.mobile-menu-btn {
  display: none;
  background: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 8px;
  width: 50px;
  height: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: fixed;
  top: 20px;
  right: 50px;
  z-index: 1001;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mobile-menu-btn:hover {
  transform: none !important;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.mobile-menu-btn.active {
  background-color: #009fc9;
  border-color: #009fc9;
}

/* ===========================================
   RESPONSIVE MOBILE - SỬA LẠI ĐƠN GIẢN
   =========================================== */
:root {
  --mobile-nav-offset: 0px;
} /* chỉnh cao-thấp menu theo ý */

@media (max-width: 768px) {
  body {
    padding-bottom: 120px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }
  .header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px !important;
  }
  .logo {
    width: auto;
    display: flex;
    justify-content: center;
    order: 1;
    margin: 0 auto;
    padding: 8px 16px;
    box-shadow: 0 8px 22px rgba(15, 33, 58, 0.12);
  }
  .logo img {
    height: 44px;
    width: auto;
    display: block;
  }
  #nav-placeholder {
    display: none;
  }

  /* Nav ở đáy màn hình */
  .nav,
  .nav.mobile-floating {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 16px !important;
    bottom: calc(16px + var(--mobile-nav-offset)) !important;
    top: auto !important;
    width: min(420px, calc(100% - 16px)) !important;
    margin: 0 !important;
    background-color: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    border-radius: 50px !important;
    padding: 6px 12px !important;
    padding-bottom: 6px !important;
    padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 1020;
    display: flex !important;
    justify-content: center;
    align-items: center;
  }
  /* Phòng trường hợp class cũ còn sót */
  .nav.menu-bottom,
  .nav.menu-top,
  .nav.mobile-open {
    display: block !important;
  }

  .nav-menu {
    display: flex;
    justify-content: space-between;
    gap: 0;
    margin: 0;
    padding: 0;
    width: 100%;
  }
  .nav-menu li {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
  }

  .nav-link {
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 2px;
    padding: 3px 0;
  }
  .nav-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    color: #4b5b6a;
    background: transparent;
  }
  .nav-link.active .nav-icon {
    color: #fff;
  }
  .nav-label {
    margin: 0;
    font-size: 9px;
    line-height: 1.05;
    text-align: center;
    color: #4b5b6a;
  }
  .nav-link.active .nav-label {
    color: #fff;
  }
}

/* Desktop giữ nguyên */
@media (min-width: 769px) {
  .nav-icon {
    display: none;
  }
  .nav-label {
    display: inline;
  }
}
