/**
 * Header / навигационное меню — стилизация поверх webpack-бандла.
 *
 * Подключается через registerCssFile в frontend/views/layouts/main.php,
 * грузится ПОСЛЕ webpack-бандла и перекрывает базовые стили из
 * frontend/webpack/styles/layout/_header.scss.
 *
 * Дизайн-принципы:
 *  - Top-level меню — без иконок, крупные uppercase-буквы, расширенный
 *    letter-spacing для премиального ощущения.
 *  - Главная коммерческая категория — «Программы» — содержит цены
 *    в dropdown, создавая коммерческий импульс прямо в меню.
 *  - «Пробные погружения» — главный продукт, имеет badge «ПОПУЛЯРНО»
 *    и подложку (которая не теряется на hover).
 *  - «Написать» — выделенная зелёная WhatsApp-кнопка как CTA.
 *  - Dropdown «Написать» — сетка карточек с большими иконками,
 *    подписями (телефон / ник) и фирменными цветами.
 */

/* ============================================================
   1. Шрифты top-level — крупнее и эффектнее
   ============================================================ */

header.fixed-top {
    font-size: 14px;
}

header.fixed-top .navbar-collapse ul.navbar-nav > li > a {
    font-size: 15px;
    letter-spacing: 0.02em;
}

@media (max-width: 1199.98px) {
    /* На мобильном чуть крупнее — тапабельность. */
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a {
        font-size: 16px;
        padding: 6px 0;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    header.fixed-top {
        min-height: 0;
    }
    header.fixed-top .navbar {
        min-height: 0;
        align-items: center;
        padding: 14px 0;
    }
    header.fixed-top .navbar-brand {
        margin-right: auto;
    }
    header.fixed-top .navbar-toggler {
        margin-left: auto;
    }
}

/* ============================================================
   2. Заголовки колонок в dropdown «Программы»
   ============================================================ */

@media (min-width: 1200px) {
    header.fixed-top #navbarDropdownDiving + .dropdown-menu.show > .dropdown {
        padding: 0 18px;
        border-left: 1px solid rgba(10, 58, 94, 0.14);
    }
    header.fixed-top #navbarDropdownDiving + .dropdown-menu.show > .dropdown:first-child {
        border-left: 0;
    }
    header.fixed-top .dropdown-menu .dropdown-toggle {
        font-size: 13px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #6b5500;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    }
}

@media (max-width: 1199.98px) {
    header.fixed-top .navbar-nav > li.dropdown > .dropdown-menu.show {
        display: block !important;
        width: auto !important;
        margin: 0 !important;
        left: auto !important;
        right: auto !important;
        box-shadow: none;
    }
    header.fixed-top .dropdown-menu > .dropdown {
        display: block !important;
        width: auto !important;
    }
    header.fixed-top .dropdown-menu .dropdown-menu {
        position: relative;
        display: none;
    }
    header.fixed-top .dropdown-menu .dropdown-menu.show {
        display: block;
    }
    header.fixed-top .dropdown-menu > .dropdown {
        margin: 10px 0 14px;
    }
    header.fixed-top .dropdown-menu > .dropdown > a.dropdown-item.dropdown-toggle {
        display: inline-flex;
        align-items: center;
        width: auto;
        margin: 0 0 8px;
        padding: 8px 12px;
        border: 1px solid rgba(10, 58, 94, 0.16);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.22);
        color: #0a3a5e;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.2;
    }
    header.fixed-top .dropdown-menu > .dropdown > a.dropdown-item.dropdown-toggle:hover,
    header.fixed-top .dropdown-menu > .dropdown > a.dropdown-item.dropdown-toggle:focus {
        background: rgba(255, 255, 255, 0.35);
        color: #0a3a5e;
    }
    header.fixed-top .dropdown-menu > .dropdown > .dropdown-submenu {
        margin-top: 0;
    }
}

/* ============================================================
   3. Пункты dropdown «Программы» — крупнее, с цветной полосой
       слева при ховере
   ============================================================ */

