/* 翻译语言选择框美化 */
.translate-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.translate-wrapper::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'%3E%3C/path%3E%3Cpath d='M2 12h20'%3E%3C/path%3E%3C/svg%3E");
  background-size: 16px 16px;
  background-repeat: no-repeat;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1;
}

.translate-wrapper:hover::before {
  filter: brightness(0) saturate(100%) invert(64%) sepia(86%) saturate(1500%) hue-rotate(184deg) brightness(101%) contrast(102%);
}

#translate {
  display: flex;
  align-items: center;
}

#translateSelectLanguage {
  appearance: none;
  width: 130px;
  padding: 8px 12px;
  padding-left: 36px;
  padding-right: 32px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #ffffff;
  color: #333333;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

#translateSelectLanguage:hover {
  border-color: #36b5ff;
  box-shadow: 0 0 0 2px rgba(54, 181, 255, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2336b5ff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

#translateSelectLanguage:focus {
  outline: none;
  border-color: #36b5ff;
  box-shadow: 0 0 0 3px rgba(54, 181, 255, 0.2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2336b5ff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

#translateSelectLanguage option {
  padding: 8px 12px;
  background-color: #ffffff;
  color: #333333;
  font-size: 14px;
}

#translateSelectLanguage option:checked {
  background-color: #36b5ff;
  color: white;
}

/* 手机端地球按钮 */
.translate-btn-mobile {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #666666;
  padding: 6px 4px;
  border-radius: 6px;
  transition: all 0.3s ease;
  line-height: 1;
}

.translate-btn-mobile:hover {
  color: #36b5ff;
  background-color: rgba(54, 181, 255, 0.1);
}

.translate-btn-mobile:active {
  color: #0099e6;
}

/* 手机端菜单容器 */
.translate-menu-mobile {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.translate-menu-mobile.active {
  display: flex;
  align-items: flex-end;
}

.translate-menu-mobile-content {
  width: 100%;
  background-color: white;
  border-radius: 12px 12px 0 0;
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.translate-menu-mobile-title {
  font-size: 16px;
  font-weight: 600;
  color: #333333;
  margin-bottom: 12px;
  text-align: center;
}

.translate-menu-mobile-close {
  display: flex;
  justify-content: center;
  padding-top: 8px;
  border-top: 1px solid #e0e0e0;
  margin-top: 12px;
}

.translate-menu-mobile-close button {
  background-color: #f5f5f5;
  border: none;
  border-radius: 6px;
  padding: 8px 24px;
  color: #666666;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.translate-menu-mobile-close button:active {
  background-color: #e0e0e0;
}

.translate-menu-mobile-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.translate-menu-mobile-option {
  padding: 12px 8px;
  text-align: center;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  color: #333333;
  transition: all 0.2s ease;
}

.translate-menu-mobile-option:active {
  background-color: #36b5ff;
  color: white;
  border-color: #36b5ff;
}

.translate-menu-mobile-option.selected {
  background-color: #36b5ff;
  color: white;
  border-color: #36b5ff;
}

/* 平板端 */
@media (max-width: 1024px) {
  #translateSelectLanguage {
    width: 115px;
    font-size: 13px;
    padding: 6px 10px;
    padding-left: 32px;
    padding-right: 26px;
  }

  .translate-wrapper::before {
    width: 14px;
    height: 14px;
    left: 10px;
  }
}

/* 手机端 */
@media (max-width: 768px) {
  .translate-wrapper::before {
    display: none;
  }

  .translate-select-desktop {
    display: none !important;
  }

  .translate-btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .translate-btn-mobile svg {
    width: 18px;
    height: 18px;
  }
}
