/* Объявление глобальных переменных */
:root {
  --border-radius: 12px;
  --blur-bg: rgba(255, 255, 255, 0.1);

}

/* Основной контейнер верхней панели */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  backdrop-filter: blur(10px); /* Опечатка: backdrop-filter */
  background: var(--blur-bg);
  border-radius: var(--border-radius, 12px); /* Запасное значение на случай отсутствия переменной */
  margin: 20px auto;
  width: 90%;
  position: sticky;
  top: 0;
  z-index: 9999;
  -webkit-backdrop-filter: blur(10px); /* Поддержка WebKit-браузеров */
}

/* Левая секция: кнопка темы + заголовок */
.left-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1; /* Занимает всё доступное пространство */
  min-width: 0; /* Позволяет сжиматься при необходимости */
}

.left-section h1 {
  font-size: 16px;
  margin: 0;
  flex-grow: 1; /* Растягивается на всё доступное место */
  white-space: nowrap; /* Предотвращает перенос текста */
  overflow: hidden;
  text-overflow: ellipsis; /* Обрезает длинный текст с многоточием */
}

/* Правая секция: кнопки меню и скачивания (ПК) */
.right-section {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex-shrink: 0; /* Не сжимается */
}

/* Кнопка переключения темы */
.theme-toggle {
  background: var(--bg-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Мобильная кнопка меню — всегда справа */
.mobile-menu-btn {
  background: var(--bg-secondary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
}



/* Мобильное выпадающее меню */
.mobile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 250px;
  background: var(--card-bg);
  border: 1px solid var(--text-secondary);
  border-radius: var(--border-radius, 12px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  z-index: 1000;
}

.mobile-dropdown.show {
  max-height: 500px;
  opacity: 1;
}

.mobile-dropdown a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: 8px;
}

.mobile-dropdown a:hover {
  background: var(--bg-secondary);
}

/* Универсальный класс для элементов со скруглениями */
.top-bar-element {
  -webkit-border-radius: var(--border-radius, 12px);
  -moz-border-radius: var(--border-radius, 12px);
  border-radius: var(--border-radius, 12px);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  /* Скрываем ПК‑кнопки и выпадающие меню */
  .right-section,
  .menu-dropdown,
  .download-dropdown {
    display: none;
  }

  /* Показываем мобильную кнопку */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Меняем расположение элементов */
  .top-bar {
    flex-direction: row; /* Остаёмся в одной строке */
    justify-content: flex-start; /* Выравниваем элементы слева */
  }

  .left-section {
    width: calc(100% - 60px); /* Занимает всю ширину минус место для кнопки */
    margin-right: 12px; /* Отступ перед мобильной кнопкой */
  }

  .left-section h1 {
    font-size: 14px; /* Уменьшаем заголовок */
    white-space: normal; /* Разрешаем перенос текста */
    text-overflow: clip; /* Убираем многоточие */
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 8px 5px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .left-section h1 {
    font-size: 13px;
  }
}
