/**
 * Шапка и меню — новая версия.
 * Префикс ng-hdr- / ng-mobile- / ng-phone-, чтобы не пересекаться со старыми
 * правилами в custom.css.
 */

:root {
    --ng-hdr-bg: #0d3c63;
    --ng-hdr-text: #ffffff;
    --ng-hdr-height: 72px;
    --ng-hdr-height-mobile: 64px;
    --ng-panel-text: #0d3c63;
    --ng-panel-accent: #c8382f;
    --ng-panel-accent-hover: #ec6830;
}

/* ─── Гашение старой шапки ─────────────────────────────────────────────── */

.site-header .top-bar,
.site-header > .navbar {
    display: none !important;
}

/* ─── Каркас ───────────────────────────────────────────────────────────── */

.ng-hdr {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1050;
    background: var(--ng-hdr-bg);
}

/* Компенсация высоты фиксированной шапки */
body {
    padding-top: var(--ng-hdr-height);
}

@media (max-width: 991.98px) {
    body {
        padding-top: var(--ng-hdr-height-mobile);
    }
}

/* Админ-бар WordPress для авторизованных */
.admin-bar .ng-hdr { top: 32px; }

@media screen and (max-width: 782px) {
    .admin-bar .ng-hdr { top: 46px; }
}

.ng-hdr__bar {
    background: var(--ng-hdr-bg);
    position: relative;
    z-index: 2;
}

.ng-hdr__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--ng-hdr-height);
    position: relative;
    padding: 0 40px;
}

/* ─── Триггеры панелей ─────────────────────────────────────────────────── */

.ng-hdr__triggers {
    display: flex;
    align-items: center;
    gap: 28px;
    flex: 0 0 auto;
}

.ng-hdr__trigger {
    background: transparent;
    border: 0;
    padding: 6px 0;
    color: var(--ng-hdr-text);
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: .02em;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: opacity .2s ease;
    text-transform: uppercase;
}

.ng-hdr__trigger::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--ng-hdr-text);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .22s ease;
}

.ng-hdr__trigger:hover { opacity: .85; }

.ng-hdr__trigger.is-active::after { transform: scaleX(1); }

/* ─── Логотип ──────────────────────────────────────────────────────────── */

.ng-hdr__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
}

.ng-hdr__logo-img {
    height: 42px;
    width: auto;
    display: block;
}

/* ─── Правая часть ─────────────────────────────────────────────────────── */

.ng-hdr__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-left: auto;
}

.ng-hdr__contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
    margin-right: 6px;
}

.ng-hdr__phone {
    color: var(--ng-hdr-text);
    text-decoration: none;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.ng-hdr__phone:hover { color: var(--ng-hdr-text); opacity: .85; }

.ng-hdr__hours {
    color: rgba(255, 255, 255, .75);
    font-size: 12px;
    white-space: nowrap;
    text-transform: uppercase;
}

.ng-hdr__icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .45);
    background: transparent;
    color: var(--ng-hdr-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: background .2s ease, border-color .2s ease;
    padding: 0;
    flex: 0 0 auto;
}

.ng-hdr__icon:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .8);
    color: var(--ng-hdr-text);
}

.ng-hdr__icon--messenger { border-color: transparent; }
.ng-hdr__icon--messenger img { width: 26px; height: 26px; }

.ng-hdr__icon .favorites-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--ng-panel-accent);
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
}

/* Иконка «телефон» — только мобайл */
.ng-hdr__icon--phone { display: none; }
.ng-hdr__icon-state { display: inline-flex; }
.ng-hdr__icon-state--close { display: none; }
.ng-hdr__icon--phone.is-active .ng-hdr__icon-state--phone { display: none; }
.ng-hdr__icon--phone.is-active .ng-hdr__icon-state--close { display: inline-flex; }

/* ─── Бургер ───────────────────────────────────────────────────────────── */

.ng-hdr__burger {
    display: none;
    width: 44px;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .12);
    cursor: pointer;
    padding: 10px 11px;
    flex-direction: column;
    justify-content: space-between;
    flex: 0 0 auto;
}

.ng-hdr__burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}

.ng-hdr__burger.is-active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.ng-hdr__burger.is-active span:nth-child(2) { opacity: 0; }
.ng-hdr__burger.is-active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ─── Панели ───────────────────────────────────────────────────────────── */

.ng-hdr__panel-wrap { position: relative; }

.ng-hdr-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

.ng-hdr-panel[hidden] { display: none; }

