/* ============================================================
   header-l2.css — стили L1 -> L2 dropdown шапки сайта АПМО.
   Markdown-safe: используется только .menu (без ul.menu).
   ============================================================ */

.h-bottom-line__menu .has-l2-dropdown {
    position: relative;
}

.lk-l2-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 40;
    min-width: 320px;
    max-width: 720px;
    margin-top: 8px;
    padding: 12px;
    background: var(--lk-c-surface, #ffffff);
    border: 1px solid var(--lk-c-line, #e0e0e0);
    border-radius: var(--lk-r-md, 12px);
    box-shadow: var(--lk-sh-3, 0 12px 32px rgba(15, 23, 42, .14));
}

.lk-l2-grid--dropdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 8px;
}
@media (min-width: 1024px) {
    .lk-l2-grid--dropdown {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
}

.lk-l2-card--sm {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 12px 8px;
    text-align: center;
    background: var(--lk-c-surface, #ffffff);
    border: 1px solid var(--lk-c-line, #e0e0e0);
    border-radius: var(--lk-r-md, 12px);
    color: var(--lk-c-primary, #0051AC);
    text-decoration: none;
    transition: transform 180ms cubic-bezier(.2, .8, .2, 1),
                box-shadow 180ms cubic-bezier(.2, .8, .2, 1);
}
.lk-l2-card--sm:hover {
    transform: translateY(-2px);
    box-shadow: var(--lk-sh-2, 0 4px 12px rgba(15, 23, 42, .08));
    text-decoration: none;
    color: var(--lk-c-primary, #0051AC);
}

.lk-l2-card--sm .lk-l2-card__ico {
    width: 1.5rem;
    height: 1.5rem;
    margin-bottom: 4px;
    color: var(--lk-c-primary, #0051AC);
}
.lk-l2-card__ico--success { color: var(--lk-c-success, #15803D); }
.lk-l2-card__ico--warn    { color: var(--lk-c-warn, #B45309); }
.lk-l2-card__ico--danger  { color: var(--lk-c-danger, #B91C1C); }
.lk-l2-card__ico--info    { color: var(--lk-c-info, #1D4ED8); }
.lk-l2-card__ico--accent  { color: var(--lk-c-accent, #F59E0B); }

.lk-l2-card--sm .lk-l2-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: inherit;
}

.lk-l2-dropdown__all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding: 8px 12px;
    color: var(--lk-c-primary, #0051AC);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--lk-r-sm, 8px);
    transition: background-color 180ms;
}
.lk-l2-dropdown__all:hover {
    background: var(--lk-c-primary-50, #E8F0FB);
    color: var(--lk-c-primary, #0051AC);
    text-decoration: none;
}

.has-l2-dropdown > a > .lk-ico--chevron-down {
    transition: transform 180ms;
    margin-left: 4px;
}
.has-l2-dropdown > a[aria-expanded="true"] > .lk-ico--chevron-down {
    transform: rotate(180deg);
}

@media (max-width: 767px) {
    .h-bottom-line__menu .has-l2-dropdown {
        position: static;
    }
    .lk-l2-dropdown {
        position: static;
        min-width: 0;
        max-width: 100%;
        margin: 8px 0 0;
        box-shadow: none;
        border: none;
        background: var(--lk-c-surface-2, #f8fafc);
    }
    .lk-l2-grid--dropdown {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lk-l2-card--sm,
    .lk-l2-dropdown__all,
    .has-l2-dropdown > a > .lk-ico--chevron-down {
        transition: none;
    }
    .lk-l2-card--sm:hover { transform: none; }
}

/* === KEBAB overflow === */
.h-bottom-line__menu .menu .dd_menu {
    display: block;
}
.h-bottom-line__menu .menu .dd_menu[hidden] {
    display: none;
}
.h-bottom-line__menu .menu .dd_menu .dropdown-menu {
    display: none;
}

/* === В kebab-popup L2 = inline accordion === */
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown {
    position: static;
}
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown > .lk-l2-dropdown {
    position: static;
    min-width: 0;
    max-width: 100%;
    margin: 4px 0 8px;
    padding: 8px;
    box-shadow: none;
    border: 1px solid var(--lk-c-line, #e0e0e0);
    border-radius: 8px;
    background: var(--lk-c-surface-2, #f8fafc);
}
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown .lk-l2-grid--dropdown {
    grid-template-columns: 1fr;
    gap: 4px;
}
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown .lk-l2-card--sm {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    min-height: 40px;
    padding: 6px 10px;
    gap: 8px;
}
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown .lk-l2-card--sm .lk-l2-card__ico {
    margin-bottom: 0;
    width: 1.25rem;
    height: 1.25rem;
}
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown .lk-l2-card--sm .lk-l2-card__title {
    font-size: 13px;
    line-height: 1.3;
}
.h-bottom-line__menu .dropdown-menu .has-l2-dropdown .lk-l2-dropdown__all {
    font-size: 12px;
    padding: 4px 8px;
}

/* ============================================================
   MOBILE BURGER (<768px)
   ============================================================ */
@media (max-width: 767px) {
    /* Скрываем все обычные пункты L1 на мобиле — они идут в popup */
    .h-bottom-line__menu .menu > li.item {
        display: none;
    }

    /* Бургер - крупная видимая кнопка */
    .h-bottom-line__menu .menu .dd_menu {
        position: static;
        right: auto;
        margin-top: 0;
        margin-left: auto;
        float: none;
        display: block;
    }
    .h-bottom-line__menu .menu .dd_menu button.dropdown-toggle {
        width: 44px;
        height: 44px;
        padding: 10px 8px;
        background: transparent;
        border: 1px solid var(--lk-c-line, #e0e0e0);
        border-radius: var(--lk-r-sm, 8px);
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
    }
    .h-bottom-line__menu .menu .dd_menu button.dropdown-toggle span {
        display: block;
        width: 24px;
        height: 3px;
        border-radius: 0;
        margin: 0;
        background: var(--lk-c-ink, #272727);
        position: static;
    }

    /* Popup-меню на mobile — full-width drawer */
    .h-bottom-line__menu .menu .dd_menu .dropdown-menu {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        width: 100%;
        max-height: 80vh;
        overflow-y: auto;
        margin: 0;
        padding: 12px;
        background: var(--lk-c-surface, #ffffff);
        border: 1px solid var(--lk-c-line, #e0e0e0);
        border-radius: var(--lk-r-md, 12px);
        box-shadow: var(--lk-sh-3, 0 12px 32px rgba(15, 23, 42, .14));
        z-index: 100;
    }

    /* Пункты в mobile-popup — крупные, читаемые */
    .h-bottom-line__menu .dropdown-menu li.item {
        display: block;
        margin-bottom: 4px;
    }
    .h-bottom-line__menu .dropdown-menu li.item > a {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px;
        font-size: 16px;
        font-weight: 500;
        color: var(--lk-c-primary, #0051AC);
        text-decoration: none;
        border-radius: var(--lk-r-sm, 8px);
        min-height: 44px;
    }
    .h-bottom-line__menu .dropdown-menu li.item > a:hover {
        background: var(--lk-c-primary-50, #E8F0FB);
    }

    /* Контейнер шапки — позволяем relative для абсолютного popup'а */
    .h-bottom-line {
        position: relative;
    }
}

/* === Mobile: убрать паразитные border/outline/decoration у пунктов в popup === */
@media (max-width: 767px) {
    .h-bottom-line__menu .dropdown-menu li.item,
    .h-bottom-line__menu .dropdown-menu li.item:first-child,
    .h-bottom-line__menu .dropdown-menu li.item.selected,
    .h-bottom-line__menu .dropdown-menu li.item > a,
    .h-bottom-line__menu .dropdown-menu li.item.selected > a {
        border-left: none;
        border-right: none;
        border-top: none;
        outline: none;
        box-shadow: none;
        text-decoration: none;
    }
}

/* === FIX6: жёстко убираем text-decoration/border у пунктов mobile-popup === */
/* Bitrix.style_template.css ставит text-decoration:underline или border-bottom
   на .selected пункт. На мобиле это выглядит лишним. */
@media (max-width: 767px) {
    .h-bottom-line__menu .dropdown-menu li.item,
    .h-bottom-line__menu .dropdown-menu li.item > a,
    .h-bottom-line__menu .dropdown-menu li.item > a:hover,
    .h-bottom-line__menu .dropdown-menu li.item > a:focus,
    .h-bottom-line__menu .dropdown-menu li.item > a:active,
    .h-bottom-line__menu .dropdown-menu li.item > a:visited,
    .h-bottom-line__menu .dropdown-menu li.item.selected,
    .h-bottom-line__menu .dropdown-menu li.item.selected > a,
    .h-bottom-line__menu .dropdown-menu li.item.selected > a:hover {
        text-decoration: none !important;
        text-decoration-line: none !important;
        text-decoration-color: transparent !important;
        border: none !important;
        border-bottom: none !important;
        outline: none !important;
        box-shadow: none !important;
        background-image: none !important;
    }
}

/* === FIX7: убираем browser-default focus underline в mobile-popup === */
@media (max-width: 767px) {
    .h-bottom-line__menu .dropdown-menu li.item > a:focus,
    .h-bottom-line__menu .dropdown-menu li.item > a:focus-visible,
    .h-bottom-line__menu .dropdown-menu li.item > a:focus-within {
        outline: none !important;
        outline-offset: 0 !important;
        text-decoration: none !important;
        text-decoration-line: none !important;
        text-decoration-color: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }

    .h-bottom-line__menu .dropdown-menu li.item > a {
        -webkit-tap-highlight-color: transparent;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
}

/* === Скрываем переключатель языков RU|EN (был фиктивный, не работал) === */
/* Все возможные селекторы из header.php публичных шаблонов */
#lngs,
.h-top-line__right .lngs,
.top-right-corner__left.lngs,
.h-top-line__right > .lngs.d-flex {
    display: none !important;
}

/* ============================================================
   §13 HEADER POLISH — Primary CTA, Sticky, Search Icon, Padding
   ============================================================ */

/* --- 13.1 Sticky header --- */
.header.d-flex {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--lk-c-surface, #ffffff);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .06);
    transition: box-shadow 200ms;
}

/* --- 13.2 Primary CTA для кнопки "Личный кабинет" --- */
.top-right-corner__right.account .account__btn {
    background: var(--lk-c-primary, #0051AC);
    border: 1px solid var(--lk-c-primary, #0051AC);
    border-radius: var(--lk-r-md, 12px);
    padding: 10px 16px;
    box-shadow: var(--lk-sh-1, 0 1px 2px rgba(15, 23, 42, .06));
    transition: background-color 180ms cubic-bezier(.2, .8, .2, 1),
                transform 180ms cubic-bezier(.2, .8, .2, 1),
                box-shadow 180ms cubic-bezier(.2, .8, .2, 1);
}
.top-right-corner__right.account .account__btn:hover {
    background: var(--lk-c-primary-700, #003D80);
    border-color: var(--lk-c-primary-700, #003D80);
    transform: translateY(-1px);
    box-shadow: var(--lk-sh-2, 0 4px 12px rgba(15, 23, 42, .08));
}
.top-right-corner__right.account .account__btn a,
.top-right-corner__right.account .account__btn a:hover,
.top-right-corner__right.account .account__btn a:focus,
.top-right-corner__right.account .account__btn a:visited {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    text-decoration: none;
}
.top-right-corner__right.account .account__btn img {
    filter: brightness(0) invert(1);
    width: 18px;
    height: 18px;
}
.top-right-corner__right.account .account__btn .accont__btn-text {
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
}

/* --- 13.3 Иконка поиска — PNG → SVG-mask --- */
.h-bottom-line__search #search-button img,
.header__search-panel #search-button img,
.dropdown-search-on img {
    display: none !important;
}
.h-bottom-line__search #search-button::before,
.header__search-panel #search-button::before,
.dropdown-search-on::before {
    content: "";
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: middle;
    background-color: var(--lk-c-primary, #0051AC);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/></svg>") center / contain no-repeat;
}

/* --- 13.4 Больший padding --- */
.h-top-line { padding-top: 16px; padding-bottom: 16px; }
.h-bottom-line { padding-top: 12px; padding-bottom: 12px; }

@media (max-width: 767px) {
    .h-top-line { padding-top: 10px; padding-bottom: 10px; }
    .h-bottom-line { padding-top: 8px; padding-bottom: 8px; }
    .top-right-corner__right.account .account__btn { padding: 8px 12px; }
    .top-right-corner__right.account .account__btn .accont__btn-text { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .top-right-corner__right.account .account__btn,
    .header.d-flex { transition: none; }
    .top-right-corner__right.account .account__btn:hover { transform: none; }
}

/* ============================================================
   §13.5 HOTFIX (2026-05-02) — перебиваем баги §13.2 и §13.3
   - 13.2: filter:invert на PNG с непрозрачным фоном дал белый квадрат.
           Прячем <img>, рисуем SVG-key через ::before на <a>.
   - 13.3: ::before навешан и на trigger, и на #search-button → две лупы.
           Возвращаем штатный PNG, ::before гасим.
   ============================================================ */

/* --- 13.5.1 LK button: SVG-ключ вместо filter-инвертированного PNG --- */
.top-right-corner__right.account .account__btn img {
    display: none !important;
    filter: none !important;
}
.top-right-corner__right.account .account__btn > a::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-color: #ffffff;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11 9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1 0 8zm4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5z'/><path d='M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11 9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1 0 8zm4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5z'/><path d='M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></svg>") center / contain no-repeat;
}

/* --- 13.5.2 Search: возвращаем штатный PNG, гасим мой ::before --- */
.h-bottom-line__search #search-button::before,
.header__search-panel #search-button::before,
.dropdown-search-on::before {
    content: none !important;
    display: none !important;
    -webkit-mask: none !important;
            mask: none !important;
    background: none !important;
}
.h-bottom-line__search #search-button img,
.header__search-panel #search-button img,
.dropdown-search-on img {
    display: revert !important;
}
