/* Сброс стилей и базовые настройки */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background-color: #dddddd;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Хедер */
header {
  background-color: #004a99;
  color: white;
  padding: 10px 20px 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.logo {
  margin-top: 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
}

.logo img {
  max-height: 80px;
  width: auto;
  display: block;
  margin: 0 auto;
  position: relative;
  top: 10px;
}

.site-subtitle {
  font-size: 0.8rem;
  color: white;
  margin-top: 20px;
  line-height: 1.2;
  text-align: center;
}

.site-subtitle .second-line {
  display: inline-block;
}

/* Второстепенное меню */
.secondary-menu {
  position: absolute;
  top: 20px;
  left: 230px;
  font-size: 0.9em;
}

.secondary-menu ul {
  display: flex;
  gap: 10px;
  list-style: none;
  align-items: center; /* выравниваем все элементы по центру */
}

.secondary-menu li {
  position: relative;
}

/* Второстепенное меню: ссылки и кнопка Партнёры одинакового размера */
.secondary-menu li a,
.secondary-menu li .dropdown-btn {
  color: white;
  text-decoration: none;
  padding: 6px 12px; /* одинаковые отступы */
  border-radius: 4px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  font-weight: 500;
  font-size: 0.9em;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-menu li a:hover,
.secondary-menu li .dropdown-btn:hover {
  background-color: #0074d9;
  box-shadow: 0 0 10px #0074d9;
}

/* Выпадающее меню Партнёры */
.secondary-menu li .dropdown-btn {
  min-width: 120px;
}

.secondary-menu li .dropdown-btn::after {
  content: '▼';
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.3s ease;
  font-size: 0.7em;
}

.secondary-menu li.open .dropdown-btn::after {
  transform: rotate(180deg);
}

/* Выпадающее меню Партнёры */
.dropdown-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #005bb5;
  border-radius: 4px;
  flex-direction: column;
  min-width: 200px;   /* минимальная ширина меню */
  width: 100%;        /* растягиваем под ширину dropdown */
  z-index: 1000;
  padding: 0;
  display: flex;
}

/* Ссылки внутри выпадающего меню */
.dropdown-content li a {
  display: block;
  width: 100%;        /* ссылка занимает всю ширину пункта */
  padding: 6px 12px;
  font-weight: 500;
  color: white;
  text-decoration: none;
  font-size: 0.9em;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  text-align: center; /* выравниваем текст */
  white-space: normal;
}

.dropdown-content li {
  width: 100%; /* каждый пункт занимает всю ширину */
}

.dropdown-content li a:hover {
  background-color: #0074d9;
}

/* Выпадающее меню открывается при наведении */
.secondary-menu li.dropdown:hover .dropdown-content {
  max-height: 1000px; /* достаточно для всех пунктов */
  padding: 5px 0;
}

/* Подсветка кнопки "Партнёры" при открытом меню */
.secondary-menu li.dropdown:hover .dropdown-btn {
  background-color: #0074d9;
  box-shadow: 0 0 10px #0074d9;
}

.secondary-menu li.dropdown:hover .dropdown-btn::after {
  transform: rotate(180deg);
}

/* Контакты в хедере */
.header-contacts {
  position: absolute;
  top: 20px;
  left: 900px;
  display: flex;
  gap: 40px;
  font-size: 0.85rem;
  line-height: 1.4;
  font-weight: 500;
}

.header-contacts a {
  color: white;
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease, transform 0.3s ease;
}

.header-contacts a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background-color: #a8d1ff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.header-contacts a:hover,
.header-contacts a:focus {
  color: #a8d1ff;
  transform: translateY(-2px);
}

.header-contacts a:hover::after,
.header-contacts a:focus::after {
  transform: scaleX(1);
}

/* Основное меню */
#navMenu {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  height: 0;
  transition: height 0.3s ease;
  background-color: #004a99;
  margin-top: 10px;
}

#navMenu ul {
  list-style: none;
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
  justify-content: center;
}

#navMenu ul li a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
  transition: color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

#navMenu ul li a:hover,
#navMenu ul li a:focus {
  background-color: #0074d9;
  box-shadow: 0 0 15px #0074d9;
}

