/* ============================================================
   ШАПКА + ГЛАВНОЕ МЕНЮ (header-3) — Bootstrap 5.2.3
   Подключать ПОСЛЕ bootstrap.css (или вставить в конец style.css).
   Структура:
     1) Верхняя строка .header-info  -> логотип (слева) + контакты
     2) Нижняя строка  .header-3-info1 -> меню (по центру)
   ============================================================ */

.header-section-h3 {
  --menu-accent: #00abff;
  --menu-accent-soft: rgba(0, 171, 255, .10);
  --menu-text: #1f2d3d;
  background: #fff;
  box-shadow: 0 6px 18px rgba(4, 154, 229, .06);
}

/* ============================================================
   1) ВЕРХНЯЯ СТРОКА: логотип + контакты
   ============================================================ */
#header-3 .header-info {
  padding-top: 14px;
  padding-bottom: 14px;
  border-top: 0;
  background: #eff2f4;
}
.header-section-h3 .header-info > .container-fluid {
  padding-left: clamp(16px, 3vw, 50px);
  padding-right: clamp(16px, 3vw, 50px);
}

/* Ряд: логотип слева + контакты справа, выровнены по центру */
.header-section-h3 .header-top-row {
  display: flex;
  align-items: center;
  gap: 16px 24px;
  width: 100%;
}
.header-section-h3 .header-top-row .site-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
}
.header-section-h3 .header-top-row .site-logo img {
  max-height: 58px;
  width: auto;
}
.header-section-h3 .header-contacts {
  min-width: 0;
}
.header-section-h3 .header-contacts .row {
  align-items: center;
}

/* Десктоп (lg+): логотип и все контакты строго в одну линию */
@media (min-width: 992px) {
  .header-section-h3 .header-top-row {
    flex-wrap: nowrap;
  }
  .header-section-h3 .header-contacts {
    flex: 1 1 0;
  }
  .header-section-h3 .header-contacts .row {
    flex-wrap: nowrap;
    margin-left: 0;
    margin-right: 0;
  }
  /* колонки могут ужиматься (текст переносится) -> не ломают одну линию */
  .header-section-h3 .header-contacts .row > [class*="col"] {
    min-width: 0;
  }
}

/* Планшет/мобильный (< lg): логотип сверху, контакты ниже */
@media (max-width: 991.98px) {
  .header-section-h3 .header-top-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .header-section-h3 .header-contacts {
    width: 100%;
  }
}

/* Контактные элементы (выравниваем по размеру/высоте) */
.header-section-h3 .hi-item {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}
.header-section-h3 .hi-item .hs-icon {
  float: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
}
.header-section-h3 .hi-item .hi-content {
  padding-left: 0;
}
.header-section-h3 .hi-item .hi-content h6 {
  font-size: 15px;
  line-height: 1.25;
}
.header-section-h3 .hi-item .hi-content p {
  font-size: 13px;
}
#header-3 .hi-item .hs-icon i {
  font-size: 30px;   /* чуть компактнее, чтобы строка была ровнее */
}

/* ============================================================
   2) НИЖНЯЯ СТРОКА: меню
   ============================================================ */
.header-section-h3 .header-3-info1 {
  padding: 4px 0;
  background: #fff;
}
.header-section-h3 .header-3-info1 > .container-fluid {
  padding-left: clamp(16px, 3vw, 50px);
  padding-right: clamp(16px, 3vw, 50px);
}
.header-section-h3 .header-3-info1-div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  margin: 0;
}

/* Десктоп: меню по центру */
@media (min-width: 768px) {
  .header-section-h3 .header-3-info1-div {
    justify-content: center;
  }
  .header-section-h3 .navbar-collapse {
    flex-grow: 1;
    justify-content: center;
  }
  .header-section-h3 .navbar-nav {
    align-items: center;
    gap: 2px;
    margin-left: auto;    /* надёжное центрирование списка */
    margin-right: auto;
  }
}

/* ---- Пункт меню ---- */
.header-section-h3 .navbar-nav .nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--menu-text);
  text-align: center;
  white-space: normal;
  border-radius: 9px;
  transition: color .2s ease, background-color .2s ease;
}
.header-section-h3 .navbar-nav .nav-link:hover,
.header-section-h3 .navbar-nav .nav-link:focus {
  color: var(--menu-accent);
  background-color: rgba(0, 171, 255, .08);
}
.header-section-h3 .navbar-nav .nav-link:focus-visible {
  outline: 2px solid var(--menu-accent);
  outline-offset: 2px;
}
.header-section-h3 .navbar-nav .nav-item.active > .nav-link {
  color: #fff;
  background-color: var(--menu-accent);
}

