/* ============================================================
   I18N — Language switcher styling
   Professional dropdown that adapts to header / floating context
   ============================================================ */

.lang-switcher{
  position: relative;
  display: inline-flex;
  align-items: center;
  font-family: inherit;
  margin-inline-end: 6px;
}

/* ---- Trigger button ---- */
.lang-switcher__trigger{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(207, 168, 111, 0.18);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, transform .15s ease, box-shadow .25s ease;
  white-space: nowrap;
}
.lang-switcher__trigger:hover{
  background: rgba(207, 168, 111, 0.10);
  border-color: rgba(207, 168, 111, 0.45);
  box-shadow: 0 4px 18px rgba(207, 168, 111, 0.16);
}
.lang-switcher.is-open .lang-switcher__trigger{
  background: rgba(207, 168, 111, 0.14);
  border-color: rgba(207, 168, 111, 0.55);
}

.lang-switcher__flag{
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}
.lang-switcher__short{
  font-weight: 700;
  letter-spacing: .5px;
  font-size: 12.5px;
  color: #fff;
}
.lang-switcher__caret{
  color: #cfa86f;
  transition: transform .25s ease;
  flex-shrink: 0;
}
.lang-switcher.is-open .lang-switcher__caret{
  transform: rotate(180deg);
}

/* ---- Panel ---- */
.lang-switcher__panel{
  position: fixed;
  /* Reset logical inset properties FIRST so the physical left/right
     declarations below win the cascade in both LTR and RTL. */
  inset-inline-end: auto;
  inset-inline-start: auto;
  top: var(--lang-panel-top, 64px);
  right: var(--lang-panel-right, 24px);
  left: var(--lang-panel-left, auto);
  min-width: 240px;
  max-width: 280px;
  background: linear-gradient(180deg, #0d1530 0%, #0a1029 100%);
  border: 1px solid rgba(207, 168, 111, 0.28);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  box-shadow:
    0 18px 60px rgba(0,0,0,0.55),
    0 6px 18px rgba(207, 168, 111, 0.10);
  z-index: 49;       /* below header (header z-index: 50) so it visually attaches under it */
  overflow: hidden;
  animation: langPanelIn .22s cubic-bezier(.21,1,.36,1);
}
@keyframes langPanelIn{
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lang-switcher__head{
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(207, 168, 111, 0.16);
  background: linear-gradient(135deg, rgba(207, 168, 111, 0.08), rgba(207, 168, 111, 0.02));
}
.lang-switcher__title{
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #cfa86f;
  text-transform: uppercase;
}

.lang-switcher__list{
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 360px;
  overflow-y: auto;
}
.lang-switcher__list::-webkit-scrollbar{ width: 6px; }
.lang-switcher__list::-webkit-scrollbar-track{ background: transparent; }
.lang-switcher__list::-webkit-scrollbar-thumb{ background: rgba(207, 168, 111, 0.25); border-radius: 4px; }

.lang-switcher__opt{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .18s ease, transform .15s ease;
  position: relative;
}
.lang-switcher__opt:hover{
  background: rgba(207, 168, 111, 0.10);
}
.lang-switcher__opt.is-active{
  background: linear-gradient(90deg, rgba(207, 168, 111, 0.16), rgba(207, 168, 111, 0.04));
  border: 1px solid rgba(207, 168, 111, 0.28);
}
.lang-switcher__opt-flag{
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.lang-switcher__opt-name{
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.lang-switcher__opt-short{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(207, 168, 111, 0.85);
  background: rgba(207, 168, 111, 0.10);
  padding: 3px 8px;
  border-radius: 6px;
}
.lang-switcher__opt-check{
  color: #cfa86f;
  opacity: 0;
  transition: opacity .2s ease;
  flex-shrink: 0;
}
.lang-switcher__opt.is-active .lang-switcher__opt-check{
  opacity: 1;
}
.lang-switcher__opt.is-active .lang-switcher__opt-short{
  background: rgba(207, 168, 111, 0.22);
  color: #fff;
}

/* ---- Floating fallback (for pages without header-actions) ---- */
.lang-switcher--floating{
  position: fixed;
  top: 22px;
  inset-inline-start: 22px;   /* top-left so dropdown stays inside viewport */
  z-index: 9998;
}
.lang-switcher--floating .lang-switcher__panel{
  /* Floating context: panel still attaches to its trigger via JS-set CSS vars */
  border-top: 1px solid rgba(207, 168, 111, 0.28);
  border-radius: 14px;
}

/* ---- RTL adjustments ---- */
/* No need to swap inset-inline-* — JS positions panel via fixed coordinates. */

/* ---- Mobile: full-width-friendly ---- */
@media (max-width: 768px){
  .lang-switcher{ margin-inline-end: 4px; }
  .lang-switcher__trigger{
    height: 36px;
    padding: 0 10px;
    gap: 5px;
    font-size: 12px;
  }
  .lang-switcher__short{ font-size: 11.5px; }
  .lang-switcher__flag{ font-size: 14px; }
  .lang-switcher__panel{
    /* On mobile: panel spans most of viewport width, still attached to header bottom */
    right: 12px !important;
    left: 12px !important;
    max-width: none;
    min-width: 0;
    width: auto;
    border-radius: 0 0 16px 16px;
    animation: langSheetIn .25s cubic-bezier(.21,1,.36,1);
  }
  @keyframes langSheetIn{
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .lang-switcher__list{ max-height: 60vh; }
}

@media (max-width: 480px){
  .lang-switcher__short{ display: none; }
  .lang-switcher__trigger{
    padding: 0 8px;
    gap: 4px;
  }
}

/* ---- Hidden helper (for [hidden] attribute) ---- */
.lang-switcher__panel[hidden]{ display: none !important; }
