/* =========================================================================
   Crystal Tech — language switcher styling
   ========================================================================= */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.75rem;
  font-family: 'Inter', sans-serif;
  z-index: 1200;
}

.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.lang-switcher-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.5);
}
.lang-switcher-btn .lang-flag { font-size: 1.05rem; line-height: 1; }
.lang-switcher-btn .lang-code { letter-spacing: 0.03em; }
.lang-switcher-btn .lang-caret {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  opacity: 0.8;
}
.lang-switcher.open .lang-switcher-btn .lang-caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: #11151c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.lang-switcher.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #e9edf2;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-option:hover { background: rgba(245, 158, 11, 0.14); }
.lang-option.is-active { color: #f59e0b; font-weight: 700; }
.lang-option .lang-flag { font-size: 1.1rem; }

/* Floating fallback when a page has no navbar */
.lang-switcher-floating {
  position: fixed;
  top: 1rem;
  right: 1rem;
}

/* RTL placement: menu opens to the left edge */
[dir="rtl"] .lang-switcher { margin-left: 0; margin-right: 0.75rem; }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .lang-option { text-align: right; }

/* Mobile: keep the switcher visible next to the burger */
@media (max-width: 768px) {
  .lang-switcher { margin-left: auto; margin-right: 0.5rem; }
  [dir="rtl"] .lang-switcher { margin-right: auto; margin-left: 0.5rem; }
}
