/* ============================================
   TRANSPARENT HEADER - HYDROLIFE STYLE (REDESIGNED)
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--zz-blue);
  /* Fixed Blue Background */
  backdrop-filter: none;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
  /* Always show shadow */
  z-index: 1000;
  transition: all 0.3s ease;
}

/* Khi scroll xuống - header giữ nguyên background */
.header.scrolled,
.header.force-background {
  background: var(--zz-blue);
  backdrop-filter: none;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
}

/* Header uses global page-container - no custom styling needed */
/* But remove top padding since header is fixed */
.header .page-container {
  padding-top: 0;
}

.header .nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  gap: 3rem;
  /* Tăng khoảng cách giữa logo và menu */
}

/* Cart icon styling */
.cart-icon-container {
  position: relative;
  display: inline-block;
  color: #fff;
  /* Always white */
}

.cart-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: red;
  color: white;
  border-radius: 50%;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1;
}

/* Brand/Logo - Thiết kế mới */
.brand {
  flex-shrink: 0;
  padding: 0.5rem 0;
  /* Thêm padding trên dưới cho logo */
}

.brand a {
  display: block;
  line-height: 0;
  transition: all 0.3s ease;
}

.brand a:hover {
  transform: scale(1.05);
  /* Hiệu ứng hover cho logo */
}

.brand img {
  height: 60px;
  /* Tăng kích thước logo */
  width: auto;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.header.scrolled .brand img,
.header.force-background .brand img {
  height: 60px;
  /* Kích thước khi scroll */
}

/* Menu Navigation - Thiết kế mới */
.menu {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  /* Khoảng cách đều giữa các item */
  flex-wrap: nowrap;
}

.header-cart-desktop {
  display: block;
}

.header-cart-mobile {
  display: none;
}

.menu a,
.menu button {
  position: relative;
  padding: 0.5rem 1rem;
  /* Padding thoải mái hơn */
  font-size: 16px;
  color: #ffffff;
  /* Always white */
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.8px;
}

/* Hiệu ứng underline đẹp */
/* .menu a::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #ffffff;
  transition: width 0.3s ease;
} */

.header.scrolled .menu a,
.header.scrolled .menu button,
.header.force-background .menu a,
.header.force-background .menu button {
  color: #ffffff;
  /* Keep white on scroll */
}

.header.scrolled .menu a::after,
.header.force-background .menu a::after {
  background: #ffffff;
  /* Keep white underline */
}



.menu a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.header.scrolled .menu a:hover,
.header.force-background .menu a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Home icon styling */
.menu a[href="/"] {
  padding: 0.5rem 1rem;
  /* Padding nhỏ hơn cho icon */
  display: flex;
  align-items: center;
  justify-content: center;

}

.menu a[href="/"] svg {
  transition: all 0.3s ease;
}

.menu a[href="/"]:hover svg {
  transform: scale(1.1);
}

/* Mobile: Hiển thị text "Trang chủ" thay vì icon */
@media (max-width: 900px) {
  .menu a[href="/"] {
    padding: 1rem 1.2rem;
    justify-content: flex-start;
  }

  .menu a[href="/"] svg {
    display: none;
  }
}

/* Active link - Thiết kế mới */
.menu a.active {
  background: rgba(255, 255, 255, 0.25);
  font-weight: 700;
}

.menu a.active::after {
  width: 70%;
}

.header.scrolled .menu a.active,
.header.force-background .menu a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.25);
}

/* Logout button styling - Thiết kế mới */
.menu form {
  display: inline-block;
  margin: 0;
  flex-shrink: 0;
}

