html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 100px;
}

/* === Шапка === */
.header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  height: 100px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  background: #001530;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(0);
  transition: transform 0.3s ease-in-out;
  box-sizing: border-box;
}


.header.hide {
  transform: translateY(-100%);
}

.header-container {
  display: flex;
  width: 80%;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

/* Логотип */
.header-logo {
  display: flex;
  flex-direction: column;
  width: 300px;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

.image-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 60px;
}

.text-logo {
  display: flex;
  justify-content: center;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  color: #fff;
}

/* Меню */
.header-menu {
  display: flex;
  width: 60%;
  height: 100px;
  justify-content: center;
  gap: 30px;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
}

.menu-item {
  position: relative;
  text-decoration: none;
  font-size: 25px;
  color: #ffffff;
  padding: 0 10px;
  transition: color 0.5s;
}

.menu-item:hover {
  color: #007fff;
}

.menu-item::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 5px;
  background-color: #007fff;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
  border-radius: 2px;
}

.menu-item:hover::after {
  transform: scaleX(1);
}

/* Языковая кнопка */
.custom-lang-dropdown {
  position: relative;
  width: 100px;
  user-select: none;
}

.selected-option {
  background: #f0f8ff;
  border: 1px solid #007fff;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.3s ease;
}

.selected-option:hover {
  background: #007fff;
}

.selected-option img {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

.selected-option span {
  flex-grow: 1;
}

.arrow {
  font-size: 12px;
  margin-left: 8px;
}

.options-list {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #007fff;
  list-style: none;
  padding: 0;
  margin: 5px 0 0;
  display: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.options-list li {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.options-list li img {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

.options-list li:hover {
  background-color: #007fff;
}


.header-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 30px;
  height: 24px;
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 1001;
}

.header-burger span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.header-burger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.header-burger.active span:nth-child(2) {
  opacity: 0;
}

.header-burger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (min-height: 1024px) and (max-width: 1440px){
  .header-logo{
    width: 20%;
  }

  .header-container{
    width: 100%;
  }

  .custom-lang-dropdown{
    display: flex;
    justify-content: center;
  }

  .menu-item {
    font-size: 20px;
  }
}

@media (max-width: 430px){
  .header-burger{
    display: flex;
    max-width: 100vh;
  }
  .header-container{
    width: 100vh;
  }
  .text-logo {
    font-size: 7px;
    margin-top: 5px;
  }

  .image-logo img {
    max-height: 40px;
    height: auto;
    width: auto;
  }

  .menu-item {
    font-size: 18px;
    padding: 10px;
  }

  .lang-btn {
    font-size: 13px;
    padding: 4px 8px;
  }

  .header-burger {
    width: 22px;
    height: 16px;
    left: 15px;
    margin: 0;
    padding: 0;
  }

  .header-burger span {
    height: 2.5px;
  }

  .header-menu {
    top: var(--header-height-mobile, 50px); 
    height: calc(100vh - var(--header-height-mobile, 50px));
  }
}

@media (max-width: 1024px) {
  .header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background-color: #001530;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .header.hide {
    transform: translateY(0);
  }

  .header-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    position: relative;
  }

  .header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10;
  }

  .image-logo img {
    max-height: 55px;
  }

  .text-logo {
    font-size: 9px;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
  }

  .header-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 28px;
    height: 22px;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 1001;
  }

  .header-burger span {
    width: 100%;
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  .header-burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .header-burger.active span:nth-child(2) {
    opacity: 0;
  }

  .header-burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .custom-lang-dropdown {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 10;
  }

  .lang-btn {
    background-color: #91d8f7;
    border: none;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }

  .lang-btn:hover {
    background-color: #69b9e5;
  }

  .header-menu {
    height: 100vh + 100px;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    background-color: #001530;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 998;
    height: calc(100vh - 80px);
    overflow-y: auto;
  }

  .header-menu.active {
    transform: translateX(0);
  }

  .menu-item {
    font-size: 22px;
    text-align: center;
    color: #fff;
  }

  .menu-item::after {
    display: none;
  }
}


@media (max-width: 768px) {
  .custom-lang-dropdown {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 10;
}
  .header.hide {
    transform: translateY(0);
  }

  .header-burger{
    display: flex;
  }
  .header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
  }

  .header-container {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    height: auto;
    padding: 10px;
    position: relative; 
  }

 
  .header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10; 
  }

  .text-logo {
    font-size: 9px;
    text-align: center;
  }

  .header-lang-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 10; 
  }

  .lang-btn {
    background-color: #91d8f7;
    border: none;
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }

  .lang-btn:hover {
    background-color: #69b9e5;
  }

  /* Основные изменения для меню */
  .header-menu {
    display: none; /* Скрыто по умолчанию */
    flex-direction: column;
    width: 100%; /* Занимает всю ширину */
    background: #001530;
    position: absolute;
    /* top: 100%; */ /* Это может быть проблемой, если хедер меняет высоту */
    top: var(--header-height, 60px); /* Используем CSS-переменную для динамической высоты хедера, если она есть, или фиксированное значение */
    left: 0;
    z-index: 998; /* Должно быть ниже бургера, но выше других элементов */
    justify-content: flex-start; /* Выравнивание элементов меню сверху */
    padding: 20px 0; /* Уменьшим padding сверху, чтобы не было слишком большого отступа */
    box-sizing: border-box; /* Важно для корректной ширины с padding */
    height: calc(
      100vh - var(--header-height, 60px)
    ); /* Занимает оставшуюся высоту экрана */
    overflow-y: auto; /* Если меню будет длинным, появится прокрутка */
    transition: transform 0.3s ease-in-out; /* Плавное появление/скрытие */
    transform: translateX(-100%); /* Скрыто за пределами экрана слева */
  }

  .header-menu.active {
    display: flex;
    transform: translateX(0); /* Показываем меню, сдвигая его вправо */
  }

  .menu-item {
    font-size: 20px;
    padding: 15px;
    width: 100%;
    text-align: center;
    color: white;
  }

  .menu-item::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-burger{
    display: flex;
  }

  .header.hide {
    transform: translateY(0);
  }
  .header-container{
    width: 100%;
  }
  .text-logo {
    font-size: 7px;
    margin-top: 5px;
  }

  .image-logo img {
    max-height: 40px;
    height: auto;
    width: auto;
  }

  .menu-item {
    font-size: 18px;
    padding: 10px;
  }

  .lang-btn {
    font-size: 13px;
    padding: 4px 8px;
  }

  .header-burger {
    width: 22px;
    height: 16px;
    left: 15px;
    margin: 0;
    padding: 0;
  }

  .header-burger span {
    height: 2.5px;
  }

  .header-menu {
    top: var(--header-height-mobile, 50px); 
    height: calc(100vh - var(--header-height-mobile, 50px));
  }
}

