/* === Основная навигация === */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 60px;
  background-color: rgba(44, 44, 44, 0.98);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

.main-nav .nav-left,
.main-nav .nav-menu {
  display: flex;
  align-items: center;
}

.main-nav .nav-left {
  gap: 14px;
  flex-shrink: 0;
}

.nav-logo-link,
.nav-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-logo-img {
  height: 36px;
  width: auto;
  transition: transform 0.2s ease, filter 0.2s ease;
  transform-origin: center;
  filter: drop-shadow(0 5px 1px rgba(0, 0, 0, 0.4));
}

.nav-home-img {
  height: 32px;
  width: auto;
  transition: transform 0.2s ease, filter 0.2s ease;
  transform-origin: center;
  object-fit: contain;
  filter: drop-shadow(0 5px 1px rgba(0, 0, 0, 0.4));
}

.nav-home-img:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 8px 3px rgba(0, 0, 0, 0.6));
}

.nav-logo-link:hover .nav-logo-img {
  transform: scale(1.12);
  filter: drop-shadow(0 8px 3px rgba(0, 0, 0, 0.6));
}

.nav-menu {
  flex: 1;
  align-items: center;
  gap: 20px;
}

.nav-center,
.nav-right {
  display: flex;
  align-items: center;
}

.nav-center {
  flex: 1;
  justify-content: center;
}

.nav-right {
  margin-left: auto;
}

.nav-link {
  display: block;
  padding: 12px 18px;
  color: #f8f8f8;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  line-height: 36px;
  transition: background-color 0.3s ease, color 0.3s ease;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
  border: none;
  background: transparent;
}

.nav-link:hover,
.nav-link:focus-visible {
  background-color: #0c4601;
  color: #fdfd6e;
}

.nav-link.active {
  background-color: #0c4601;
  color: #fdfd6e;
}

.nav-logout {
  background-color: #1a1a1a;
}

.nav-logout:hover,
.nav-logout:focus-visible {
  background-color: #0c4601;
  color: #fc9d9d;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nav-toggle span {
  width: 24px;
  height: 2.6px;
  background: #f8f8f8;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open {
  background-color: rgba(12, 70, 1, 0.14);
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Скрытые элементы по умолчанию, управляемые через JS */
#dashboardLink,
#logoutBtn {
  display: none;
}

/* === Адаптивность === */
@media (max-width: 1100px) {
  .main-nav {
    gap: 12px;
    padding: 0 12px;
  }

  .nav-center {
    gap: 10px;
  }

  .nav-link {
    padding: 12px 12px;
  }
}

@media (max-width: 900px) {
  .nav-center {
    justify-content: center;
    gap: 8px;
  }
}

@media (max-width: 780px) {
  .main-nav {
    height: 64px;
    padding: 0 12px;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 100px;
    background-color: rgba(44, 44, 44, 0.98);
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.32);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .nav-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-center,
  .nav-right {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .nav-center {
    flex: initial;
  }

  .nav-link {
    padding: 12px 14px;
    border-radius: 6px;
  }

  .nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 420px) {
  .nav-logo-img {
    height: 32px;
  }

  .nav-home-img {
    height: 28px;
  }

  .nav-link {
    font-size: 14px;
  }
}

/* === Навигационная панель === */
nav {
  background-color: #2c2c2c;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  /* box-shadow: 0 20px 15px rgba(0, 0, 0, 0.50); */
  padding: 0 20px;
  /* Добавим горизонтальные отступы */
  height: 48px;
  /* Минимальная высота для удобства клика */
  box-sizing: border-box;
  opacity: 0.98;
}

/* Список ссылок */
nav ul {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  /* Firefox */
  -webkit-overflow-scrolling: touch;
  /* Плавный скролл на iOS */
}

/* Скрыть скроллбар Chrome, Safari */
nav ul::-webkit-scrollbar {
  display: none;
}

/* Каждый пункт меню */
nav ul li {
  flex: 0 0 auto;
}

/* Ссылки и кнопки */
nav ul li a,
nav ul li button {
  display: block;
  padding: 12px 18px;
  color: white;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background-color 0.3s ease, color 0.3s ease;
  border: none;
  background: none;
  cursor: pointer;
  line-height: 24px;
  text-shadow: #000000 0px 0px 6px;
}

/* Hover эффекты */
nav ul li a:hover,
nav ul li button:hover {
  background-color: #0c4601;
  opacity: 0.98;
}

/* Активный пункт */
nav ul li a.active,
nav ul li button.active {
  background-color: #0c4601;
  color: #fdfd6e;
  opacity: 0.98;
}

/* Скрытые элементы по умолчанию */
#dashboardLink,
#logoutBtn {
  display: none;
}

/* Стиль кнопки выхода */
#logoutBtn {
  background-color: #1a1a1a;
}

#logoutBtn:hover {
  background-color: #0c4601;
  color: #fc9d9d;
  text-shadow: #000000 0px 0px 6px;
}

/* === Мобильная адаптация (до 768px) === */
@media (max-width: 768px) {
  nav {
    padding: 0 10px;
    height: 48px;
    width: 100%;
  }


}

/* === Очень узкие экраны (до 400px) === */
@media (max-width: 400px) {
  nav {
    padding: 0 10px !important;
    width: 100% !important;
  }


}