/* 导航样式 */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: all 0.4s ease;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  overflow: visible;
}

/* 导航栏背景装饰效果 */
.main-header::before {
  content: '';
  position: absolute;
  top: -50px;
  left: 15%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(244, 130, 31, 0.05) 0%, rgba(244, 130, 31, 0) 70%);
  border-radius: 50%;
  z-index: -1;
  animation: floatCircle 15s infinite ease-in-out;
}

.main-header::after {
  content: '';
  position: absolute;
  bottom: -70px;
  right: 10%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(66, 133, 244, 0.05) 0%, rgba(66, 133, 244, 0) 70%);
  border-radius: 50%;
  z-index: -1;
  animation: floatCircle 18s infinite ease-in-out reverse;
}

.main-header .decoration-dots {
  position: absolute;
  top: 15px;
  right: 12%;
  width: 100px;
  height: 50px;
  background-image: radial-gradient(circle, rgba(244, 130, 31, 0.2) 1px, transparent 1px);
  background-size: 10px 10px;
  z-index: -1;
  opacity: 0.3;
  animation: fadeInOut 8s infinite alternate;
}

.main-header .decoration-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, 
    rgba(244, 130, 31, 0) 0%, 
    rgba(244, 130, 31, 0.2) 25%, 
    rgba(66, 133, 244, 0.2) 50%, 
    rgba(244, 130, 31, 0.2) 75%, 
    rgba(244, 130, 31, 0) 100%);
  z-index: 0;
}

/* 添加动画效果 */
@keyframes floatCircle {
  0% {
    transform: translateY(0) translateX(0);
  }
  25% {
    transform: translateY(-8px) translateX(8px);
  }
  50% {
    transform: translateY(4px) translateX(-4px);
  }
  75% {
    transform: translateY(-4px) translateX(-8px);
  }
  100% {
    transform: translateY(0) translateX(0);
  }
}

@keyframes fadeInOut {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 0.2;
  }
}

.main-header.scrolled {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  background-color: rgba(255, 255, 255, 0.95);
}

.main-header.scrolled .main-nav {
  height: 70px;
}

.main-nav {
  transition: all var(--transition-speed) ease;
  height: 80px;
  position: relative;
  z-index: 10;
}

.scrolled .main-nav {
  border-bottom: 1px solid rgba(230, 230, 230, 0.5);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  transition: all 0.3s ease;
  position: relative;
  z-index: 20;
}

.nav-container.scrolled {
  padding: 0 1.5rem;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
}

.logo a {
  color: var(--primary-color);
  text-decoration: none;
}

.logo-image {
  max-height: 55px;
  width: auto;
  display: block;
  transition: all 0.3s ease;
}

.scrolled .logo-image {
  max-height: 45px;
}

.nav-links {
  display: flex;
  align-items: center;
}

.primary-menu {
  display: flex;
  gap: 2.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-menu li {
  position: relative;
}

/* 基础字体设置 */
.primary-menu a {
  color: var(--text-color);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-speed) ease;
  font-size: 1rem;
  position: relative;
  padding: 0.5rem 0;
  letter-spacing: 0.02em;
  font-family: sans-serif; /* 默认无衬线字体 */
}

/* macOS系统字体 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  .primary-menu a {
    font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", sans-serif;
  }
}

/* Windows系统字体 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .primary-menu a {
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
  }
}

/* Android系统字体 */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
  .primary-menu a {
    font-family: "Roboto", "Noto Sans SC", "Droid Sans Fallback", sans-serif;
  }
}

.primary-menu a:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--accent-color);
  transition: width 0.3s ease;
}

.primary-menu a:hover:after,
.primary-menu a.active:after {
  width: 100%;
}

.primary-menu a:hover, 
.primary-menu a.active {
  color: var(--accent-color);
}

.has-submenu {
  position: relative;
}

.has-submenu > a {
  padding-right: 16px;
}

.has-submenu > a:before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  margin-top: -2px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-color);
  transition: transform 0.3s ease, border-top-color 0.3s ease;
}

.has-submenu:hover > a:before {
  border-top-color: var(--accent-color);
  transform: rotate(-180deg);
}

.has-submenu:hover .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.submenu {
  position: absolute;
  top: calc(100% + 15px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 220px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  padding: 1.2rem;
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  border: 1px solid rgba(230, 230, 230, 0.8);
}

.submenu:before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  margin-left: -8px;
  width: 16px;
  height: 16px;
  background: white;
  transform: rotate(45deg);
  border-top: 1px solid rgba(230, 230, 230, 0.8);
  border-left: 1px solid rgba(230, 230, 230, 0.8);
  z-index: -1;
}

.submenu li {
  margin-bottom: 0.5rem;
  text-align: left;
}

.submenu li:last-child {
  margin-bottom: 0;
}

.submenu a {
  display: block;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  transition: all var(--transition-speed) ease;
  color: var(--text-color);
  font-weight: 500;
  border-radius: 4px;
  text-align: left;
}

.submenu a:after {
  display: none;
}

