/* ── SaveFree custom language switcher (Polylang URLs, our UI) ───── */
:root {
  --sf-lang-accent: #0073e6;
  --sf-lang-accent-soft: #e8f2fd;
  --sf-lang-border: #e8edf3;
  --sf-lang-text: #1e293b;
  --sf-lang-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  --sf-lang-flag-ru: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Crect fill='%23fff' width='24' height='16'/%3E%3Crect fill='%230039a6' y='5.33' width='24' height='5.33'/%3E%3Crect fill='%23d52b1e' y='10.67' width='24' height='5.33'/%3E%3C/svg%3E");
  --sf-lang-flag-uk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Crect fill='%23005BBB' width='24' height='8'/%3E%3Crect fill='%23FFD500' y='8' width='24' height='8'/%3E%3C/svg%3E");
  --sf-lang-flag-en: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Crect fill='%23B22234' width='24' height='16'/%3E%3Cpath fill='%23fff' d='M0 1.23h24V2.46H0zm0 2.46h24v1.23H0zm0 2.46h24v1.23H0zm0 2.46h24v1.23H0zm0 2.46h24v1.23H0zm0 2.46h24V16H0z'/%3E%3Crect fill='%233C3B6E' width='10' height='8.6'/%3E%3C/svg%3E");
}

/* Hide Polylang / third-party switchers — use our menu component */
.pll-parent-menu-item,
.menu-item-lang,
.polylang-switcher,
.widget_polylang,
#lang_sel,
.lang-switcher {
  display: none !important;
}

#sf-lang-switcher-fallback {
  display: none !important;
}

.sf-lang-switcher-item {
  display: flex !important;
  align-items: center;
  list-style: none !important;
  margin: 0 6px 0 16px !important;
  padding: 0 !important;
  position: relative;
  overflow: visible !important;
}

.sf-lang-switcher {
  position: relative;
  font-family: inherit;
}

/* Closed: globe + language code */
.sf-lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 12px 5px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--sf-lang-text);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sf-lang-switcher__btn:hover,
.sf-lang-switcher.is-open .sf-lang-switcher__btn {
  border-color: rgba(0, 115, 230, 0.22);
  background: #f8fbff;
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
  transform: none;
}

.sf-lang-switcher__globe {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, #1d6fd8 0%, #0e7490 42%, #2563eb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 4px rgba(15, 23, 42, 0.18);
}

.sf-lang-switcher__globe svg {
  width: 17px;
  height: 17px;
  display: block;
}

.sf-lang-switcher__code {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--sf-lang-text);
  line-height: 1;
}

.sf-lang-flag--ru { background-image: var(--sf-lang-flag-ru); }
.sf-lang-flag--uk { background-image: var(--sf-lang-flag-uk); }
.sf-lang-flag--en { background-image: var(--sf-lang-flag-en); }

/* Flags in dropdown list */
.sf-lang-switcher__flag {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.12);
}

.sf-lang-switcher__opt .sf-lang-switcher__flag {
  width: 22px;
  height: 22px;
}

/* Dropdown — hidden until open (desktop + mobile) */
.sf-lang-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 196px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--sf-lang-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--sf-lang-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 999999;
  pointer-events: none;
}

.sf-lang-switcher.is-open .sf-lang-switcher__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.sf-lang-switcher__menu li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sf-lang-switcher__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sf-lang-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sf-lang-switcher__opt:hover {
  background: var(--sf-lang-accent-soft);
  color: var(--sf-lang-accent);
}

.sf-lang-switcher__opt.is-current {
  background: var(--sf-lang-accent-soft);
  color: var(--sf-lang-accent);
  font-weight: 600;
  pointer-events: none;
}

/* Mobile: same closed-by-default; compact globe in drawer */
@media (max-width: 1024px) {
  .sf-lang-switcher-item {
    margin: 8px 0 !important;
    padding: 0 16px !important;
  }

  .sf-lang-switcher__globe {
    width: 32px;
    height: 32px;
  }

  .sf-lang-switcher__globe svg {
    width: 19px;
    height: 19px;
  }

  .sf-lang-switcher__menu {
    right: auto;
    left: 0;
    min-width: 180px;
  }

  /* Elementor drawer: don't clip dropdown */
  .elementor-nav-menu--dropdown,
  .elementor-nav-menu--dropdown .sf-lang-switcher-item,
  .elementor-nav-menu .sf-lang-switcher-item {
    overflow: visible !important;
  }
}

/* Fixed dropdown when inside overflow-hidden mobile panel */
.sf-lang-switcher.is-open.sf-lang-fixed .sf-lang-switcher__menu {
  position: fixed;
}
