/* =====================
   变量定义
===================== */
:root {
  --primary-color: #6a44f2; /* 主色：紫色 */
  --accent-color: #6a44f2; /* 主色：紫色 */
  --text-color: #222;
  --bg-color: #fff;
  --header-height: 70px;
  --transition: all 0.3s;
  --shadow: 0 5px 15px rgba(0,0,0,0.08);
  --container-width: 1200px;
}

/* =====================
   PC端导航栏基础样式
===================== */
.main-header {
  position: fixed;
  top: 0; left: 0; width: 100%;
  z-index: 1000;
  background: rgba(255,255,255,0.95);
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.main-header .main-nav {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.logo img {
  height: 48px;
  display: block;
}
.nav-links {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.primary-menu {
  display: flex;
  gap: 2.2rem;
  list-style: none;
}
.primary-menu li {
  position: relative;
}
.primary-menu > li > a {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.5rem 0;
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}
.primary-menu > li > a:hover,
.primary-menu > li > a.active {
  color: var(--secondary-color);
}
/* 主菜单右侧小箭头（PC端） */
.primary-menu > .has-submenu > a {
  position: relative;
  padding-right: 18px;
}
.primary-menu > .has-submenu > a::after {
  content: '';
  position: absolute;
  right: 2px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border: solid var(--primary-color); /* 默认箭头颜色为紫色 */
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 2px;
  transform: rotate(45deg);
  background: none;
  transition: border-color 0.2s;
}
.primary-menu > .has-submenu > a:hover::after,
.primary-menu > .has-submenu > a.active::after {
  border-color: var(--secondary-color); /* 悬停和激活状态箭头颜色为橙色 */
}
/* 只展开当前悬浮的子菜单 */
.primary-menu > .has-submenu > .submenu {
  display: none;
}
.primary-menu > .has-submenu:hover > .submenu {
  display: block;
}
/* 下拉菜单 */
.has-submenu > a::after {
  content: '\25BC';
  font-size: 0.7em;
  margin-left: 6px;
  transition: transform 0.3s;
}
.has-submenu:hover > a::after {
  transform: rotate(180deg);
}
.submenu {
  position: absolute;
  left: 50%;
/*  top: calc(100% + 12px);*/
  transform: translateX(-50%);
  min-width: 180px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 0.8rem 0;
  z-index: 1001;
  border: 1px solid #eee;
  transition: box-shadow 0.2s;
}
/*.submenu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 12px;
  background: transparent;
  z-index: 2;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 12px solid #fff;
}*/
.has-submenu:hover > .submenu {
  display: block;
}
.submenu li {
  text-align: left;
}
.submenu a {
  color: var(--primary-color); /* 默认文字颜色为紫色 */
  background: #fff;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
  display: block;
}
.submenu a:hover {
  background: rgba(244, 130, 31, 0.08); /* 橙色背景，低透明度 */
  color: var(--secondary-color); /* 悬停文字颜色为橙色 */
}

/* 右侧功能区 */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.language-switch {
  position: relative;
}
.language-trigger {
  background: #f5f7fa;
  border: 1px solid #eee;
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.language-icon {
  width: 22px; height: 22px;
}
.language-dropdown {
  display: none;
  position: absolute;
  /*top: 110%;*/ right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  padding: 10px;
  min-width: 120px;
  z-index: 1002;
}
.language-switch:hover .language-dropdown {
  display: block;
}
.language-option {
  display: flex; align-items: center;
  padding: 8px 10px;
  color: #333;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
}
.language-option:hover {
  background: #f5f7fa;
}
.language-option .language-icon {
  width: 18px; height: 18px; margin-right: 6px;
}

/* 汉堡按钮（移动端显示） */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 32px; height: 24px;
  cursor: pointer;
  z-index: 1100;
}
.mobile-menu-toggle span {
  display: block;
  width: 100%; height: 3px;
  background: var(--text-color);
  border-radius: 2px;
  transition: var(--transition);
}
.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

/* =====================
   移动端样式
===================== */
@media (max-width: 992px) {
  .nav-container {
    padding: 0 10px;
  }
}
@media (max-width: 768px) {
  .main-header .main-nav {
    height: 56px;
  }
  .logo img {
    height: 38px;
  }
  .nav-links {
    position: fixed;
    top: 0; right: -100vw;
    width: 80vw; max-width: 320px;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 15px rgba(0,0,0,0.10);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 70px 0 0 0;
    transition: right 0.3s;
    z-index: 1050;
    overflow-y: auto;
    display: flex;
  }
  .nav-links.active {
    right: 0;
  }
  .primary-menu {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }
  .primary-menu > li {
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #f2f2f2;
  }
  .primary-menu > li > a {
    display: block;
    padding: 14px 24px;
    font-size: 1.08rem;
    border-radius: 0;
    color: var(--primary-color);
  }
  .primary-menu > li > a:hover,
  .primary-menu > li > a.active {
    color: var(--secondary-color);
  }
  
  /* 隐藏箭头 */
  .has-submenu > a::after,
  .primary-menu > .has-submenu > a::after {
    display: none;
  }
  
  /* 子菜单基本样式 - 完全重写 */
  .submenu {
    display: none;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
    background: #f8f9fa;
  }
  
  /* 当父菜单激活时显示子菜单 */
  .has-submenu.active > .submenu {
    display: block;
  }
  
  /* 子菜单项样式 */
  .submenu li {
    display: block;
    width: 100%;
    border-bottom: 1px solid #eee;
  }
  
  .submenu li:last-child {
    border-bottom: none;
  }
  
  /* 子菜单链接样式 - 确保文字可见 */
  .submenu li a {
    display: block;
    width: 100%;
    padding: 12px 40px;
    font-size: 1rem;
    color: #333333 !important; /* 强制使用深色文字 */
    background-color: #f8f9fa;
    text-decoration: none;
    position: relative;
    z-index: 1;
  }
  
  /* 子菜单链接悬停样式 */
  .submenu li a:hover {
    color: var(--secondary-color) !important;
    background-color: rgba(244, 130, 31, 0.08);
  }
  
  /* 确保子菜单在正确的位置 */
  .primary-menu > li > .submenu {
    position: static;
    box-shadow: none;
    border-radius: 0;
    min-width: 0;
    top: auto;
    left: auto;
    transform: none;
  }
  
  /* 移除子菜单的三角形 */
  .submenu::before {
    display: none;
  }
  
  .nav-right {
    margin-left: 0;
  }
  .mobile-menu-toggle {
    display: flex;
  }
}

/* 适配最小屏幕 */
@media (max-width: 480px) {
  .nav-links {
    width: 100vw;
    max-width: 100vw;
  }
  .primary-menu > li > a {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* 小屏幕子菜单样式 */
  .submenu li a {
    padding-left: 32px;
    padding-right: 16px;
    color: #333333 !important;
  }
}

/* 适配body顶部间距 */
body {
  padding-top: var(--header-height);
}

/* 移除原有主菜单::after的下划线动画 */
.primary-menu > li > a::after {
  content: none;
}
