/* ==========================================================================
   header-compact.css — шаг 2: одна строка шапки вместо двух
   Подключать в header.php ПОСЛЕ main.css и media.css.
   Откат: убрать подключение этого файла и вернуть прежний header.php.
   Используем только новые классы tmt-*, чтобы не пересекаться с main.css.
   ========================================================================== */

/* --- Строка шапки: компактнее и с равными промежутками -------------------- */
.bl_top_line_fixed .bl_top_line {
    padding: 8px 0;
    gap: 16px;
}

/* «Каталог»: 52px -> 44px, текст по центру по вертикали */
header .bl_top_line a.link_to_catalog {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 55px 0 23px;
    display: flex;
    align-items: center;
    line-height: 1;
}

/* Поиск занимает всё свободное место */
header .bl_top_line .bl_search {
    flex: 1 1 auto;
    width: auto;
    max-width: 540px;
    min-width: 200px;
}

header .bl_top_line .bl_search input {
    height: 44px;
}

header .bl_top_line .bl_search .btn_search {
    height: 44px;
}

/* --- «Компания» — выпадающее меню вместо нижней строки -------------------- */
.tmt-company {
    position: relative;
    flex: 0 0 auto;
}

.tmt-company__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 6px;
    border: 0;
    background: transparent;
    color: #261626;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: color .3s;
}

.tmt-company__btn::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}

.tmt-company__btn:hover,
.tmt-company.is-open .tmt-company__btn {
    color: #2D9EAA;
}

.tmt-company__list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1001;
    min-width: 230px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(38, 22, 38, .15);
}

.tmt-company:hover .tmt-company__list,
.tmt-company:focus-within .tmt-company__list,
.tmt-company.is-open .tmt-company__list {
    display: block;
}

.tmt-company__list a {
    display: block;
    padding: 10px 20px;
    color: #261626;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.tmt-company__list a:hover,
.tmt-company__list a:focus-visible {
    color: #2D9EAA;
    background: #F4F8F8;
    text-decoration: none;
}

/* --- Телефон + «Обратный звонок» в две строки ----------------------------- */
.tmt-contact {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.2;
}

.tmt-contact .link_header_phone {
    padding-left: 30px;
    background: url(../img/phone.svg) no-repeat left center;
    color: #261626;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.tmt-recall-link {
    padding: 0 0 0 30px;
    border: 0;
    background: transparent;
    color: #2D9EAA;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.tmt-recall-link:hover {
    color: #218590;
    text-decoration: underline;
}

/* --- Видимый фокус с клавиатуры ------------------------------------------- */
.tmt-company__btn:focus-visible,
.tmt-recall-link:focus-visible,
.tmt-contact .link_header_phone:focus-visible {
    outline: 2px solid #2D9EAA;
    outline-offset: 2px;
    border-radius: 6px;
}

/* Меню «Каталог»: кнопка и ссылки панели (у панели overflow: hidden — рамка внутрь) */
.tmt-catmenu a.link_to_catalog:focus-visible {
    outline: 2px solid #2D9EAA;
    outline-offset: 2px;
    border-radius: 6px;
}

.tmt-catmenu__panel a:focus-visible {
    outline: 2px solid #2D9EAA;
    outline-offset: -2px;
    border-radius: 6px;
}

/* --- Планшеты: экономим ширину ------------------------------------------- */
@media (max-width: 1199px) {
    .bl_top_line_fixed .bl_top_line {
        gap: 10px;
    }

    header .bl_top_line .bl_search {
        min-width: 140px;
    }
}

/* --- Мобильные: новые блоки скрыты, ссылки и телефон есть в мобильном меню - */
@media (max-width: 767px) {
    .tmt-company,
    .tmt-contact {
        display: none;
    }
}

/* ==========================================================================
   v2 — шаг 3: подписи иконок в одну строку, сумма в корзине
   ========================================================================== */

/* Иконки справа не сжимаются и не переносят подписи */
header .bl_top_line .header_links_img {
    flex: 0 0 auto;
    white-space: nowrap;
}

header .bl_top_line .header_links_img span {
    white-space: nowrap;
}

/* Сумма вместо подписи «Ваш заказ» (только для авторизованных, когда в заказе есть позиции) */
header .bl_top_line .header_links_img .tmt-basket-sum {
    color: #218590;
    font-size: 14px;
    font-weight: 600;
}

/* ==========================================================================
   v3 — подсказка в поле поиска
   ========================================================================== */
header .bl_top_line .bl_search input {
    padding-right: 60px;
    text-overflow: ellipsis;
}

header .bl_top_line .bl_search input::placeholder {
    color: #8A8A8A;
    font-size: 15px;
    font-weight: 400;
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ==========================================================================
   v4 — меню «Каталог» (разделы 1-го и 2-го уровня) и полоса быстрых категорий
   ========================================================================== */

/* Выпадающее меню позиционируется по всей ширине строки шапки */
.bl_top_line_fixed .bl_top_line {
    position: relative;
}

.tmt-catmenu {
    flex: 0 0 auto;
}

.tmt-catmenu.is-open a.link_to_catalog {
    color: #2D9EAA;
}

.tmt-catmenu__panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1002;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(38, 22, 38, 0.15);
    overflow: hidden;
}

.tmt-catmenu.is-open .tmt-catmenu__panel {
    display: flex;
}

.tmt-catmenu__roots {
    flex: 0 0 300px;
    margin: 0;
    padding: 12px 0;
    list-style: none;
    border-right: 1px solid #ECE7EC;
    overflow-y: auto;
}

.tmt-catmenu__root a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 22px;
    color: #261626;
    font-size: 16px;
    font-weight: 500;
}

