/**
 * Header Navigation Styles - Tongyu Technology Website
 * Matches actual HTML structure: .header > .container > .header-inner
 */

@import './variables.css';

/* ==========================================================================
   Header Container
   ========================================================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: var(--color-bg-header);
  box-shadow: var(--header-shadow);
  z-index: var(--header-z-index);
  transition: box-shadow var(--transition-base), background-color var(--transition-base);
}

.header.scrolled {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.header .container {
  height: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* ==========================================================================
   Logo
   ========================================================================== */

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  height: var(--logo-height);
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.logo:hover {
  opacity: 0.85;
}

.logo img {
  height: var(--logo-height);
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

/* ==========================================================================
   Main Navigation — uses .nav > .nav-list > li > a
   ========================================================================== */

.nav {
  display: flex;
  align-items: center;
  height: 100%;
  flex: 1;
  justify-content: center;
}

.nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  gap: 0;
}

.nav-list li {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-list li a {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  font-size: var(--nav-font-size);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
  height: 100%;
  white-space: nowrap;
}

.nav-list li a:hover,
.nav-list li a:focus {
  color: var(--color-primary);
  text-decoration: none;
}

.nav-list li a.active {
  color: var(--color-primary);
}

/* ==========================================================================
   Header Actions (search + language)
   ========================================================================== */

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
  border-radius: var(--radius-full);
  padding: 0;
}

.search-btn:hover,
.search-btn:focus {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.search-btn svg {
  width: 20px;
  height: 20px;
}

/* Language Switch */
.language-switch {
  position: relative;
}

.current-lang {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  border: 1px solid var(--color-gray-border);
  border-radius: var(--radius-base);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.current-lang:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {
  .section-header-wrap-block {
    overflow-x: visible !important;
  }

  .section-header-wrap-block .logo img {
    max-width: 180px !important;
    width: 180px !important;
    height: auto !important;
  }

  .nav {
    display: none;
  }

  .nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height, 64px);
    left: 0;
    width: 100%;
    height: auto;
    max-height: calc(100vh - var(--header-height, 64px));
    background-color: #fff;
    z-index: 998;
    overflow-y: auto;
    padding: 1rem 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  }

  .nav.mobile-open .nav-list {
    flex-direction: column !important;
    align-items: flex-start;
    width: 100%;
    height: auto;
    gap: 0;
  }

  .nav.mobile-open .nav-list li {
    width: 100%;
    height: auto;
    border-bottom: 1px solid #eee;
  }

  .nav.mobile-open .nav-list li a {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
  }

  .nav.mobile-open .dropdown,
  .nav.mobile-open .mega-dropdown {
    position: static;
    display: none;
    width: 100%;
    box-shadow: none;
    padding: 0 0 0 1.5rem;
  }

  .nav.mobile-open .dropdown.show,
  .nav.mobile-open .mega-dropdown.show {
    display: block;
  }

  .header-actions .search-btn,
  .header-actions .language-switch {
    display: none;
  }
}

@media (max-width: 575px) {
  .header {
    height: var(--header-height-mobile);
  }

  .logo img {
    height: 48px;
  }
}
