/* Language switcher: burger-menu-style dropdown, pinned to the right side of the header. */

.lang-switcher {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  z-index: 1004;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.lang-toggle:hover {
  border-color: #a442b8;
}

.lang-switcher.open .lang-toggle {
  border-color: #a442b8;
  background: rgba(164, 66, 184, 0.18);
}

.lang-flag {
  font-size: 16px;
  line-height: 1;
}

.lang-code {
  min-width: 18px;
}

.lang-caret {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.7);
  transition: transform 0.25s ease;
}

.lang-switcher.open .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.lang-switcher.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu li {
  list-style: none;
}

.lang-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s ease;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lang-btn.active {
  background: #a442b8;
}

.lang-btn .lang-flag {
  font-size: 18px;
}

/* Standalone placement for pages without a standard header (e.g. error.html, /guid/*.html) */
.lang-switcher-standalone {
  position: fixed;
  top: 16px;
  right: 16px;
  transform: none;
}

@media (max-width: 480px) {
  .lang-switcher {
    right: 10px;
  }

  .lang-switcher-standalone {
    top: 10px;
    right: 10px;
  }

  .lang-toggle {
    padding: 6px 8px;
    font-size: 12px;
  }

  .lang-toggle .lang-code {
    display: none;
  }

  .lang-menu {
    min-width: 160px;
  }
}