.tmt-catmenu__root a::after {
    content: "›";
    color: #A09094;
}

.tmt-catmenu__root.is-active a {
    background: #E7F2F3;
    color: #1A6B74;
    font-weight: 600;
}

.tmt-catmenu__root.is-sale a {
    color: #C4122E;
    font-weight: 600;
}

.tmt-catmenu__subs {
    flex: 1 1 auto;
    min-width: 0;
    padding: 24px 32px;
    overflow-y: auto;
}

.tmt-catmenu__group {
    display: none;
}

.tmt-catmenu__group.is-active {
    display: block;
}

.tmt-catmenu__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 14px;
}

.tmt-catmenu__title {
    color: #261626;
    font-size: 20px;
    font-weight: 600;
}

.tmt-catmenu__all {
    color: #218590;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
}

.tmt-catmenu__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tmt-catmenu__list a {
    display: block;
    padding: 9px 0;
    border-bottom: 1px solid #F3F0F3;
    color: #261626;
    font-size: 15px;
    line-height: 1.35;
}

.tmt-catmenu__root a:hover,
.tmt-catmenu__title:hover,
.tmt-catmenu__list a:hover {
    color: #2D9EAA;
}

.tmt-catmenu__empty {
    margin: 0;
    color: #6B5F6B;
    font-size: 15px;
}

/* Полоса быстрых категорий — вторая строка шапки (.bl_bottom_line_wrapper из main.css) */
.tmt-catbar__nav {
    max-width: 1160px;
    height: 44px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
    border-top: 1px solid #A0909433;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.tmt-catbar__nav::-webkit-scrollbar {
    display: none;
}

.tmt-catbar__link {
    flex: 0 0 auto;
    color: #261626;
    font-size: 14px;
    font-weight: 500;
}

.tmt-catbar__link:hover,
.tmt-catbar__link.is-active {
    color: #2D9EAA;
}

.tmt-catbar__link.is-sale {
    color: #C4122E;
    font-weight: 600;
}

.tmt-catbar__all {
    flex: 0 0 auto;
    margin-left: auto;
    color: #218590;
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 1199px) {
    .tmt-catmenu__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tmt-catbar__nav {
        padding: 0 15px;
        gap: 16px;
    }
}

/* Мобильные: кнопка «Каталог» с меню скрыта (каталог — в мобильном меню), как было до облегчения шапки */
@media (max-width: 767px) {
    .tmt-catmenu,
    .tmt-catmenu__panel {
        display: none !important;
    }
}

/* ==========================================================================
   v5 — верхняя полоса «О нас · Сертификаты · Оплата и доставка · Контакты»
   (внутри .bl_top_line_fixed: высоту шапки учитывает custom.js автоматически)
   ========================================================================== */
.tmt-topbar {
    background: #261626;
}

.tmt-topbar__nav {
    max-width: 1160px;
    height: 32px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
}

.tmt-topbar__nav a {
    color: #E9E1E6;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

.tmt-topbar__nav a:hover,
.tmt-topbar__nav a:focus-visible {
    color: #FFFFFF;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 1199px) {
    .tmt-topbar__nav {
        padding: 0 15px;
        gap: 20px;
    }
}

@media (max-width: 767px) {
    .tmt-topbar {
        display: none;
    }
}

/* Широкие экраны: используем больше полезной площади, сохраняя поля по бокам.
 * До 1366 px геометрия остаётся прежней, поэтому элементы шапки не сжимаются. */
@media (min-width: 1440px) {
    .container,
    .bl_top_line_fixed .bl_top_line,
    .tmt-topbar__nav,
    .tmt-catbar__nav {
        max-width: 1240px;
    }
}

/* Открытое мобильное меню должно оставлять каталог и телефон доступными.
 * В этот момент Jivo возвращается сразу после закрытия меню. */
@media (max-width: 767px) {
    body.tmt-mobile-menu-open #jivo-iframe-container {
        display: none !important;
    }
}

