document.addEventListener("click", function(){
  var langSelector = document.getElementsByClassName("header-lang-small")[0];
  var dropdown = document.getElementById("dropdown");
  var dropdownIcon = document.querySelector('.header-lang-small .icon');
  var isClickInside = langSelector.contains(event.target);
  if (isClickInside) {
    if (dropdown.style.display === "block") {
      dropdown.style.display = "none";
      dropdownIcon.classList.toggle('active');
    } else {
      dropdown.style.display = "block";
      dropdownIcon.classList.toggle('active');
    }
  } else {
    dropdown.style.display = "none";
    dropdownIcon.classList.remove('active');
  };

});
