/* 导航栏语言选择器样式 - 从 hxs 项目迁移 */

/* 语言选择器容器 */
.language-selector {
  position: relative;
  display: flex;
  align-items: center;
}

/* 语言选择按钮 - 适配顶部信息栏样式 */
.language-button {
  background-color: rgba(255, 255, 255, 0.9); /* 更不透明的白色背景 */
  color: #333333; /* 改为黑色文字 */
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 20px 4px 8px;
  font-family: 'Arial', sans-serif;
  font-size: 11px;
  font-weight: 400;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
  min-width: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
}

/* 顶部信息栏中的语言按钮悬停效果 */
.top-bar .language-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.language-button:hover {
  background-color: #1e40af;
}

/* 下拉箭头 */
.dropdown-arrow {
  margin-left: 8px;
  color: #333333; /* 改为黑色箭头 */
  width: 12px;
  height: 12px;
  transition: transform 0.3s ease;
}

.language-button.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* 语言弹框 - 适配顶部信息栏位置 */
.language-popup {
  position: absolute;
  top: 100%;
  right: 11.5%; /* 往左移动弹框位置 */
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 99999; /* 提高z-index确保在顶部信息栏上方显示 */
  width: 480px; /* 调整宽度适配多列布局 */
  max-width: 95vw; /* 在小屏幕上限制最大宽度 */
  margin-top: 8px;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

/* 顶部信息栏中的语言弹框特殊样式 */
.top-bar .language-popup {
  margin-top: 80px; /* 增加与顶部栏的间距 */
}

.language-popup.show {
  display: block;
}

.language-popup.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* 语言选项网格布局 */
.language-items {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4列布局 */
  gap: 8px;
  max-height: 400px; /* 限制高度，支持滚动 */
  overflow-y: auto; /* 如果内容过多，允许滚动 */
}

/* 单个语言选项 */
.lang-item {
  display: flex;
  flex-direction: column; /* 垂直布局，图标在上，文字在下 */
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  color: #333333; /* 改为更纯的黑色 */
  text-decoration: none;
  font-family: 'Arial', sans-serif;
  font-size: 12px;
  font-weight: 400;
  transition: background-color 0.2s ease;
  gap: 6px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  min-height: 60px; /* 增加高度，适配布局 */
  word-break: break-word; /* 允许长单词换行 */
}

.lang-item:hover {
  background-color: #f3f4f6;
  color: #1e3a8a;
}

/* 语言选项中的国旗图标 */
.lang-item img {
  width: 16px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0; /* 防止图片被压缩 */
}

/* 移动端语言选择 - 下拉框形式 */
.mobile-language {
  padding: 20px;
  background-color: #ffffff;
  border-top: 1px solid #e5e7eb;
  margin-top: 20px;
  position: relative;
  z-index: 3;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 120px;
  width: 100%;
}

.mobile-language h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  font-family: 'Arial', sans-serif;
}

/* 移动端语言下拉框容器 */
.mobile-language-dropdown {
  position: relative;
  width: 100%;
}

/* 移动端语言按钮 */
.mobile-language-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Arial', sans-serif;
  font-size: 14px;
  color: #374151;
}

.mobile-language-button:hover {
  border-color: #f97316;
  background-color: #fef3f2;
}

.mobile-language-button:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* 当前语言显示 */
.current-language {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid #e5e7eb;
}

.current-text {
  font-weight: 500;
}

/* 移动端下拉箭头 */
.mobile-language-button .dropdown-arrow {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: #6b7280;
}

.mobile-language-button.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* 移动端语言选项列表 */
.mobile-language-items {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.mobile-language-items.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* 移动端单个语言选项 */
.mobile-lang-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  gap: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.mobile-lang-item:last-child {
  border-bottom: none;
}

.mobile-lang-item:hover {
  background-color: #f3f4f6;
  color: #1e3a8a;
}

.mobile-lang-item img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .language-button {
    padding: 6px 20px 6px 8px;
    font-size: 11px;
    min-width: 60px;
  }
  
  .language-popup {
    width: 90vw;
    max-width: 90vw;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  
  .language-items {
    grid-template-columns: repeat(3, 1fr);
    padding: 12px;
    gap: 6px;
    max-height: 250px;
  }
  
  .lang-item {
    font-size: 10px;
    padding: 8px 4px;
    gap: 4px;
    min-height: 50px;
  }
}

@media (max-width: 480px) {
  .language-button {
    padding: 5px 15px 5px 6px;
    font-size: 10px;
    min-width: 50px;
  }
  
  .language-items {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  
  .lang-item {
    font-size: 9px;
    padding: 6px 2px;
    gap: 3px;
    min-height: 45px;
  }
  
  .lang-item img {
    width: 14px;
    height: 10px;
  }
}

/* 确保语言选择器在移动端正确显示 */
@media (max-width: 768px) {
  /* 桌面端语言选择器在移动端隐藏 */
  .nav-right .language-selector {
    display: none !important;
  }
  
  /* 移动端语言选择器显示 */
  .mobile-language-selector {
    display: block !important;
  }
}

/* 桌面端隐藏移动端语言选择器 */
@media (min-width: 769px) {
  .mobile-language-selector,
  .mobile-language {
    display: none !important;
  }
}