.ng-hdr-panel__inner {
    background: #fff linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(13, 60, 99, 0.1) 100%);
    box-shadow: 0 18px 40px rgba(13, 60, 99, .18);
    padding: 38px 40px 42px;
    display: flex;
    gap: 48px;
    pointer-events: auto;
    /* Панель прижата к левому краю экрана, выравнена по контейнеру */
    padding-left: calc((100vw - min(100vw - 24px, 1320px)) / 2 + 12px);
    min-width: 640px;
    max-width: 52vw;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease;
}

.ng-hdr-panel.is-open .ng-hdr-panel__inner {
    opacity: 1;
    transform: translateY(0);
}

.ng-hdr-panel__inner--one-col { min-width: 480px; max-width: 40vw; }

.ng-hdr-panel__col { flex: 1 1 0; min-width: 0; }
.ng-hdr-panel__col--nodes { flex: 0 0 auto; min-width: 260px; }
.ng-hdr-panel__col--sub { flex: 1 1 auto; min-width: 220px; }

/* Список узлов */

.ng-hdr-nodes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ng-hdr-nodes__item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.ng-hdr-nodes__item:last-child { margin-bottom: 0; }

.ng-hdr-nodes__link {
    color: var(--ng-panel-text);
    text-decoration: none;
    font-size: 17px;
    line-height: 1.3;
    transition: color .18s ease;
}

.ng-hdr-nodes__link:hover { color: var(--ng-panel-accent); }

.ng-hdr-nodes__item.is-current > .ng-hdr-nodes__link { font-weight: 600; }

.ng-hdr-nodes__toggle {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(13, 60, 99, .28);
    border-radius: 50%;
    background: transparent;
    color: var(--ng-panel-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
    transition: background .18s ease, border-color .18s ease, transform .22s ease;
}

.ng-hdr-nodes__toggle:hover {
    background: rgba(13, 60, 99, .08);
    border-color: rgba(13, 60, 99, .5);
}

.ng-hdr-nodes__toggle[aria-expanded="true"] {
    background: var(--ng-panel-text);
    border-color: var(--ng-panel-text);
    color: #fff;
}

/* Подпункты (якоря) */

.ng-hdr-subs { margin-bottom: 0; }
.ng-hdr-subs:not(:empty) { margin-bottom: 0; }

.ng-hdr-sub {
    list-style: none;
    margin: 0 0 26px;
    padding: 0;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity .22s ease, transform .22s ease;
}

.ng-hdr-sub[hidden] { display: none; }
.ng-hdr-sub.is-visible { opacity: 1; transform: translateX(0); }

.ng-hdr-sub__caption {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(13, 60, 99, .5);
    margin-bottom: 12px;
}

.ng-hdr-sub__item { margin-bottom: 10px; }

.ng-hdr-sub__link {
    color: var(--ng-panel-text);
    text-decoration: none;
    font-size: 16px;
    transition: color .18s ease;
}

.ng-hdr-sub__link:hover { color: var(--ng-panel-accent); }

/* Выделенные пункты */

.ng-hdr-highlight {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ng-hdr-highlight__item { margin-bottom: 12px; }
.ng-hdr-highlight__item:last-child { margin-bottom: 0; }

.ng-hdr-highlight__link {
    display: inline-block;
    background: transparent;
    border: 1px solid rgba(13, 60, 99, .35);
    color: var(--ng-panel-text);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 18px;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.ng-hdr-highlight__link:hover {
    background: var(--ng-panel-accent-hover);
    border-color: var(--ng-panel-accent-hover);
    color: #fff;
}

/* Подложка под панелью */

.ng-hdr__backdrop {
    position: fixed;
    inset: var(--ng-hdr-height) 0 0 0;
    background: rgba(13, 60, 99, .35);
    opacity: 0;
    transition: opacity .22s ease;
    z-index: 0;
}

.ng-hdr__backdrop[hidden] { display: none; }
.ng-hdr__backdrop.is-visible { opacity: 1; }

/* ─── Мобильное меню ───────────────────────────────────────────────────── */

.ng-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 1100;
}

.ng-mobile-menu[hidden] { display: none; }

.ng-mobile-menu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 60, 99, .5);
    opacity: 0;
    transition: opacity .25s ease;
}

.ng-mobile-menu.is-open .ng-mobile-menu__backdrop { opacity: 1; }

.ng-mobile-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 420px);
    background: #fff linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(13, 60, 99, 0.1) 100%);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s ease;
}

