/* =====================================================
   КАСТОМНЫЙ ВЫБОР ЯЗЫКА — SO-TECH (ФИНАЛЬНЫЙ CSS)
   Работает ТОЛЬКО с блоком .lang-switch
===================================================== */


/* -----------------------------------------------------
   1. ОБЁРТКА — ширина по содержимому (веб-версия)
----------------------------------------------------- */
.lang-switch {
  position: relative;
/*  display: inline-flex !important;
*/
  width: fit-content !important;
  min-width: 0 !important;
  user-select: none;
  z-index: 100;
  font-size: 14px;
}


/* -----------------------------------------------------
   2. ТЕКУЩИЙ ЯЗЫК (кнопка)
----------------------------------------------------- */
.lang-current {
  display: inline-flex !important;

  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  width: fit-content !important;
  min-width: 0 !important;
}

.lang-current .fa-chevron-down {
  font-size: 10px;
  opacity: .6;
}


/* -----------------------------------------------------
   3. ФЛАГ (фон-блок вместо img)
----------------------------------------------------- */
.lang-flag {
  display: inline-block !important;
  width: 20px !important;
  height: 14px !important;

  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;

  flex-shrink: 0 !important;
  border-radius: 2px;
}


/* -----------------------------------------------------
   4. ВЫПАДАЮЩЕЕ МЕНЮ — ширина под контент
----------------------------------------------------- */
.lang-menu {
  position: absolute;
  top: 110%;
  right: 0;

  background: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);

  display: none;
  width: max-content !important;
  min-width: 100% !important;
  overflow: hidden;

  animation: langFadeIn .25s ease;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #111;
  text-decoration: none;
  white-space: nowrap;
}

.lang-option:hover {
  background: #f5f5f5;
}


/* -----------------------------------------------------
   5. ОТКРЫТИЕ МЕНЮ
----------------------------------------------------- */
.lang-switch input[type="checkbox"] {
  display: none;
}

.lang-switch input[type="checkbox"]:checked ~ .lang-menu {
  display: block;
}

.lang-switch input[type="checkbox"]:checked + .lang-current .fa-chevron-down {
  transform: rotate(180deg);
}


/* -----------------------------------------------------
   6. МОБИЛЬНАЯ ВЕРСИЯ — показываем только флаг
----------------------------------------------------- */
@media (max-width: 768px) {

  /* обёртка селектора: не тянем, не растягиваем */
  .lang-switch {
    display: inline-block !important;
    width: auto !important;
    min-width: 0 !important;
    padding-left: 0 !important; /* перекрываем inline style, если надо */
    flex: 0 0 auto !important;
  }

  /* сама "кнопка" текущего языка — только флаг */
  .lang-current {
    display: inline-block !important;
    padding: 0 !important;
    margin: 0 0 0 15px !important;

    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;

    width: auto !important;
    min-width: 0 !important;
    white-space: normal !important; /* убираем влияние nowrap */
    gap: 0 !important;
  }

  /* прячем текст и стрелку */
  .lang-current .title,
  .lang-current .fa-chevron-down {
    display: none !important;
  }

  /* сам флаг задаёт размер кнопки */
  .lang-current .lang-flag {
    display: block !important;
    width: 22px !important;
    height: 16px !important;

    background-size: cover !important;
    background-position: center !important;
  }
}


/* -----------------------------------------------------
   7. АНИМАЦИЯ
----------------------------------------------------- */
@keyframes langFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
