html {
  scroll-behavior: smooth;
}

/* Chừa khoảng cho header dính trên cùng, tránh bị che tiêu đề section */
[id] {
  scroll-margin-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}


/* Header Base */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.header-container {
  max-width: 80rem; /* 1280px */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .header-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .header-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Nav Wrapper */
.header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem; /* 64px */
}

@media (min-width: 1024px) {
  .header-nav {
    height: 5rem; /* 80px */
  }
}

/* Logo */
.logo-link {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 2.5rem; /* 40px */
  width: auto;
  color: transparent;
}

@media (min-width: 1024px) {
  .logo-img {
    height: 3rem; /* 48px */
  }
}

/* Nav Links Desktop */
.nav-links {
  display: none;
}



.dropdown-wrapper {
  position: relative;
}
/* Dropdown */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 20.5rem;
  padding-top: 0.75rem; /* cầu nối hover, tránh menu bị đóng khi rê chuột xuống */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s;
  z-index: 60;
}

.dropdown-wrapper:hover .dropdown-menu,
.dropdown-wrapper:focus-within .dropdown-menu,
.dropdown-wrapper.is-open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-panel {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 1rem;
  padding: 0.75rem;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background-color: #f9fafb;
}

.dropdown-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.625rem;
}

.dropdown-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.icon-smart {
  background: #f3e8ff;
  color: #9333ea;
}
.icon-erp {
  background: #eef0f4;
  color: #475569;
}
.icon-steam {
  background: #dbeafe;
  color: #2563eb;
}

.dropdown-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.dropdown-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.dropdown-desc {
  font-size: 0.75rem;
  color: #6b7280;
}

.dropdown-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 0.5rem 0.25rem;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
  text-decoration: none;
  border-radius: 0.5rem;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.dropdown-link svg {
  width: 0.875rem;
  height: 0.875rem;
}

.dropdown-link:hover {
  color: var(--primary-600, #16a34a);
  background-color: #f9fafb;
}

/* Xoay mũi tên khi mở */
.icon-chevron {
  transition: transform 0.2s ease;
}
.dropdown-wrapper:hover .icon-chevron,
.dropdown-wrapper.is-open .icon-chevron {
  transform: rotate(180deg);
}

/* Link "Sản phẩm" đổi sang màu xanh khi mở (như ảnh mẫu) */
.dropdown-wrapper:hover .dropdown-trigger,
.dropdown-wrapper.is-open .dropdown-trigger {
  color: var(--primary-600, #16a34a);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--primary-600);
}

/* Nav Actions Desktop */
.nav-actions {
  display: none;
}

/* ================ POLYLANG ================= */
.lang-dd {
  position: relative;
}

.lang-dd__btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font: 500 0.875rem var(--font-body);
  color: var(--gray-700);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.lang-dd__btn:hover {
  color: var(--primary-600);
  background: var(--gray-50);
}

.lang-dd__btn img,
.lang-dd__item img {
  width: 1.125rem;
  height: auto;
  border-radius: 2px;
  flex-shrink: 0;
}

.lang-dd__btn i {
  font-size: 1rem;
}

.lang-dd__text {
  display: none;
}
@media (min-width: 640px) {
  .lang-dd__text {
    display: inline;
  }
}

.lang-dd__menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 11rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s;
  z-index: 60;
}

.lang-dd:hover .lang-dd__menu,
.lang-dd:focus-within .lang-dd__menu,
.lang-dd.is-open .lang-dd__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dd__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition:
    background-color 0.2s,
    color 0.2s;
}

.lang-dd__item:hover {
  background: var(--gray-50);
}

.lang-dd__item.is-active {
  color: var(--primary-600);
  background: var(--primary-50);
  font-weight: 600;
}

.lang-dd__item i {
  margin-left: auto;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  background-color: var(--primary-500);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.25);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--primary-600);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: block;
}
@media (min-width: 1280px) {
  .mobile-menu-btn {
    display: none !important;
  }
}
.mobile-menu-btn:hover {
  background-color: var(--gray-100);
}


/* Icons */
.icon-chevron {
  width: 1rem;
  height: 1rem;
}

.icon-globe {
  width: 1rem;
  height: 1rem;
}

.icon-menu {
  width: 1.5rem;
  height: 1.5rem;
}



/* ================ MOBILE ================= */
.mobile-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 1rem var(--gutter) 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.mobile-panel.is-open {
  display: block;
}

@media (min-width: 1280px) {
  .mobile-panel {
    display: none !important;
  }
}
@media (min-width: 1280px) {
  .nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
  }
}

@media (min-width: 1280px) {
  .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
}

.mobile-link,
.mobile-sub-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.875rem 0.25rem;
  font: 500 1rem var(--font-body);
  color: var(--gray-700);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  cursor: pointer;
}
.mobile-product {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.25rem;
  text-decoration: none;
  border-bottom: 1px solid var(--gray-100);
}

.mobile-sub .mobile-link--small {
  font-size: 0.8125rem;
  color: var(--gray-500);
  justify-content: flex-start;
  gap: 0.5rem;
}

.mobile-link--small svg {
  width: 0.875rem;
  height: 0.875rem;
}

.mobile-sub {
  display: none;
  padding: 0.25rem 0 0.5rem 0.75rem;
}
.mobile-sub.is-open {
  display: block;
}
.mobile-sub .mobile-link {
  font-size: 0.9rem;
  color: var(--gray-500);
}

.mobile-sub-toggle .icon-chevron {
  transition: transform 0.2s;
}
.mobile-sub-toggle.is-open .icon-chevron {
  transform: rotate(180deg);
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}
.mobile-actions .btn-primary {
  width: 100%;
}

/* Menu ngôn ngữ trong panel: xổ tại chỗ thay vì nổi */
.mobile-actions .lang-dd__menu {
  position: static;
  display: none;
  opacity: 1;
  visibility: visible;
  transform: none;
  box-shadow: none;
}
.mobile-actions .lang-dd.is-open .lang-dd__menu {
  display: block;
}
.mobile-actions .lang-dd:hover .lang-dd__menu {
  display: none;
}
.mobile-actions .lang-dd.is-open:hover .lang-dd__menu {
  display: block;
}
