/* ================================================================
   SUANOVA New Design - Header Styles
   ================================================================ */

/* Header */
.header {
  background: var(--navy);
  height: 70px;
  display: flex;
  align-items: center;
  padding: 0 75px;
  position: relative;
  z-index: 100;
}

.header-inner {
  width: 100%;
  max-width: 1770px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 100%;
}

.header-left {
  display: flex;
  flex: 1;
  align-items: stretch;
  gap: 16px;
  height: 100%;
}

.logo {
  width: 180px;
  min-width: 180px;
  height: 35px;
  align-self: center;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  flex: 1;
  align-items: stretch;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

.nav-item-wrapper {
  display: flex;
  align-items: stretch;
}

.nav-item,
.header .nav-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}

/* Override legacy span { font-size: 12px } from style.css */
.nav-item span,
.nav-item .nav-item-text {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.nav-item:hover,
.header .nav-item:hover {
  opacity: 0.8;
}

.nav-item img {
  width: 24px;
  height: 24px;
}

/* ================================================================
   Desktop hover behavior (>= 1101px)
   - Hover a nav item: background fills with #083a73 (design token)
   - Hover an item with a dropdown: menu expands, arrow rotates up
   - Hover is detected on the wrapper so the gap between the trigger
     and the dropdown stays inside the hover area (no flicker).
   ================================================================ */
@media (min-width: 1101px) {
  /* Hover fill color on the nav item itself */
  .nav-item-wrapper:hover > .nav-item,
  .header .nav-item-wrapper:hover > .nav-item {
    background: #083a73;
    opacity: 1;
  }

  /* Expand the dropdown on hover */
  .nav-item-wrapper:hover > .nav-item .nav-dropdown,
  .header .nav-item-wrapper:hover > .nav-item .nav-dropdown {
    display: block;
  }

  /* Rotate the arrow up while the dropdown is open on hover */
  .nav-item-wrapper:hover > .nav-item .dropdown-arrow,
  .header .nav-item-wrapper:hover > .nav-item .dropdown-arrow {
    transform: rotate(180deg);
  }
}

/* Dropdown menu */
.nav-item .dropdown-arrow,
.header .nav-item .dropdown-arrow {
  transition: transform 0.2s ease;
}

.nav-item.open .dropdown-arrow,
.header .nav-item.open .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown,
.header .nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  min-width: 140px;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 8px 0;
  z-index: 200;
  list-style: none;
  margin: 0;
}

.nav-item.open .nav-dropdown,
.header .nav-item.open .nav-dropdown {
  display: block;
}

.nav-dropdown a,
.header .nav-dropdown a {
  display: block;
  padding: 10px 20px;
  color: var(--dark-text);
  font-size: 14px;
  font-weight: 400;
  transition: background 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.nav-dropdown a:hover,
.header .nav-dropdown a:hover {
  background: var(--border-light);
  color: var(--navy);
}

/* Push right-side nav items to the right */
.nav-spacer {
  margin-left: auto;
}

/* Nested submenu group (third level - collapsible) */
.nav-submenu-group {
  position: relative;
}

.nav-submenu-title {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.nav-submenu-title:hover {
  background: var(--border-light);
}

.nav-submenu-title .submenu-arrow {
  position: relative;
  padding-right: 18px;
}

.nav-submenu-title .submenu-arrow::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--navy);
  border-bottom: 2px solid var(--navy);
  transform: translateY(-65%) rotate(-45deg);
  transition: transform 0.2s ease;
}

.nav-submenu-group.open .nav-submenu-title .submenu-arrow::after {
  transform: translateY(-35%) rotate(45deg);
}

.nav-submenu-list {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 140px;
  background: var(--white);
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 8px 0;
  margin: 0;
  list-style: none;
}

.nav-submenu-group.open .nav-submenu-list {
  display: block;
}

.nav-submenu-list a {
  display: block;
  padding: 10px 20px;
  color: var(--dark-text);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.2s;
}

.nav-submenu-list a:hover {
  background: var(--border-light);
  color: var(--navy);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--white);
  align-self: center;
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  margin: 5px 0;
  transition: all 0.3s;
}

/* Responsive */
@media (max-width: 1100px) {
  .header {
    padding: 10px 20px;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 16px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    height: auto;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    z-index: 101;
  }

  .main-nav.show {
    display: flex;
  }

  .nav-item-wrapper {
    width: 100%;
  }

  /* Plain nav links (no dropdown) */
  .nav-item:not(.has-dropdown),
  .header .nav-item:not(.has-dropdown) {
    padding: 12px 20px;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 16px;
  }

  /* Accordion-style dropdown parent */
  .nav-item.has-dropdown,
  .header .nav-item.has-dropdown {
    padding: 0;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0;
  }

  .nav-item.has-dropdown.open,
  .header .nav-item.has-dropdown.open {
    border-bottom: 2px solid #8b5cf6;
  }

  .nav-item.has-dropdown > span,
  .header .nav-item.has-dropdown > span {
    padding: 12px 20px;
    flex: 1;
  }

  .nav-item.has-dropdown > .dropdown-arrow,
  .header .nav-item.has-dropdown > .dropdown-arrow {
    padding: 12px 20px;
  }

  .nav-item.has-dropdown > .nav-dropdown,
  .header .nav-item.has-dropdown > .nav-dropdown {
    width: 100%;
  }

  /* Dropdown content */
  .nav-dropdown,
  .header .nav-dropdown {
    position: static;
    box-shadow: none;
    border-radius: 0;
    background: rgba(0,0,0,0.15);
  }

  .nav-dropdown a,
  .header .nav-dropdown a {
    color: var(--white);
    padding: 12px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .nav-dropdown a:last-child,
  .header .nav-dropdown a:last-child {
    border-bottom: none;
  }

  .nav-dropdown a:hover,
  .header .nav-dropdown a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
  }

  .nav-submenu-title {
    color: var(--white);
  }

  .nav-submenu-title:hover {
    background: rgba(255,255,255,0.1);
  }

  .nav-submenu-list {
    position: static;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }

  .nav-submenu-list a {
    padding-left: 44px;
  }

}
