/* LB_LANG_SINGLE_V67: single language pill (flag + code) */
/* Patched: do not hide the base language switch on mobile */
@media (min-width:901px){
  /* desktop can use custom pill if present */
}
@media (max-width:900px){
  #langFlag, .langFlag, #lang{ display:inline-block !important; }
}

/* === LB_LANG_ENHANCED_V14_4: custom dropdown UI while keeping native <select> for routing ===
   IMPORTANT: #lbLangWrap must NOT carry .langSelectWrap.
   The actual pill sizing is applied ONLY to the inner .langSelectWrap injected by lang-switch.js.
*/

/* Wrapper in header: keep it shrink-to-fit so it never overlaps the burger */
header #lbLangWrap{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  flex:0 0 auto !important;
  width:auto !important;
  min-width:0 !important;
}

/* Keep the "Language" label area stable across locales (prevents layout shift) */
header #lbLangWrap .langLabel{
  display:inline-block !important;
  min-width:76px !important; /* fits "Language" (8 chars) comfortably */
  text-align:right !important;
  white-space:nowrap !important;
}
html[dir="rtl"] header #lbLangWrap .langLabel{ text-align:left !important; }

@media (max-width:420px){
  header #lbLangWrap .langLabel{ min-width:64px !important; }
}

/* The actual pill container */
header #lbLangWrap .langSelectWrap{
  position:relative !important;
  display:inline-flex !important;
  align-items:center !important;
  /* responsive width so it never collides with brand */
  width:clamp(120px, 18vw, 170px) !important;
  min-width:120px !important;
  height:40px !important;
}

/* Mobile/tablet tweaks */
@media (max-width:900px){
  header #lbLangWrap .langSelectWrap{
    width:clamp(112px, 28vw, 160px) !important;
    min-width:112px !important;
    height:38px !important;
  }
}

/* Extra-small phones */
@media (max-width:420px){
  header #lbLangWrap .langSelectWrap{
    width:112px !important;
    min-width:112px !important;
    height:34px !important;
  }
}

/* Only enable the custom button/menu when JS adds this class */
html.lbLangEnhanced header select#lang{
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
  opacity:0 !important;
  pointer-events:none !important; /* prevent native dropdown */
}

html.lbLangEnhanced header #langFlag,
html.lbLangEnhanced header .langFlag{
  display:none !important; /* we render the flag inside the button */
}

html:not(.lbLangEnhanced) .lbLangBtn,
html:not(.lbLangEnhanced) .lbLangMenu{
  position:fixed !important;
  background:#fff !important;
  border:1px solid rgba(0,0,0,.14) !important;
  border-radius:16px !important;
  box-shadow:0 16px 44px rgba(0,0,0,.14) !important;
  padding:6px !important;
  z-index:99999 !important;
  min-width:160px !important;

  /* animation-friendly hidden state */
  display:block !important;
  visibility:hidden !important;
  opacity:0 !important;
  transform:translateY(-6px) !important;
  transition:opacity 120ms ease, transform 120ms ease, visibility 0ms linear 120ms !important;
  pointer-events:none !important;
  will-change:opacity, transform !important;
}

.lbLangMenu .lbLangName{
  font-weight:700 !important;
  font-size:13px !important;
  line-height:1.15 !important;
}

@media (max-width:900px){
  .lbLangMenu .lbLangName{ font-size:12px !important; }
}

.lbLangBtn{
  position:absolute !important;
  inset:0 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:10px !important;
  padding:0 12px !important;
  background:#fff !important;
  border:1px solid rgba(0,0,0,.18) !important;
  border-radius:14px !important;
  box-shadow:0 2px 10px rgba(0,0,0,.07) !important;
  cursor:pointer !important;
  user-select:none !important;
  z-index:2 !important;
}
.lbLangBtn img{
  /* Match source flag aspect ratio (320x200 = 1.6) to avoid resampling blur on desktop */
  width:32px !important;
  height:20px !important;
  object-fit:cover !important;
  border-radius:3px !important;
  display:block !important;
}
.lbLangBtn .lbLangCode{
  font-weight:800 !important;
  letter-spacing:.7px !important;
  font-size:13px !important;
  line-height:1 !important;
  color:#000 !important;
  flex:1 1 auto !important;
  text-align:center !important;
  white-space:nowrap !important;
}
.lbLangBtn .lbLangCaret{
  width:0 !important;
  height:0 !important;
  border-left:5px solid transparent !important;
  border-right:5px solid transparent !important;
  border-top:6px solid rgba(0,0,0,.55) !important;
}