.ng-mobile-menu.is-open .ng-mobile-menu__panel { transform: translateX(0); }

.ng-mobile-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    min-height: 58px;
    border-bottom: 1px solid rgba(13, 60, 99, .12);
}

.ng-mobile-menu__back,
.ng-mobile-menu__close {
    background: transparent;
    border: 0;
    color: var(--ng-panel-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
}

.ng-mobile-menu__back[hidden] { display: none; }
.ng-mobile-menu__close { margin-left: auto; }

.ng-mobile-menu__viewport {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
}

.ng-mobile-screen {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px;
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform .26s ease, opacity .2s ease, visibility .26s;
}

.ng-mobile-screen.is-active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.ng-mobile-screen.is-left {
    transform: translateX(-30%);
    opacity: 0;
    visibility: hidden;
}

.ng-mobile-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
}

.ng-mobile-list__item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(13, 60, 99, .1);
}

.ng-mobile-list__link {
    flex: 1 1 auto;
    color: var(--ng-panel-text);
    text-decoration: none;
    font-size: 17px;
    padding: 14px 0;
}

.ng-mobile-list__link--parent { font-weight: 600; }

/* Узел-группа с drill-down (Выбрать квартиру / Арендаторам) */
.ng-mobile-list__link--group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: var(--ng-panel-text);
    font-size: 17px;
    padding: 14px 0;
}

.ng-mobile-list__link--group svg { flex: 0 0 auto; }

.ng-mobile-list__toggle {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--ng-panel-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Стили аккордеонов больше не используются:
   «Выбрать квартиру» и «Арендаторам» переведены на drill-down. */

.ng-mobile-highlight {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
}

.ng-mobile-highlight__item { margin-bottom: 12px; }

.ng-mobile-highlight__link {
    display: inline-block;
    background: transparent;
    border: 1px solid rgba(13, 60, 99, .35);
    color: var(--ng-panel-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 18px;
}

.ng-mobile-contacts {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid rgba(13, 60, 99, .12);
}

.ng-mobile-contacts__phone {
    display: block;
    color: var(--ng-panel-text);
    text-decoration: none;
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ng-mobile-contacts__messengers { display: flex; gap: 12px; }

/* Иконка мессенджера белая — даём тёмную подложку, иначе сливается с фоном */
.ng-mobile-contacts__messenger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ng-panel-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}

.ng-mobile-contacts__messenger:hover { background: var(--ng-panel-accent-hover); }

/* ─── Плашка контактов (иконка телефона) ───────────────────────────────── */

.ng-phone-overlay {
    position: fixed;
    inset: var(--ng-hdr-height-mobile) 0 0 0;
    background: var(--ng-hdr-bg);
    z-index: 1040;
    opacity: 0;
    transition: opacity .22s ease;
}

.ng-phone-overlay[hidden] { display: none; }
.ng-phone-overlay.is-open { opacity: 1; }

.ng-phone-overlay__inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    padding: 24px;
    text-align: center;
}

.ng-phone-overlay__icon { opacity: .8; }
.ng-phone-overlay__icon img { filter: brightness(0) invert(1); }

.ng-phone-overlay__phone {
    color: #fff;
    text-decoration: none;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: .04em;
}

.ng-phone-overlay__hours { color: rgba(255, 255, 255, .7); font-size: 14px; }

.ng-phone-overlay__messengers { display: flex; gap: 16px; margin-top: 10px; }

/* ─── Блокировка прокрутки ─────────────────────────────────────────────── */

body.ng-scroll-locked { overflow: hidden; }

/* ─── Адаптив ──────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {

    .ng-hdr__container { min-height: var(--ng-hdr-height-mobile); }

    .ng-hdr__triggers,
    .ng-hdr__contacts,
    .ng-hdr__icon--messenger { display: none; }

    .ng-hdr-panel { display: none !important; }

    .ng-hdr__logo {
        position: static;
        transform: none;
        margin-right: auto;
    }

    .ng-hdr__logo-img { height: 34px; }

    .ng-hdr__icon--phone { display: inline-flex; }
    .ng-hdr__burger { display: flex; }

    .ng-hdr__actions { gap: 8px; }

    .ng-hdr__icon {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 400px) {
    .ng-hdr__actions { gap: 5px; }
    .ng-hdr__icon { width: 33px; height: 33px; }
    .ng-hdr__logo-img { height: 30px; }
}