/* TMT 2026-10-28: под свёрнутой админ-панелью Bitrix шапка сразу на месте, до работы custom.js (посетители панели не видят) */
body:has(#bx-panel.bx-panel-folded) .bl_top_line_fixed {
    top: 39px;
}

/* TMT 2026-10-28: баннер «Работаем только с юрлицами» (header.php, data-tmt-price-notice) —
   без бирюзовых полос по бокам, текст в пределах экрана, крестик справа */
.header-opt-text {
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid #E5E5E5;
    box-sizing: border-box;
    max-width: 100vw;
    overflow: hidden;
}

.header-opt-text .container {
    position: relative;
    padding-left: 44px;
    padding-right: 44px;
    text-align: center;
}

.tmt-price-notice__text {
    display: block;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.tmt-price-notice__close {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #777777;
    cursor: pointer;
}

.tmt-price-notice__close::before,
.tmt-price-notice__close::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.tmt-price-notice__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.tmt-price-notice__close:hover,
.tmt-price-notice__close:focus-visible {
    color: #333333;
}

@media (max-width: 767px) {
    .header-opt-text .container {
        padding-left: 12px;
        padding-right: 40px;
    }

    .tmt-price-notice__close {
        right: 4px;
    }
}

/* --- Телефон: строка поиска под шапкой по нажатию на лупу (класс ставит скрипт в header.php) --- */
@media (max-width: 767px) {
    header .bl_top_line_fixed.tmt-msearch-open .bl_top_line {
        position: relative;
    }

    /* main.css скрывает .bl_search на телефоне через !important */
    header .bl_top_line_fixed.tmt-msearch-open .bl_top_line .bl_search {
        display: block !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: auto;
        max-width: none;
        min-width: 0;
        padding: 8px 12px 10px;
        background: #fff;
        box-shadow: 0 8px 16px rgba(38, 22, 38, 0.12);
        z-index: 1001;
    }

    /* 16px — iOS не увеличивает страницу при фокусе */
    header .bl_top_line_fixed.tmt-msearch-open .bl_top_line .bl_search input {
        font-size: 16px;
    }

    header .bl_top_line_fixed.tmt-msearch-open .bl_top_line .bl_search .btn_search {
        top: 8px;
        right: 24px;
    }

    /* Длинные названия в подсказках переносятся, а не обрезаются */
    table.title-search-result td.title-search-item,
    table.title-search-result td.title-search-item a {
        white-space: normal;
    }
}
/* E-mail в контактном блоке шапки */
.tmt-contact__email {
    color: #261626;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
.tmt-contact__email:hover,
.tmt-contact__email:focus-visible {
    color: #2D9EAA;
    text-decoration: underline;
}

/* ==========================================================================
   v6 — вариант Б (09.11.2026): ссылки верхней полосы по центру, справа
   почта и «Обратный звонок»; в строке шапки — телефон + кнопка «Запросить КП»
   ========================================================================== */
.tmt-topbar__inner {
    max-width: 1160px;
    height: 32px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 20px;
}

.tmt-topbar__inner .tmt-topbar__nav {
    grid-column: 2;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.tmt-topbar__contacts {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 18px;
}

.tmt-topbar__link {
    padding: 0;
    border: 0;
    background: transparent;
    color: #E9E1E6;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

.tmt-topbar__link:hover,
.tmt-topbar__link:focus-visible {
    color: #FFFFFF;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tmt-contact.tmt-contact--b {
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.tmt-contact--b .link_header_phone {
    padding-left: 26px;
    background-size: 18px 18px;
    background-position: left center;
    line-height: 24px;
}

.tmt-header-kp {
    padding: 7px 14px;
    border: 1px solid #B4410A;
    border-radius: 18px;
    background: transparent;
    color: #B4410A;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.tmt-header-kp:hover {
    background: #B4410A;
    color: #FFFFFF;
}

.tmt-header-kp:focus-visible {
    outline: 2px solid #2D9EAA;
    outline-offset: 2px;
}

@media (max-width: 1199px) {
    .tmt-topbar__inner {
        padding: 0 15px;
    }

    /* Узкие экраны: кнопка КП под номером, чтобы не сжимать поиск */
    .tmt-contact.tmt-contact--b {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .tmt-contact--b .tmt-header-kp {
        margin-left: 26px;
        padding: 3px 10px;
        font-size: 12px;
    }
}

@media (min-width: 1440px) {
    .tmt-topbar__inner {
        max-width: 1240px;
    }
}
