/* Language Switcher Styles */
.language-switcher {
  display: flex;
  align-items: center;
  margin-left: 20px;
  background: rgba(200, 200, 255, 0.15);
  border-radius: 20px;
  padding: 3px;
  position: relative;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.language-switcher::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: linear-gradient(135deg, #007bff, #0056b3);
  border-radius: 17px;
  /* transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); */
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
  z-index: 1;
}

.language-switcher.zh-active::before {
  transform: translateX(100%);
}

.lang-btn {
  background: transparent;
  border: none;
  /* color: rgba(255, 255, 255, 0.8); */
  /* padding: 8px 16px; */
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 84px;
  height: 32px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  border-radius: 17px;
  letter-spacing: 0.5px;
}

/* .lang-btn:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
} */

.lang-btn.active {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* .lang-btn.active:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
} */

.autoforge-mobile-menu .lang-btn.active {
  background-color: #007bff !important;
}

.autoforge-mobile-menu .language-switcher::before {
  content: "";
  width: 0;
}

/* Responsive design */
@media (max-width: 768px) {
  .language-switcher {
    margin-left: 10px;
    padding: 2px;
  }

  .lang-btn {
    padding: 6px 12px;
    font-size: 12px;
    width: 54px;
    height: 28px;
    font-weight: 500;
  }
}

/* Animation for language switch */
/* [data-zh][data-en] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-switching [data-zh][data-en] {
  opacity: 0.8;
  transform: translateY(2px);
} */

/* Add a subtle glow effect when active */
.language-switcher.zh-active::before,
.language-switcher:not(.zh-active)::before {
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Add focus states for accessibility */
.lang-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

.lang-btn:focus:not(:focus-visible) {
  box-shadow: none;
}

/* Improve button interaction feedback */
.lang-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Ensure navigation layout accommodates language switcher */
.autoforge-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  width: 100%;
}

.autoforge-nav-menu {
  display: flex;
  align-items: center;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  flex-wrap: nowrap;
  /* flex: 1; */
  /* margin-left: 10px; */
  max-width: calc(100% - 140px); /* Reserve space for language switcher */
  overflow: hidden;
  /* flex-direction: row-reverse; */
}

.autoforge-nav-item {
  flex-shrink: 1;
  font-size: 1.2rem;
  white-space: nowrap;
  min-width: 0; /* Allow items to shrink */
}

.autoforge-nav-link {
  display: block;
  padding: 8px 12px;
  font-size: 16px;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Language switcher fixed width */
.language-switcher {
  flex-shrink: 0;
  width: 120px;
  justify-content: flex-end;
}

@media (max-width: 992px) {
  .autoforge-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .autoforge-nav-menu {
    max-width: 100%;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .language-switcher {
    margin-left: 0;
    margin-top: 10px;
    order: -1;
    align-self: flex-end;
    width: auto;
  }
}

@media (max-width: 576px) {
  .autoforge-nav-menu {
    flex-direction: column;
    width: 100%;
  }

  .autoforge-nav-item {
    width: 100%;
    text-align: center;
    padding: 5px 0;
  }
}
