/* ====================================================================
   LANGUAGE SWITCHER (Переключатель языков)
   ==================================================================== */

.language-switcher {
  position: relative;
  display: inline-block;
  font-family: var(--font-main, system-ui, -apple-system, sans-serif);
}

/* ====================================================================
   ТЕКУЩИЙ ЯЗЫК (Кнопка)
   ==================================================================== */

.language-switcher__current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  min-width: 120px;
  justify-content: space-between;
}

.language-switcher__current:hover {
  border-color: #3563e9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.language-switcher__current:focus {
  outline: none;
  border-color: #3563e9;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

/* Открытое состояние */
.language-switcher.active .language-switcher__current {
  border-color: #3563e9;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  min-width: 200px;
}

/* ====================================================================
   ЭЛЕМЕНТЫ КНОПКИ
   ==================================================================== */

.language-switcher__flag {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.language-switcher__code {
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.5px;
}

.language-switcher__arrow {
  width: 12px;
  height: 8px;
  transition: transform 0.3s ease;
  color: #666;
  margin-left: auto;
}

.language-switcher.active .language-switcher__arrow {
  transform: rotate(180deg);
}

/* ====================================================================
   ВЫПАДАЮЩИЙ СПИСОК
   ==================================================================== */

.language-switcher__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  min-width: 200px;
  background: #ffffff;
  border: 2px solid #3563e9;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}

.language-switcher.active .language-switcher__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Скролл для длинного списка */
.language-switcher__dropdown::-webkit-scrollbar {
  width: 6px;
}

.language-switcher__dropdown::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 0 0 10px 0;
}

.language-switcher__dropdown::-webkit-scrollbar-thumb {
  background: #3563e9;
  border-radius: 10px;
}

/* ====================================================================
   СПИСОК ЯЗЫКОВ
   ==================================================================== */

.language-switcher__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.language-switcher__item {
  margin: 0;
  padding: 0;
}

.language-switcher__item:last-child .language-switcher__link {
  border-bottom: none;
}

/* ====================================================================
   ССЫЛКИ ЯЗЫКОВ
   ==================================================================== */

.language-switcher__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  text-decoration: none;
  color: #1a1a1a;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.language-switcher__link:hover {
  background: #fafafa;
  padding-left: 20px;
}

/* Активный язык */
.language-switcher__item--active .language-switcher__link {
  background: #fff8f0;
  color: #3563e9;
  font-weight: 600;
}

.language-switcher__item--active .language-switcher__link:hover {
  background: #fff8f0;
}

/* ====================================================================
   ЭЛЕМЕНТЫ ССЫЛКИ
   ==================================================================== */

.language-switcher__link .language-switcher__flag {
  flex-shrink: 0;
}

.language-switcher__name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.language-switcher__link .language-switcher__code {
  font-size: 12px;
  color: #999;
  font-weight: 500;
}

.language-switcher__item--active
  .language-switcher__link
  .language-switcher__code {
  color: #3563e9;
}

/* Галочка для активного языка */
.language-switcher__check {
  width: 16px;
  height: 16px;
  color: #3563e9;
  flex-shrink: 0;
}

/* ====================================================================
   ВАРИАНТЫ РАЗМЕЩЕНИЯ
   ==================================================================== */

/* В Header (справа) */
.header .language-switcher {
  margin-left: 20px;
}

/* В Mobile Menu */
.mobile-menu .language-switcher {
  margin: 20px 0;
}

.mobile-menu .language-switcher__current {
  width: 100%;
}

.mobile-menu .language-switcher__dropdown {
  width: 100%;
}

/* В Footer */
.footer .language-switcher {
  display: inline-block;
}

/* ====================================================================
   АДАПТИВ - TABLET
   ==================================================================== */

@media (max-width: 1024px) {
  .language-switcher__current {
    padding: 8px 14px;
    min-width: 100px;
    font-size: 13px;
  }

  .language-switcher__flag {
    width: 20px;
    height: 15px;
  }

  .language-switcher__dropdown {
    min-width: 180px;
  }

  .language-switcher__link {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* ====================================================================
   АДАПТИВ - MOBILE
   ==================================================================== */

@media (max-width: 767px) {
  /* Компактная версия для мобилки */
  .language-switcher__current {
    padding: 8px 12px;
    min-width: auto;
    gap: 6px;
  }

  .language-switcher.active .language-switcher__current {
    min-width: auto;
  }

  .language-switcher__flag {
    width: 18px;
    height: 14px;
  }

  .language-switcher__code {
    font-size: 13px;
  }

  .language-switcher__dropdown {
    min-width: auto;
    max-height: 250px;
  }

  .language-switcher__link {
    padding: 10px 12px;
    gap: 8px;
  }

  .language-switcher__name {
    display: none;
  }

  .language-switcher__link .language-switcher__code {
    font-size: 11px;
  }

  /* В мобильном меню на всю ширину */
  .mobile-menu .language-switcher__current {
    padding: 12px 16px;
  }
}

/* ====================================================================
   АНИМАЦИИ
   ==================================================================== */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.language-switcher.active .language-switcher__dropdown {
  animation: slideDown 0.3s ease;
}

/* Плавное появление элементов списка */
.language-switcher__item {
  opacity: 0;
  animation: fadeInItem 0.3s ease forwards;
}

.language-switcher__item:nth-child(1) {
  animation-delay: 0.05s;
}
.language-switcher__item:nth-child(2) {
  animation-delay: 0.1s;
}
.language-switcher__item:nth-child(3) {
  animation-delay: 0.15s;
}
.language-switcher__item:nth-child(4) {
  animation-delay: 0.2s;
}
.language-switcher__item:nth-child(5) {
  animation-delay: 0.25s;
}

@keyframes fadeInItem {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
