/* Language dropdown (see public/assets/js/lang-dropdown.js).
   The original <select class="change_language"> stays in the page, visually hidden, so the existing
   change handler and the selected language keep working; this is only the interface on top of it. */
.tb-lang-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.tb-lang-hidden { display: none !important; }

.tb-lang {
  position: relative;
  display: inline-block;
  font-family: inherit;
}

.tb-lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 2px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.tb-lang__btn:focus-visible {
  outline: 2px solid #fea116;
  outline-offset: 3px;
  border-radius: 6px;
}

.tb-lang__chev {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}

.tb-lang.is-open .tb-lang__chev { transform: rotate(180deg); }

.tb-lang__menu {
  position: absolute;
  top: calc(100% + 12px);
  right: -6px;
  z-index: 1085;
  min-width: 190px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(15, 20, 36, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
}

/* little arrow pointing at the button */
.tb-lang__menu::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  background: rgba(15, 20, 36, 0.97);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  transform: rotate(45deg);
}

.tb-lang.is-open .tb-lang__menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s;
}

.tb-lang__opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #e8ebf5;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-transform: none;
  white-space: nowrap;
  outline: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.tb-lang__opt:hover,
.tb-lang__opt.is-active { background: rgba(255, 255, 255, 0.09); }

.tb-lang__opt .tb-lang__code {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 235, 245, 0.65);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.tb-lang__check {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: #fea116;
  opacity: 0;
}

.tb-lang__opt[aria-selected='true'] { color: #fea116; }
.tb-lang__opt[aria-selected='true'] .tb-lang__check { opacity: 1; }

/* inside the mobile menu: part of the list, left aligned, a little larger */
.tb-lang--nav {
  display: block;
  margin: 6px 0 10px;
}

.tb-lang--nav .tb-lang__btn {
  padding: 10px 14px;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.tb-lang--nav .tb-lang__menu {
  position: static;
  display: none;
  margin-top: 8px;
  min-width: 0;
  transform: none;
  opacity: 1;
  visibility: visible;
  transition: none;
}

.tb-lang--nav .tb-lang__menu::before { display: none; }
.tb-lang--nav.is-open .tb-lang__menu { display: block; }

/* The mobile menu has a white background, so the light-on-dark colours above vanish there: use dark text. */
.tb-lang--nav .tb-lang__btn {
  color: #111;
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.04);
}

.tb-lang--nav .tb-lang__menu {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.tb-lang--nav .tb-lang__opt { color: #111; }
.tb-lang--nav .tb-lang__opt:hover,
.tb-lang--nav .tb-lang__opt.is-active { background: rgba(0, 0, 0, 0.06); }
.tb-lang--nav .tb-lang__opt .tb-lang__code { background: rgba(0, 0, 0, 0.07); color: rgba(0, 0, 0, 0.6); }
.tb-lang--nav .tb-lang__opt[aria-selected='true'],
.tb-lang--nav .tb-lang__check { color: #c2410c; }

/* On desktop the language picker lives in the top bar, so the one inside the nav is only for the mobile menu. */
@media (min-width: 992px) {
  .tb-lang--nav { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tb-lang__menu, .tb-lang__chev, .tb-lang__opt { transition: none; }
}