/* Футер */
footer {
  background-color: #004a99;
  color: white;
  padding: 30px 20px;
  font-size: 0.9rem;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 200px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-column {
  flex: 1 1 250px;
  min-width: 220px;
}

.footer-column p {
  margin-bottom: 12px;
  line-height: 1.5;
}

.contacts-phones p {
  display: flex;
  align-items: center;
  white-space: nowrap;
  gap: 6px;
  margin-bottom: 12px;
}

.contacts-phones a,
.office-info a {
  color: white;
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease, transform 0.3s ease;
}

.contacts-phones a::after,
.office-info a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background-color: #a8d1ff;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.contacts-phones a:hover,
.office-info a:hover {
  color: #a8d1ff;
  transform: translateY(-2px);
}

.contacts-phones a:hover::after,
.office-info a:hover::after {
  transform: scaleX(1);
}

/* Навигация футера */
.footer-nav a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.footer-nav a:hover {
  color: #a8d1ff;
}

.footer-nav ul {
  list-style: none;
}

.footer-column.footer-nav ul li {
  margin-bottom: 15px;
}

/* Кнопка меню */
.menu-toggle {
  display: none;
  font-size: 32px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
}

/* Адаптивность */
@media (max-width: 768px) {
  .logo {
    margin-left: auto;
    margin-right: auto;
  }

  .secondary-menu {
    position: static;
    font-size: 0.9rem;
    margin: 20px 0;
  }

  .secondary-menu ul {
    justify-content: center;
    flex-wrap: wrap;
  }

  .header-contacts {
    position: static;
    flex-direction: column;
    text-align: center;
    gap: 10px;
    width: 100%;
  }

  .secondary-menu li.dropdown .dropdown-content {
    display: block !important;   /* сбрасываем flex */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #005bb5;
    border-radius: 4px;
    width: 100%;
    padding: 0;
    z-index: 1000;
  }

/* Отключаем hover для мобильных */
  .secondary-menu li.dropdown:hover .dropdown-content {
    max-height: 0;
    padding: 0;
  }
  
  .secondary-menu li.dropdown:hover .dropdown-btn {
    background-color: inherit;
    box-shadow: none;
  }
  
  /* Стили для открытого dropdown через JS */
  .secondary-menu li.dropdown.open .dropdown-content {
    max-height: 1000px;
    padding: 5px 0;
  }

  .secondary-menu li.dropdown.open .dropdown-btn {
    background-color: #0074d9;
    box-shadow: 0 0 10px #0074d9;
  }
  
  .secondary-menu li.dropdown.open .dropdown-btn::after {
    transform: rotate(180deg);
  }

  .secondary-menu li.dropdown .dropdown-content {
    width: max-content;
    min-width: 100%; /* чтобы не было уже, чем кнопка */
  }

  .secondary-menu li.dropdown .dropdown-content li a {
    display: block;
    width: 100%;
    padding: 12px 15px;
    text-align: center;
    white-space: normal;
  }

  .menu-toggle {
    display: block;
    margin: 10px auto;
  }

  #navMenu {
    display: block;
    background-color: #004a99;
    width: 100%;
  }

  #navMenu ul {
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  #navMenu li {
    list-style: none;
    width: 100%;
    margin: 8px 0;
  }

  #navMenu a {
    display: block;
    width: 100%;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    color: #fff;
  }

  #navMenu a:hover {
    background-color: #0066cc;
  }

  .dropdown-content {
    position: relative;
    top: 0;
    left: 0;
    min-width: 100%; /* подстраиваем под ширину контейнера */
    border-radius: 0;
  }

  .footer-container {
    gap: 15px;
    padding: 0 15px;
  }

  .footer-column {
    flex: 1 1 30%;
    min-width: 150px;
  }

  .contacts-phones p {
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
    gap: 2px;
  }
}

@media (max-width: 400px) {
  #navMenu ul li a {
    font-size: 14px;
    padding: 8px 10px;
  }
}

@media (min-width: 769px) {
  #navMenu {
    height: auto !important;
    overflow: visible !important;
  }
}
