/* Language switcher UI */
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0 8px;
  font-family: inherit;
  z-index: 1001;
}

.lang-switch__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: inherit;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  transition: background .2s, border-color .2s;
}
.lang-switch__toggle:hover,
.lang-switch__toggle[aria-expanded="true"] {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.4);
}
.lang-switch__icon { flex-shrink: 0; }
.lang-switch__current { letter-spacing: 0.5px; }

/* Light-theme variant (for privacy/terms/etc pages with white header) */
header.is-glass ~ * .lang-switch__toggle,
header:not(.is-glass) .lang-switch__toggle {
  border-color: rgba(28,42,74,0.25);
  background: rgba(28,42,74,0.06);
  color: #1c2a4a;
}
header:not(.is-glass) .lang-switch__toggle:hover,
header:not(.is-glass) .lang-switch__toggle[aria-expanded="true"] {
  background: rgba(28,42,74,0.12);
  border-color: rgba(28,42,74,0.4);
}

.lang-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 170px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  color: #1c2a4a;
  border: 1px solid #e9eef5;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(28, 42, 74, 0.18);
  overflow: hidden;
}
.lang-switch__menu[hidden] { display: none; }
.lang-switch__menu li { margin: 0; padding: 0; }

.lang-switch__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  transition: background .15s;
}
.lang-switch__option:hover { background: rgba(108, 74, 182, 0.08); }
.lang-switch__option.is-active {
  background: rgba(108, 74, 182, 0.14);
  font-weight: 700;
}
.lang-switch__flag { font-size: 16px; line-height: 1; }
.lang-switch__label { flex: 1; }
.lang-switch__short {
  font-size: 11px;
  opacity: 0.65;
  letter-spacing: 0.5px;
}

/* RTL/LTR aware placement: menu flips from right to left based on document dir */
html[dir="ltr"] .lang-switch__menu { inset-inline-end: 0; inset-inline-start: auto; }
html[dir="rtl"] .lang-switch__menu { inset-inline-start: 0; inset-inline-end: auto; }

/* Ensure good appearance inside simple header/nav wrappers used on privacy/terms pages */
header nav + .lang-switch,
header .wrap .lang-switch {
  margin-inline-start: 12px;
}

/* Mobile: hide the short code, show only flag+label in menu; make toggle compact */
@media (max-width: 640px) {
  .lang-switch__toggle { padding: 5px 10px; font-size: 12px; }
}