header.fixed-top .dropdown-menu .dropdown-menu .dropdown-item {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 8px;
    row-gap: 4px;
    font-size: 16px;
    padding: 10px 14px;
    line-height: 1.4;
    border-radius: 6px;
    transition: background-color 150ms, padding-left 200ms;
}

/* Hover пунктов dropdown — лёгкая подложка + сдвиг текста вправо. */
header.fixed-top .dropdown-menu .dropdown-menu .dropdown-item:hover,
header.fixed-top .dropdown-menu .dropdown-menu .dropdown-item:focus {
    background: rgba(255, 255, 255, 0.55);
    padding-left: 20px;
}

/* Цветная полоса слева при ховере — индикатор активности. */
header.fixed-top .dropdown-menu .dropdown-menu .dropdown-item::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    width: 3px;
    height: 0;
    background: #0a3a5e;
    border-radius: 2px;
    transform: translateY(-50%);
    transition: height 200ms;
}
header.fixed-top .dropdown-menu .dropdown-menu .dropdown-item:hover::before,
header.fixed-top .dropdown-menu .dropdown-menu .dropdown-item:focus::before {
    height: 60%;
}

/* ============================================================
   4. Цены в пунктах dropdown — pill справа
   ============================================================ */

header.fixed-top .dropdown-item .menu-price {
    display: inline-block;
    margin-left: auto;
    padding: 3px 10px;
    background: rgba(10, 58, 94, 0.12);
    color: #0a3a5e;
    font-weight: 700;
    font-size: 13px;
    border-radius: 12px;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.4;
    flex-shrink: 0;
    transition: background-color 160ms, color 160ms, transform 160ms, box-shadow 160ms;
}

header.fixed-top .dropdown-item:hover .menu-price,
header.fixed-top .dropdown-item:focus .menu-price {
    background: #0a3a5e;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(10, 58, 94, 0.18);
}

@media (min-width: 1200px) {
    header.fixed-top #navbarDropdownDiving + .dropdown-menu .dropdown-menu .dropdown-item {
        min-height: 44px;
        padding-right: 112px;
    }
    header.fixed-top #navbarDropdownDiving + .dropdown-menu .dropdown-menu .dropdown-item .menu-price {
        position: absolute;
        top: 50%;
        right: 14px;
        margin-left: 0;
        transform: translateY(-50%);
        z-index: 1;
    }
    header.fixed-top #navbarDropdownDiving + .dropdown-menu .dropdown-menu .dropdown-item:hover .menu-price,
    header.fixed-top #navbarDropdownDiving + .dropdown-menu .dropdown-menu .dropdown-item:focus .menu-price {
        transform: translateY(calc(-50% - 1px));
    }
}

/* ============================================================
   5. Подсветка активного пункта меню
   ============================================================ */

header.fixed-top .navbar-nav > li.active > a,
header.fixed-top .navbar-nav > li.active > a:hover,
header.fixed-top .navbar-nav > li.active > a:focus {
    color: #0a3a5e;
}

@media (min-width: 1200px) {
    header.fixed-top .navbar-nav > li.active > a {
        position: relative;
    }
    header.fixed-top .navbar-nav > li.active > a::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 8px;
        height: 3px;
        background: #0a3a5e;
        border-radius: 2px;
    }
}

/* ============================================================
   6. Hover-эффект top-level — анимированный underline
   ============================================================ */

@media (min-width: 1200px) {
    header.fixed-top .navbar-nav > li > a {
        position: relative;
    }
    header.fixed-top .navbar-nav > li > a::before {
        content: '';
        position: absolute;
        left: 50%;
        right: 50%;
        bottom: 8px;
        height: 2px;
        background: #0a3a5e;
        transition: left 220ms ease, right 220ms ease, opacity 220ms ease;
        opacity: 0;
    }
    header.fixed-top .navbar-nav > li:not(.active) > a:hover::before {
        left: 0;
        right: 0;
        opacity: 0.6;
    }
}

