.floating-menu {
  position: fixed;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  background-color: rgba(232, 232, 243, 0.9);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 45px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
  border-radius: 16px 16px 16px 16px; /* закругление всех углов */
  height: 80px; /* или min-height, если контент может растягиваться */
}

.dark .floating-menu {
  background-color: rgba(30, 30, 47, 0.9);
}

.menu-items {
  display: flex;
  gap: 20px;
  align-items: center;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.menu-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Стили кнопок меню */
.menu-toggle,
.menu-logo {
  display: inline-flex;
  align-items: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  text-decoration: none;
  background-color: var(--background);
  box-shadow: 3px 3px 6px var(--shadow-dark),
              -2px -2px 6px var(--shadow-light);
}

.menu-toggle:active,
.menu-logo:active {
  box-shadow: inset 3px 3px 5px var(--inset-shadow-dark),
              inset -3px -3px 5px var(--inset-shadow-light);
  transform: translateY(2px);
  transition: all 0.1s ease;
}

.menu-toggle.active,
.menu-logo.active {
  box-shadow: inset 3px 3px 5px var(--inset-shadow-dark),
              inset -3px -3px 5px var(--inset-shadow-light);
  transform: translateY(2px);
}

.menu-toggle-icon,
.menu-logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.menu-toggle:hover .menu-toggle-icon,
.menu-logo:hover .menu-logo-icon {
  transform: rotate(15deg);
}

.menu-toggle-text {
  color: var(--foreground);
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  text-align: center;
  max-width: 100px;
  white-space: normal;
  line-height: 1.2;
  margin: 0;
}

.menu-toggle:hover + .menu-toggle-text,
.menu-logo:hover + .menu-toggle-text {
  color: var(--primary);
}

/* Стили для переключателя тем */
.theme-toggle {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50px;
  width: 50px;
}

.toggle-track {
  display: block;
  width: 50px;
  height: 25px;
  background-color: var(--background);
  border-radius: 20px;
  position: relative;
  box-shadow: inset 3px 3px 5px var(--inset-shadow-dark),
              inset -3px -3px 5px var(--inset-shadow-light);
  padding: 2px;
}

.toggle-button {
  width: 21px;
  height: 21px;
  background-color: var(--background);
  border-radius: 50%;
  position: absolute;
  left: 2px;
  top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 4px var(--shadow-dark),
              -2px -2px 4px var(--shadow-light);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 2;
}

.toggle-button:active {
  box-shadow: inset 1px 1px 2px var(--inset-shadow-dark),
              inset -1px -1px 2px var(--inset-shadow-light);
  transform: translateY(1px) translateX(0);
}

.dark .toggle-button:active {
  transform: translateY(1px) translateX(23px);
}

.toggle-icon {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: opacity 0.3s ease;
}

.toggle-icon.sun {
  opacity: 1;
}

.toggle-icon.moon {
  opacity: 0;
}

.dark .toggle-button {
  transform: translateX(23px);
}

.dark .toggle-icon.sun {
  opacity: 0;
}

.dark .toggle-icon.moon {
  opacity: 1;
}

/* Адаптивность */
@media (max-width: 768px) {
  .menu-items {
    gap: 10px;
  }
  .menu-right {
    gap: 10px;
    align-items: center;
  }
  .menu-toggle-text {
    font-size: 0.8rem;
    max-width: 80px;
    line-height: 1.1;
  }
  .theme-toggle {
    height: 50px;
    width: 50px;
  }
  .toggle-track {
    width: 50px;
    height: 25px;
  }
  .toggle-button {
    width: 21px;
    height: 21px;
  }
  .dark .toggle-button {
    transform: translateX(23px);
  }
  .dark .toggle-button:active {
    transform: translateY(1px) translateX(23px);
  }
}

@media (max-width: 480px) {
  .floating-menu {
    flex-direction: row; /* Сохраняем горизонтальное расположение */
    gap: 10px;
    padding: 10px;
    width: 100%;
    left: 0;
    transform: none;
  }
  .menu-items {
    flex-wrap: nowrap; /* Отключаем обертывание */
    gap: 5px; /* Уменьшаем gap для компактности */
  }
  .menu-right {
    display: flex;
    flex-direction: row; /* Убеждаемся, что элементы в menu-right в строке */
    gap: 5px;
    align-items: center;
  }
  .menu-toggle-text {
    font-size: 0.7rem;
    max-width: 70px;
    line-height: 1;
    margin: 0;
    padding-top: 1px;
  }
  .theme-toggle {
    height: 50px;
    width: 50px;
  }
  .toggle-track {
    width: 50px;
    height: 25px;
  }
  .toggle-button {
    width: 21px;
    height: 21px;
  }
  .dark .toggle-button {
    transform: translateX(23px);
  }
  .dark .toggle-button:active {
    transform: translateY(1px) translateX(23px);
  }
}