/* Каретка у пунктов с подменю (десктоп) */
.header-section-h3 .navbar-nav .dropdown-toggle::after {
  display: inline-block;
  margin-left: 0;
  vertical-align: 1px;
  border-top: .34em solid currentColor;
  border-right: .34em solid transparent;
  border-left: .34em solid transparent;
  border-bottom: 0;
  transition: transform .2s ease;
}
.header-section-h3 .navbar-nav .dropdown:hover > .dropdown-toggle::after {
  transform: rotate(180deg);
}

/* ---- Выпадающая карточка ---- */
.header-section-h3 .navbar-nav .dropdown-menu {
  margin: 0;
  padding: 8px 0;
  min-width: 240px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(4, 154, 229, .18), 0 2px 6px rgba(0, 0, 0, .04);
}
.header-section-h3 .navbar-nav .dropdown-menu .dropdown-item {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--menu-text);
  white-space: normal;
  transition: background-color .15s ease, color .15s ease, padding-left .15s ease;
}
.header-section-h3 .navbar-nav .dropdown-menu .dropdown-item:hover,
.header-section-h3 .navbar-nav .dropdown-menu .dropdown-item:focus,
.header-section-h3 .navbar-nav .dropdown-menu .dropdown-item.active {
  background-color: var(--menu-accent-soft);
  color: var(--menu-accent);
  padding-left: 24px;
}
.header-section-h3 .navbar-nav .dropdown-menu .dropdown-item:focus-visible {
  outline: 2px solid var(--menu-accent);
  outline-offset: -2px;
}

/* Десктоп: раскрытие по наведению + отступ от пункта + «мостик» */
@media (min-width: 768px) {
  .header-section-h3 .navbar-nav .dropdown > .dropdown-menu {
    display: block;
    margin-top: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  }
  .header-section-h3 .navbar-nav .dropdown > .dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
  }
  .header-section-h3 .navbar-nav .dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* ---- Кнопка раскрытия подменю (только мобильный) ---- */
.header-section-h3 .submenu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  margin-left: auto;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--menu-text);
  cursor: pointer;
}
.header-section-h3 .submenu-toggle:hover {
  background: rgba(0, 171, 255, .08);
  color: var(--menu-accent);
}
.header-section-h3 .submenu-toggle__icon {
  display: block;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.header-section-h3 .nav-item.open > .submenu-toggle .submenu-toggle__icon {
  transform: rotate(-135deg);
}

/* Метка у бургера (видна только на мобильном) */
.header-section-h3 .navbar-toggler-label {
  margin-left: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--menu-text);
}

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ (< 768px)
   ============================================================ */
@media (max-width: 767.98px) {
  /* Бургер — крупная понятная кнопка на всю ширину */
  .header-section-h3 .header-3-info1-div {
    justify-content: stretch;
  }
  .header-section-h3 .navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 171, 255, .35);
    background: rgba(0, 171, 255, .04);
  }
  .header-section-h3 .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(0, 171, 255, .25);
  }

  /* Панель меню */
  .header-section-h3 .navbar-collapse {
    margin-top: 10px;
    padding: 8px;
    border-radius: 14px;
    background: #f7fafc;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
    max-height: 75vh;
    overflow-y: auto;
  }
  .header-section-h3 .navbar-nav {
    width: 100%;
    gap: 2px;
  }

  /* Пункт = строка: ссылка слева, кнопка-стрелка справа */
  .header-section-h3 .nav-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    border-radius: 10px;
  }
  .header-section-h3 .nav-item .nav-link {
    flex: 1 1 auto;
    justify-content: flex-start;
    text-align: left;
    padding: 12px 14px;
  }
  .header-section-h3 .navbar-nav .dropdown-toggle::after {
    display: none;   /* на мобильном стрелку рисует кнопка */
  }

  /* Подменю свёрнуто по умолчанию, раскрывается по .open */
  .header-section-h3 .nav-item.dropdown > .dropdown-menu {
    display: none;
    flex-basis: 100%;
    width: 100%;
    position: static;
    margin: 2px 0 6px;
    padding: 4px 0 4px 12px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-left: 2px solid rgba(0, 171, 255, .25);
  }
  .header-section-h3 .nav-item.dropdown.open > .dropdown-menu {
    display: block;
  }
  .header-section-h3 .nav-item.dropdown.open {
    background: rgba(0, 171, 255, .05);
  }
  .header-section-h3 .navbar-nav .dropdown-menu .dropdown-item:hover,
  .header-section-h3 .navbar-nav .dropdown-menu .dropdown-item:focus,
  .header-section-h3 .navbar-nav .dropdown-menu .dropdown-item.active {
    padding-left: 16px;
  }
}