/* ============================================================
   7. «Пробные погружения» — главный продукт, с бейджем «ПОПУЛЯРНО»
       webpack-стиль .dropdown-item:hover { background: none } имеет
       такую же специфичность, как наши селекторы для featured,
       и при обычных правилах CSS — проигрывает порядок. Используем
       !important для надёжной победы.
   ============================================================ */

header.fixed-top a.menu-featured,
header.fixed-top a.menu-featured:focus {
    font-weight: 700;
    color: #0a3a5e !important;
    background: rgba(255, 255, 255, 0.5) !important;
}
header.fixed-top a.menu-featured:hover {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #0a3a5e !important;
    padding-left: 20px;
}

/* У featured также цветная полоса слева — постоянная, не только hover. */
header.fixed-top .dropdown-menu .dropdown-menu a.dropdown-item.menu-featured::before {
    height: 70%;
    background: #ff5a36;
}

/* Badge «ПОПУЛЯРНО» как ::after. */
header.fixed-top a.menu-featured::after {
    content: 'ПОПУЛЯРНО';
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    background: #ff5a36;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: 10px;
    vertical-align: middle;
    line-height: 1.5;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(255, 90, 54, 0.4);
}

/* ============================================================
   8. CTA-кнопка «Написать» — зелёная WhatsApp-кнопка
   ============================================================ */

@media (min-width: 1200px) {
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta {
        background: #25D366;
        color: #fff;
        padding: 0 22px;
        border-radius: 26px;
        line-height: 46px;
        margin-top: 17px;
        margin-left: 16px;
        font-weight: 700;
        font-size: 15px;
        letter-spacing: 0.06em;
        box-shadow: 0 3px 12px rgba(37, 211, 102, 0.4);
        transition: background-color 200ms, transform 120ms, box-shadow 200ms;
    }
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta:hover,
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta:focus {
        background: #1eb858;
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 5px 18px rgba(37, 211, 102, 0.5);
    }
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta > .fab {
        margin-right: 8px;
        font-size: 1.2em;
        vertical-align: middle;
    }
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta > .menu-cta__text {
        vertical-align: middle;
    }
    /* Никаких underline-эффектов на CTA. */
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta::before,
    header.fixed-top .navbar-nav > li.active > a.menu-cta::after {
        display: none;
    }
}

/* ============================================================
   9. Dropdown «Написать» — карточки каналов с фирменными цветами
   ============================================================ */

@media (min-width: 1200px) {
    /* Контактный dropdown не трогает остальные меню: только меню с
       классом .menu-contact-dropdown. Главное — перебить Bootstrap
       .dropdown-item { display:block; width:100%; } точечно здесь. */
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show,
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show {
        display: block !important;
        padding: 18px !important;
        width: calc(100% - 120px) !important;
        max-width: none !important;
        left: 60px !important;
        right: auto !important;
        margin: 0 !important;
        font-size: 0;
        white-space: normal;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > li,
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > li {
        display: inline-block !important;
        width: calc(25% - 11px) !important;
        margin: 0 14px 0 0;
        padding: 0;
        vertical-align: top;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > li:nth-child(4n),
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > li:nth-child(4n) {
        margin-right: 0;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > a.dropdown-item.contact-card,
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > a.dropdown-item.contact-card {
        width: calc(25% - 11px) !important;
        margin: 0 14px 0 0;
        vertical-align: top;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > a.dropdown-item.contact-card:nth-child(4n),
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > a.dropdown-item.contact-card:nth-child(4n) {
        margin-right: 0;
    }
}

/* Карточка канала связи: иконка слева крупная, справа название + контакт.
   На десктопе flex-direction: row. На мобильном тоже row, но компактнее. */
header.fixed-top .dropdown-menu.menu-contact-dropdown a.dropdown-item.contact-card,
header.fixed-top #navbarDropdownContact + .dropdown-menu a.dropdown-item.contact-card {
    display: inline-flex !important;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.55);
    transition: background-color 180ms, transform 120ms;
    white-space: normal;
    height: 100%;
    min-height: 92px;
    box-sizing: border-box;
    font-size: 16px;
}
header.fixed-top .dropdown-menu.menu-contact-dropdown > li > a.dropdown-item.contact-card,
header.fixed-top #navbarDropdownContact + .dropdown-menu > li > a.dropdown-item.contact-card {
    width: 100% !important;
}
header.fixed-top .dropdown-menu.menu-contact-dropdown a.dropdown-item.contact-card::before,
header.fixed-top #navbarDropdownContact + .dropdown-menu a.dropdown-item.contact-card::before {
    display: none;
}
header.fixed-top .dropdown-menu.menu-contact-dropdown a.dropdown-item.contact-card:hover,
header.fixed-top .dropdown-menu.menu-contact-dropdown a.dropdown-item.contact-card:focus,
header.fixed-top #navbarDropdownContact + .dropdown-menu a.dropdown-item.contact-card:hover,
header.fixed-top #navbarDropdownContact + .dropdown-menu a.dropdown-item.contact-card:focus {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-1px);
    padding-left: 18px;
}