.lbLangMenu{
  position:fixed !important;
  background:#fff !important;
  border:1px solid rgba(0,0,0,.14) !important;
  border-radius:16px !important;
  box-shadow:0 16px 44px rgba(0,0,0,.14) !important;
  padding:6px !important;
  z-index:99999 !important;
  min-width:160px !important;

  /* animation-friendly hidden state (keeps size measurable) */
  display:block !important;
  visibility:hidden !important;
  opacity:0 !important;
  transform:translateY(-6px) !important;
  transition:opacity 120ms ease, transform 120ms ease, visibility 0ms linear 120ms !important;
  pointer-events:none !important;
  will-change:opacity, transform !important;
}
.lbLangMenu.open{
  display:block !important;
  opacity:1 !important;
  transform:translateY(0) !important;
  visibility:visible !important;
  pointer-events:auto !important;
  transition:opacity 120ms ease, transform 120ms ease, visibility 0ms linear 0ms !important;
}
.lbLangItem{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:12px !important;
  padding:10px 12px !important;
  border-radius:12px !important;
  cursor:pointer !important;
  white-space:nowrap !important;
  color:#000 !important;
}
.lbLangItem:hover{ background:rgba(0,0,0,.06) !important; }
.lbLangItem img{
  /* Match source flag aspect ratio (320x200 = 1.6) to avoid resampling blur on desktop */
  width:32px !important;
  height:20px !important;
  object-fit:cover !important;
  border-radius:3px !important;
  display:block !important;
}
.lbLangItem .lbLangCode{
  font-weight:800 !important;
  letter-spacing:.7px !important;
  font-size:13px !important;
}
@media (max-width:900px){
.lbLangBtn{ gap:8px !important; padding:0 10px !important; border-radius:13px !important; }
  .lbLangBtn img, .lbLangItem img{ width:26px !important; height:17px !important; }
  .lbLangBtn .lbLangCode, .lbLangItem .lbLangCode{ font-size:12px !important; letter-spacing:.6px !important; }
}

/* Extra-small phones: keep the pill compact so it never collides with the brand */
@media (max-width:420px){
.lbLangBtn{ padding:0 9px !important; border-radius:12px !important; }
  .lbLangBtn img, .lbLangItem img{ width:24px !important; height:15px !important; }
  .lbLangBtn .lbLangCaret{ border-left:4px solid transparent !important; border-right:4px solid transparent !important; border-top:5px solid rgba(0,0,0,.55) !important; }
}

/* Desktop dropdown (some pages use background-image flags). Keep 1.6 aspect ratio to avoid resampling blur. */
@media (min-width:901px){
  .langDdFlag{
    width:32px !important;
    height:20px !important;
    background-size:100% 100% !important;
    background-position:center !important;
  }
}


/* iOS SAFETY FIX - language selector always visible */
#lang{
  display:inline-block !important;
  visibility:visible !important;
  opacity:1 !important;
}

#langFlag{
  display:inline-block !important;
  visibility:visible !important;
  opacity:1 !important;
  background-size:contain !important;
  background-repeat:no-repeat !important;
  background-position:center !important;
  min-width:20px;
  min-height:14px;
  position:relative;
  z-index:10;
}

.header-right, .nav-right, .top-right {
  overflow: visible !important;
}


/* === FORCE LANG SELECT VISIBLE ON ALL IOS / DESKTOP-MODE SAFARI CASES ===
   Some iOS Safari configurations (per-site "Request Desktop Website", Display Zoom, etc.)
   can trigger desktop media queries and hide the <select>. We override that here so the
   language switch never disappears. */
.langDd, .langDdMenu { display:none !important; } /* disable custom desktop dropdown */
.langSelectWrap { overflow:visible !important; }
#lang{
  position:static !important;
  opacity:1 !important;
  pointer-events:auto !important;
  display:inline-block !important;
  visibility:visible !important;
}
#langFlag, .langFlag{
  display:inline-block !important;
  visibility:visible !important;
  opacity:1 !important;
}


/* === CONSISTENT LABEL: keep Language label consistent across all pages === */
header .langLabel, .langLabel{
  color:#111 !important;
  font-weight:600 !important;
  font-size:14px !important;
  letter-spacing:.2px !important;
}
header select#lang, select#lang{ color:#000 !important; }