.menu .btn {
  padding: 0.8rem 1.8rem;
  /* Padding lớn hơn cho button */
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid #ffffff;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-radius: 30px;
  /* Bo tròn nhiều hơn */
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.menu .btn:hover {
  background: #ffffff;
  color: var(--zz-blue);
  /* Blue text on white hover */
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.header.scrolled .menu .btn,
.header.force-background .menu .btn {
  border-color: #ffffff;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.header.scrolled .menu .btn:hover,
.header.force-background .menu .btn:hover {
  background: #ffffff;
  color: var(--zz-blue);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

/* Mobile Menu Toggle - Thiết kế mới */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.mobile-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-toggle span {
  display: block;
  width: 26px;
  height: 3px;
  background: #ffffff;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.header.scrolled .mobile-toggle,
.header.force-background .mobile-toggle {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.header.scrolled .mobile-toggle span,
.header.force-background .mobile-toggle span {
  background: #ffffff;
}

/* Spacer to prevent content hiding behind fixed header */
.header-spacer {
  height: 70px;
  /* Adjust based on header height */
  display: block;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Hide mobile menu overlay on desktop */
.menu-overlay {
  display: none;
}

@media (max-width: 1400px) {
  /* Uses global page-container padding */
}

@media (max-width: 1200px) {
  .header .nav-container {
    gap: 2rem;
  }

  .menu {
    gap: 0.5rem;
  }

  .menu a,
  .menu button {
    padding: 0.7rem 1.2rem;
    font-size: 0.88rem;
  }

  .menu .btn {
    padding: 0.7rem 1.5rem;
  }
}

@media (max-width: 1024px) {
  .header .nav-container {
    gap: 1.5rem;
  }

  .menu {
    gap: 0.3rem;
  }

  .menu a,
  .menu button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  .brand img {
    height: 45px;
  }

  .header.scrolled .brand img,
  .header.force-background .brand img {
    height: 40px;
  }
}

@media (max-width: 1250px) {
  /* Uses global page-container padding */

  .header .nav-container {
    padding: 1rem 0;
    gap: 1rem;
  }

  .brand img {
    height: 45px;
  }

  .header.scrolled .brand img,
  .header.force-background .brand img {
    height: 45px;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .mobile-toggle {
    display: flex;
    z-index: 1001;
    margin: 10px 0;
  }

  .header-cart-desktop {
    display: none;
  }

  .header-cart-mobile {
    display: block;
  }

  .header.scrolled .cart-icon-container,
  .header.force-background .cart-icon-container {
    color: #ffffff;
  }

  /* Hide desktop menu */
  .menu {
    display: none !important;
  }

  /* MOBILE MENU OVERLAY - SEPARATE LAYER WITH HEADER */
  .menu-overlay {
    display: flex !important;
    /* Override desktop display: none */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--zz-blue);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    z-index: 1002;
    flex-direction: column;
  }

  .menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Menu overlay header - IDENTICAL to main header */
  .menu-overlay-header {
    flex-shrink: 0;
    background: var(--zz-blue);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1;
  }

  .menu-overlay-header .page-container {
    padding-top: 0;
  }

  .menu-overlay-header .nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
  }

  .menu-overlay-header .brand {
    flex-shrink: 0;
    padding: 0.5rem 0;
  }

  /* ENSURE LOGO SIZE MATCHES EXACTLY */
  .menu-overlay-header .brand img {
    height: 40px !important;
    width: auto;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
  }

  .menu-overlay-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .menu-overlay-header .mobile-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin: 10px 0;
  }

  .menu-overlay-header .mobile-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background: #ffffff;
    border-radius: 3px;
    transition: all 0.3s ease;
  }

  /* Menu overlay content - MODERN ANIMATIONS, TOP ALIGNED */
  .menu-overlay-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 3rem 0 2rem 0;
    background: var(--zz-blue);
  }

  .menu-overlay-content a {
    width: 100%;
    padding: 1.2rem;
    margin: 0;
    font-size: 1.1rem;
    color: #fff !important;
    border: none;
    text-align: left;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
  }

  /* Modern slide-in effect */
  .menu-overlay-content a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .menu-overlay-content a:hover::before {
    width: 100%;
  }

  .menu-overlay-content a:hover {
    padding-left: 1.5rem;
    color: #fff !important;
    background: transparent;
  }

  .menu-overlay-content a.active {
    background: rgba(255, 255, 255, 0.12);
    font-weight: 600;
    border-left: 4px solid #ffffff;
    padding-left: 1.5rem;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
  }

  .menu-overlay-content a.active::before {
    width: 100%;
  }

  /* Hamburger active state - expand animation */
  .mobile-toggle.active {
    background: rgba(255, 255, 255, 0.2);
  }

  /* Default state - ensure spans are in normal position */
  .mobile-toggle span:nth-child(1) {
    transform: translateY(0);
  }

  .mobile-toggle span:nth-child(2) {
    opacity: 1;
  }

  .mobile-toggle span:nth-child(3) {
    transform: translateY(0);
  }

  /* Active state - expand */
  .mobile-toggle.active span:nth-child(1) {
    transform: translateY(9px);
  }

  .mobile-toggle.active span:nth-child(2) {
    opacity: 1;
  }

  .mobile-toggle.active span:nth-child(3) {
    transform: translateY(-9px);
  }
}

@media (max-width: 480px) {
  /* Uses global page-container padding */

  .brand img {
    height: 40px;
  }

  .header.scrolled .brand img,
  .header.force-background .brand img {
    height: 40px;
  }

  .menu {
    width: 280px;
  }
}

/* ============================================
   DROPDOWN MENU STYLES 

/* Menu Item Container */
.menu-item {
  position: relative;
  display: inline-block;
}

/* Menu Link - Điều chỉnh để phù hợp với style hiện tại */
.menu-link {
  position: relative;
  padding: 0.5rem 1rem;
  font-size: 16px;
  color: #ffffff;
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.8px;
  display: block;
}

/* Mũi tên dropdown được xử lý bằng thẻ i trong HTML để tránh xung đột với underline ::after */
.menu-item .dropdown-icon {
  font-size: 10px;
  margin-left: 6px;
  transition: transform 0.3s ease;
  display: inline-block;
}

.menu-item:hover .dropdown-icon {
  transform: rotate(180deg);
}

/* Dropdown Menu - Desktop */
.menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  margin-top: 8px;
}

.menu-item:hover .menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown Links */
.menu-dropdown a {
  display: block;
  padding: 12px 20px;
  color: #333 !important;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 0;
  letter-spacing: 0.3px;
}

.menu-dropdown a::after {
  display: none !important; /* Tắt underline effect cho dropdown items */
}

.menu-dropdown a:hover {
  background: rgba(0, 102, 204, 0.08);
  color: var(--zz-blue) !important;
  padding-left: 24px;
  transform: none;
}

.menu-dropdown a.active {
  background: rgba(0, 102, 204, 0.12);
  color: var(--zz-blue) !important;
  font-weight: 600;
  border-left: 3px solid var(--zz-blue);
}

/* ============================================
   MOBILE DROPDOWN STYLES
   ============================================ */

.mobile-menu-item {
  width: 100%;
}

.mobile-menu-toggle {
  width: 100%;
  padding: 1.2rem;
  margin: 0;
  font-size: 1.1rem;
  color: #fff !important;
  border: none;
  text-align: left;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

/* Mũi tên cho mobile dropdown */
.mobile-menu-toggle::after {
  content: '▼';
  font-size: 12px;
  transition: transform 0.3s ease;
  display: inline-block;
  margin-left: auto;
}

.mobile-menu-item.open .mobile-menu-toggle::after {
  transform: rotate(180deg);
}

/* Mobile Dropdown Content */
.mobile-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-item.open .mobile-dropdown {
  max-height: 600px;
}

.mobile-dropdown a {
  display: block;
  padding: 1rem 1.2rem 1rem 2.5rem;
  margin: 0;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9) !important;
  border: none;
  text-align: left;
  font-weight: 400;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.mobile-dropdown a::before {
  content: '→';
  position: absolute;
  left: 1.5rem;
  opacity: 0;
  transition: all 0.3s ease;
}

.mobile-dropdown a:hover {
  padding-left: 3rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
}

.mobile-dropdown a:hover::before {
  opacity: 1;
  left: 1.8rem;
}

.mobile-dropdown a.active {
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
  border-left: 3px solid #ffffff;
  color: #fff !important;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 1200px) {
  .menu-dropdown {
    min-width: 200px;
  }
  
  .menu-dropdown a {
    font-size: 14px;
    padding: 10px 16px;
  }
}

@media (max-width: 1024px) {
  .menu-link {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .menu-item.has-dropdown > .menu-link::after {
    font-size: 8px;
    margin-left: 4px;
  }
}

@media (max-width: 1250px) {
  /* Desktop dropdown bị ẩn trên mobile - sử dụng mobile dropdown */
  .menu-dropdown {
    display: none;
  }
}