/* Иконка-кружок 44x44 */
.contact-card__icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(10, 58, 94, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #0a3a5e;
}
.contact-card__body {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}
.contact-card__title {
    font-size: 16px;
    font-weight: 700;
    color: #0a3a5e;
}
.contact-card__sub {
    font-size: 13px;
    color: #5b6b7a;
    margin-top: 2px;
    word-break: break-word;
}

/* Фирменные цвета каналов */
.contact-card--wa .contact-card__icon {
    background: rgba(37, 211, 102, 0.18);
    color: #1eb858;
}
.contact-card--tg .contact-card__icon {
    background: rgba(0, 136, 204, 0.18);
    color: #0088CC;
}
.contact-card--call .contact-card__icon {
    background: rgba(10, 58, 94, 0.15);
    color: #0a3a5e;
}
.contact-card--all .contact-card__icon {
    background: rgba(254, 198, 8, 0.25);
    color: #6b5500;
}

/* На мобильном — компактная сетка 2x2, чтобы меню не превращалось
   в длинную вертикальную простыню. */
@media (max-width: 1199.98px) {
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding-right: 0;
    }
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta > .fab {
        display: none;
    }
    header.fixed-top .navbar-collapse ul.navbar-nav > li > a.menu-cta::before {
        display: none !important;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show,
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show {
        display: block !important;
        padding: 10px 0 4px !important;
        font-size: 0;
        white-space: normal;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > li,
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > li {
        display: inline-block !important;
        width: calc(50% - 5px) !important;
        margin: 0 10px 10px 0;
        vertical-align: top;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > li:nth-child(2n),
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > li:nth-child(2n) {
        margin-right: 0;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > a.dropdown-item.contact-card,
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > a.dropdown-item.contact-card {
        display: inline-flex !important;
        width: calc(50% - 5px) !important;
        margin: 0 10px 10px 0;
        vertical-align: top;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown.show > a.dropdown-item.contact-card:nth-child(2n),
    header.fixed-top #navbarDropdownContact + .dropdown-menu.show > a.dropdown-item.contact-card:nth-child(2n) {
        margin-right: 0;
    }
    header.fixed-top .dropdown-menu.menu-contact-dropdown a.dropdown-item.contact-card,
    header.fixed-top #navbarDropdownContact + .dropdown-menu a.dropdown-item.contact-card {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100% !important;
        min-height: 118px;
        padding: 12px;
        margin-bottom: 0;
        border-radius: 9px;
    }
    .contact-card__icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        font-size: 17px;
    }
    .contact-card__title {
        font-size: 15px;
    }
    .contact-card__sub {
        font-size: 12px;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }
}
