/* ═══════════════════════════════════════════════════════════════════
   MMOCodeX — Language Switcher  (mcx-i18n.css)
   Floating bottom-left widget, follows user on every page.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CONTAINER ───────────────────────────────────────────────────── */
.mcx-lang {
  position: fixed;
  bottom: 22px;
  left: 20px;
  z-index: 9999;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  pointer-events: none;
}
.mcx-lang * { box-sizing: border-box; }

/* ─── TOGGLE BUTTON ───────────────────────────────────────────────── */
.mcx-lang-toggle {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px 0 6px;
  border: 1px solid rgba(104, 220, 173, .28);
  border-radius: 999px;
  background: rgba(3, 14, 9, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #68dcad;
  font-size: .58rem;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background .18s;
  box-shadow: 0 4px 28px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.025) inset;
  white-space: nowrap;
  user-select: none;
}
.mcx-lang-toggle:hover {
  border-color: rgba(104, 220, 173, .58);
  box-shadow: 0 4px 32px rgba(104, 220, 173, .16), 0 8px 40px rgba(0,0,0,.55);
  background: rgba(4, 22, 14, .96);
}
.mcx-lang-toggle .mcx-lang-flag {
  font-size: .78rem;
  line-height: 1;
  flex-shrink: 0;
}
.mcx-lang-toggle .mcx-lang-label {
  flex: 1;
}
.mcx-lang-toggle .mcx-lang-arrow {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  transition: transform .2s ease;
  opacity: .7;
}
.mcx-lang.is-open .mcx-lang-toggle {
  border-color: rgba(104, 220, 173, .55);
  background: rgba(4, 22, 14, .98);
  box-shadow: 0 4px 32px rgba(104, 220, 173, .14), 0 8px 40px rgba(0,0,0,.6);
}
.mcx-lang.is-open .mcx-lang-arrow {
  transform: rotate(180deg);
}

/* ─── DROPDOWN PANEL ──────────────────────────────────────────────── */
.mcx-lang-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  padding: 4px 3px;
  border: 1px solid rgba(104, 220, 173, .22);
  border-radius: 14px;
  background: rgba(3, 12, 8, .96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 52px rgba(0,0,0,.65), 0 0 0 1px rgba(104, 220, 173, .07) inset;
  opacity: 0;
  transform: translateY(6px) scale(.97);
  transform-origin: bottom left;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.mcx-lang.is-open .mcx-lang-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ─── PANEL HEADER ────────────────────────────────────────────────── */
.mcx-lang-heading {
  display: block;
  padding: 5px 10px 4px;
  color: rgba(239, 255, 248, .35);
  font-size: .52rem;
  font-weight: 950;
  letter-spacing: .16em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(104, 220, 173, .1);
  margin-bottom: 3px;
}

/* ─── LANGUAGE OPTIONS ────────────────────────────────────────────── */
.mcx-lang-option {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(239, 255, 248, .72);
  font-size: .68rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .14s, color .14s;
  text-align: left;
}
.mcx-lang-option:hover {
  background: rgba(104, 220, 173, .1);
  color: #effff8;
}
.mcx-lang-option.is-active {
  background: rgba(104, 220, 173, .13);
  color: #68dcad;
}
.mcx-lang-option.is-active .mcx-lang-opt-flag {
  filter: drop-shadow(0 0 4px rgba(104, 220, 173, .5));
}
.mcx-lang-opt-flag {
  font-size: .88rem;
  flex-shrink: 0;
  line-height: 1;
}
.mcx-lang-opt-name {
  flex: 1;
}
.mcx-lang-opt-check {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(104, 220, 173, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .46rem;
  color: transparent;
  transition: all .14s;
}
.mcx-lang-option.is-active .mcx-lang-opt-check {
  background: #68dcad;
  border-color: #68dcad;
  color: #010a06;
}

/* ─── LOADING OVERLAY ─────────────────────────────────────────────── */
.mcx-lang-loading {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 6, 4, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.mcx-lang-loading.is-visible {
  opacity: 1;
  pointer-events: all;
}
.mcx-lang-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(104, 220, 173, .16);
  border-top-color: #68dcad;
  border-radius: 50%;
  animation: mcx-spin .7s linear infinite;
}
@keyframes mcx-spin { to { transform: rotate(360deg); } }

/* ─── TRANSLATED TEXT FLASH ───────────────────────────────────────── */
[data-i18n] {
  transition: opacity .18s ease;
}
.mcx-lang-fading [data-i18n] {
  opacity: 0;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .mcx-lang {
    bottom: 10px;
    left: 10px;
  }
  .mcx-lang-panel {
    min-width: 140px;
  }
  .mcx-lang-toggle {
    min-height: 22px;
    padding: 0 7px 0 5px;
    font-size: .54rem;
  }
}
