/* Базовые стили для хедера, общие для мобильной и десктопной версий */

/* CSS-переменные для хедера */
:root {
  --top-header-height: 60px;
}

/* Общие стили для хедера */
.site-header {
  width: 100%;
  z-index: 999 !important; /* Уменьшаем z-index для корректной работы выпадающих меню */
  transition: all 0.3s ease;
  will-change: transform;
  backface-visibility: hidden;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Стили для верхнего заголовка */
.top-header {
  background-color: #000;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 999; /* Уменьшаем z-index для корректной работы выпадающих меню */
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-top {
  padding: 8px 0;
  transition: padding 0.3s ease;
}

/* Стили для нижнего заголовка */
.bottom-header {
  background-color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: var(--top-header-height, 60px);
  z-index: 998; /* Уменьшаем z-index для корректной работы выпадающих меню */
  transition: all 0.3s ease;
}

/* Дополнительные стили для фиксированного хедера при прокрутке */
.site-header.scrolled {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.top-header.scrolled {
  padding: 5px 0;
  transition: padding 0.3s ease;
}

.bottom-header.scrolled {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Исправление проблемы с наложением хедеров - основные стили */
header {
  position: -webkit-sticky; /* Safari */
  position: sticky;
  top: 0;
  z-index: 997; /* Уменьшаем z-index для корректной работы выпадающих меню */
  transition: all 0.3s ease;
}

/* Дополнительные стили для принудительной фиксации */
header.fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

/* Решение проблемы с iOS и Safari */
@supports (position: sticky) or (position: -webkit-sticky) {
  header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
  }
}

/* Компактный режим для хедера при прокрутке */
header.scrolled .top-header {
  padding: 3px 0;
}

header.scrolled .bottom-header {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Дополнительные стили для анимации */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

header.scrolled {
  animation: slideDown 0.3s ease forwards;
}

/* Стили для логотипа */
.site-logo {
  display: inline-block;
}

.site-logo img {
  max-height: 40px;
  width: auto;
  transition: all 0.3s ease;
}

/* Общие стили для кнопок авторизации */
.auth-buttons .btn {
  transition: all 0.2s ease;
}

/* Общие стили для выпадающего меню пользователя */
.user-menu .dropdown-toggle {
  background: transparent;
  transition: all 0.2s ease;
}

.user-menu .dropdown-menu {
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.user-menu .dropdown-item {
  padding: 8px 20px;
  transition: background-color 0.2s ease;
}

.user-menu .dropdown-item:hover {
  background-color: #f8f9fa;
}

/* Основная навигация */
.main-nav {
  display: flex;
  justify-content: center;
}

.nav-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin: 0 5px;
}

.nav-link {
  display: block;
  padding: 10px 15px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover {
  color: #007bff;
}

.nav-link.active {
  color: #007bff;
  font-weight: 500;
}

.nav-link.active:after {
  content: '';
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 5px;
  height: 2px;
  background-color: #007bff;
}

/* Уведомления - общие стили */
.badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 5px;
}

/* Анимации для хедера */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Стили для общих элементов мобильного меню */
.mobile-menu-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-block;
  padding: 5px;
  position: relative;
  z-index: 1001;
}

.mobile-menu-toggle span {
  background-color: #fff;
  display: block;
  height: 2px;
  margin: 5px 0;
  transition: all 0.3s ease;
  width: 24px;
}

/* Стили для фиксированного хедера, который будет управляться JavaScript */
.fixed-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 996 !important; /* Уменьшаем z-index для корректной работы выпадающих меню */
    background-color: #fff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fixed-header .top-header {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

.fixed-header .navbar {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

/* Отступ для контента при фиксированном хедере */
body.has-fixed-header {
    padding-top: var(--header-total-height, 120px);
}



/* Стили для кнопки пользователя */
.btn-user {
  color: #fff !important;
  border-color: #fff !important;
  background-color: transparent;
  transition: all 0.2s ease;
}

/* Стили для улучшения видимости на главной странице */
.home-page-header {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Для решения проблемы с z-index в секциях */
main section {
    position: relative;
    z-index: 1;
}