.submenu a:hover {
  color: var(--accent-color);
  background-color: rgba(244, 130, 31, 0.15);
  transform: none;
  padding-left: 1.2rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.language-switch {
  position: relative;
  margin-right: 20px;
}

.language-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(245, 247, 250, 0.8);
  border: 1px solid rgba(230, 230, 230, 0.7);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.language-trigger:hover {
  background: rgba(244, 130, 31, 0.08);
  transform: translateY(-2px);
}

.language-trigger .language-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  padding: 10px;
  min-width: 130px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  border: 1px solid rgba(230, 230, 230, 0.8);
}

.language-switch:hover .language-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(5px);
}

.language-option {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 6px;
  margin-bottom: 5px;
}

.language-option:last-child {
  margin-bottom: 0;
}

.language-option:hover {
  background: rgba(244, 130, 31, 0.08);
}

.language-option .language-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  margin-right: 8px;
}

.language-option .language-text {
  font-size: 14px;
}

.mobile-menu-toggle {
  display: none;
  width: 32px;
  height: 22px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  z-index: 1050;
}

.mobile-menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* 响应式导航 */
@media (max-width: 992px) {
  .logo-image {
    max-height: 50px;
  }
  
  .scrolled .logo-image {
    max-height: 40px;
  }

  .primary-menu {
    gap: 1.5rem;
  }
  
  .nav-right {
    gap: 1.5rem;
  }

  .main-header.scrolled .main-nav {
    height: 65px;
  }
  
  body {
    padding-top: 65px;
  }

  .main-nav {
    height: auto;
  }
}

@media (max-width: 768px) {
  /* 基本移动端样式 */
  .mobile-menu-toggle {
    display: flex;
  }
  
  .logo-image {
    max-height: 45px;
  }
  
  .scrolled .logo-image {
    max-height: 38px;
  }
  
  .nav-container {
    padding: 0 1.5rem;
  }
  
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
    padding: 100px 40px 40px;
    transition: right 0.4s ease-in-out;
    overflow-y: auto;
    z-index: 1000;
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .primary-menu {
    flex-direction: column;
    gap: 0;
    display: block;
    width: 100%;
  }
  
  .primary-menu li {
    margin-bottom: 5px;
    width: 100%;
    display: block;
  }
  
  .primary-menu a {
    display: block;
    padding: 12px 0;
    font-size: 16px;
    border-bottom: 1px solid rgba(230, 230, 230, 0.5);
    width: 100%;
  }
  
  .primary-menu a:after {
    display: none;
  }
  
  /* 子菜单样式 - 重置为简单结构 */
  .has-submenu > a:before {
    right: 5px;
    top: 20px;
  }
  
  .has-submenu.active > a:before {
    transform: rotate(-180deg);
    border-top-color: var(--accent-color);
  }
  
  /* 子菜单基本样式 */
  .submenu {
    display: none !important;
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    background-color: #f5f5f5 !important;
    margin: 8px 0 !important;
    padding: 8px !important;
    border-radius: 8px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    transition: none !important;
    border: none !important;
  }
  
  /* 激活状态样式 */
  .has-submenu.active > .submenu {
    display: block !important;
  }
  
  /* 子菜单链接样式 */
  .submenu li {
    display: block !important;
    width: 100% !important;
    margin-bottom: 5px !important;
  }
  
  .submenu a {
    display: block !important;
    width: 100% !important;
    padding: 10px !important;
    font-size: 14px !important;
    color: #333 !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    border-bottom: 1px solid #eee !important;
  }
  
  .has-submenu > a:before {
    content: '' !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
    border-top: 5px solid #333 !important;
    position: absolute !important;
    right: 5px !important;
    top: 20px !important;
    transition: transform 0.3s !important;
  }
  
  .has-submenu.active > a:before {
    transform: rotate(-180deg) !important;
    border-top-color: var(--accent-color) !important;
  }
  
  .language-switch {
    margin-right: 10px;
  }
  
  .language-trigger {
    width: 36px;
    height: 36px;
  }
  
  .language-trigger .language-icon {
    width: 20px;
    height: 20px;
  }
  
  /* 移动端强制样式 - 确保可点击 */
  .primary-menu {
    pointer-events: auto !important;
  }
  
  .has-submenu > a {
    pointer-events: auto !important;
    cursor: pointer !important;
  }
  
  .submenu {
    pointer-events: auto !important;
  }
  
  .submenu li {
    pointer-events: auto !important;
  }
  
  .submenu a {
    pointer-events: auto !important;
    cursor: pointer !important;
  }
  
  /* 去除所有动画效果 */
  .has-submenu * {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 576px) {
  .logo-image {
    max-height: 40px;
  }
  
  .scrolled .logo-image {
    max-height: 35px;
  }
  
  .main-nav {
    padding: 1rem 0;
  }
  
  .main-header.scrolled .main-nav {
    padding: 0.7rem 0;
  }
}

/* 添加body的padding-top以适应固定导航栏 */
body {
  padding-top: 80px;
}
