/*
 * Разделы «Площадки» и «Артисты», мобильная версия (01.10.2026). Подключается только на /places/ и /artists/
 * (header.php: body получает av55-m + av55-places | av55-artists), все правила — под max-width: 767px
 * и body.av55-m: десктоп и остальной сайт не меняются.
 * Шапка как на avgifts: логотип + бургер, под ними строка поиска; нижнее меню; виджеты над ним.
 */
.av55m-sbtn, .av55m-search, .av55m-tabs { display: none; }

@media (max-width: 767px) {
    body.av55-m {
        --av55m-head: 56px;                       /* строка с логотипом */
        --av55m-srch: 54px;                       /* строка поиска */
        --av55m-tabs: 58px;                       /* нижнее меню без safe-area */
        --av55m-safe: env(safe-area-inset-bottom, 0px);
        /* чат «Мария» (astropac neurochat) читает эти переменные: поднимаем над нижним меню */
        --nc-bottom: calc(var(--av55m-tabs) + var(--av55m-safe) + 16px);
        --nc-side: 12px;
    }

    /* второе поле поиска в странице дублирует строку в шапке — прячем его, примеры и результаты остаются */
    body.av55-m .av55-ps-box { display: none; }
    body.av55-m .av55-ps-ex { margin-top: 0; }

    /* ---------- Шапка ---------- */
    body.av55-m .header.header-fixed {
        position: fixed; top: 0; left: 0; right: 0;
        background: rgba(8, 11, 18, .97);
        -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
        box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
    }
    body.av55-m .header-top { display: none; }
    body.av55-m .header-bottom { background: transparent; padding: 0; height: auto; min-height: var(--av55m-head); }
    body.av55-m .header-bottom > .container > .row { min-height: var(--av55m-head); }
    body.av55-m .header-bottom .header-logo { margin: 0; padding: 0; height: var(--av55m-head); display: flex; align-items: center; }
    body.av55-m .header-bottom .header-logo a { display: block; line-height: 0; }
    body.av55-m .header-bottom .header-logo img { height: 32px; width: auto; max-width: 170px; }
    body.av55-m .header-bottom .navbar-toggle { margin: 6px 0 0; padding: 12px 8px; }
    body.av55-m .header-bottom .navbar-toggle .icon-bar { width: 24px; }

    /* Иконка поиска в строке логотипа — появляется, когда строка поиска спрятана при прокрутке */
    body.av55-m .av55m-sbtn {
        display: flex; align-items: center; justify-content: center;
        position: absolute; top: 6px; right: 62px; width: 44px; height: 44px;
        border: 0; border-radius: 50%; background: transparent; color: #fff; padding: 0;
        opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
    }
    body.av55-m.av55m-compact .av55m-sbtn { opacity: 1; visibility: visible; }

    /* Строка поиска */
    body.av55-m .av55m-search {
        display: block; padding: 0 12px 10px; max-height: var(--av55m-srch); overflow: hidden;
        transition: max-height .25s ease, padding .25s ease, opacity .2s;
    }
    body.av55-m.av55m-compact .av55m-search { max-height: 0; padding-bottom: 0; opacity: 0; }
    body.av55-m .header:has(.navbar-collapse.in) .av55m-search { display: none; }
    .av55m-search-form {
        display: flex; align-items: center; gap: 8px; height: 44px; margin: 0;
        padding: 0 4px 0 14px; border-radius: 999px; background: #fff; color: #7a808c;
        box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    }
    .av55m-search-form svg { flex: 0 0 18px; }
    .av55m-search-form input {
        flex: 1 1 auto; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; padding: 0;
        font: 16px/1.2 RalewayRegular, sans-serif; color: #1d1f24;   /* 16px — iOS не зумит страницу при фокусе */
        -webkit-appearance: none; appearance: none;
    }
    .av55m-search-form input::placeholder { color: #8b909a; opacity: 1; }
    .av55m-search-form input::-webkit-search-cancel-button { -webkit-appearance: none; }
    .av55m-search-form button {
        flex: 0 0 auto; height: 36px; padding: 0 16px; border: 0; border-radius: 999px;
        background: linear-gradient(90deg, #fdbf00, #d71200); color: #fff;
        font: 14px/36px RalewayBold, RalewayRegular, sans-serif; font-weight: 700;
    }

    /* ---------- Блок заголовка: отступ под шапку, H1 обычным регистром ---------- */
    body.av55-m .title-bar {
        padding-top: calc(var(--av55m-head) + var(--av55m-srch) + 18px) !important;
        padding-bottom: 16px !important; text-align: left;
    }
    body.av55-m .title-bar h1,
    body.av55-m .title-bar .p1 {
        text-transform: none; font-size: 23px; line-height: 1.22; letter-spacing: 0; margin: 0 0 8px; text-align: left;
    }
    body.av55-m .title-bar-breadcrumbs,
    body.av55-m .title-bar-breadcrumbs .list-breadcrumbs { text-align: left; font-size: 12px; line-height: 1.5; margin: 0; padding: 0; }
    body.av55-m .title-bar-breadcrumbs a { opacity: .85; }
    /* результаты поиска прокручиваются под шапку — оставляем зазор */
    body.av55-m .av55-ps-res, body.av55-m [data-ps] { scroll-margin-top: calc(var(--av55m-head) + var(--av55m-srch) + 12px); }

    /* ---------- Нижнее меню ---------- */
    body.av55-m .av55m-tabs {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        height: calc(var(--av55m-tabs) + var(--av55m-safe)); padding: 0 4px var(--av55m-safe);
        background: rgba(255, 255, 255, .97);
        -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
        border-top: 1px solid #e6e8ee; box-shadow: 0 -4px 18px rgba(20, 24, 36, .08);
    }
    body.av55-m .av55m-tabs a {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        color: #6b7079 !important; text-decoration: none !important; font: 11px/1.1 RalewayRegular, sans-serif; font-weight: 600;
        -webkit-tap-highlight-color: transparent;
    }
    body.av55-m .av55m-tabs a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    body.av55-m .av55m-tabs svg {
        width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
    }
    body.av55-m .av55m-tabs a.is-active { color: #d71200 !important; }
    body.av55-m .av55m-tabs a.is-cta svg {
        width: 38px; height: 24px; padding: 3px 9px; box-sizing: border-box; border-radius: 999px; stroke: #fff;
        background: linear-gradient(90deg, #fdbf00, #d71200);
    }
    body.av55-m .av55m-tabs a.is-cta { color: #1d1f24 !important; }
    /* контент не уходит под меню */
    body.av55-m .footer { padding-bottom: calc(var(--av55m-tabs) + var(--av55m-safe)); }

    /* ---------- Плавающие виджеты над нижним меню ---------- */
    /* Книга «Сами справимся»: карточка слева, справа место под аватар чата */
    body.av55-m .avw {
        left: 10px; right: 86px; width: auto;
        bottom: calc(var(--av55m-tabs) + var(--av55m-safe) + 12px);
    }
    body.av55-m .avw-card { padding: 8px 10px 8px 6px; gap: 8px; border-radius: 14px; }
    body.av55-m .avw-cover { flex-basis: 44px; width: 44px; margin: -6px 0; }
    body.av55-m .avw-kicker { display: none; }
    body.av55-m .avw-body { gap: 2px; }
    body.av55-m .avw-title { font-size: 14px; }
    body.av55-m .avw .avw-btn { margin-top: 4px; font-size: 12px; padding: 5px 10px; }
    body.av55-m .avw-tab { bottom: calc(var(--av55m-tabs) + var(--av55m-safe) + 20px); }
    /* Флажок языков — слева, выше книги; облако чата справа до него не дотягивается */
    body.av55-m .floating-language-switcher {
        left: 10px; right: auto; zoom: .8;
        bottom: calc((var(--av55m-tabs) + var(--av55m-safe) + 92px) / .8);   /* zoom масштабирует и отступ */
    }
    body.av55-m .floating-language-switcher .language-switcher-dropdown { left: 0; right: auto; }
    body.av55-m .floating-language-switcher .language-switcher-dropdown::before { left: 18px; right: auto; }
    /* Кнопка контактов для сотрудников (local/av55-contacts, слева на карточках) — зеркально кнопке чата:
       тот же круг 64px, та же высота (чат: bottom 74 = меню 58 + 16), отступ 12px от края (Михаил 01.10) */
    body.av55-m .av55c-fab {
        left: 12px; width: 64px; height: 64px;
        bottom: calc(var(--av55m-tabs) + var(--av55m-safe) + 16px);
        transition: bottom .3s ease, transform .15s;
    }
    body.av55-m .av55c-fab svg { width: 32px; height: 32px; }
    /* Появилась плашка «Книга бесплатно» (у неё снимают атрибут hidden) — она остаётся на своём месте внизу
       (меню + 20px, высота ~36px), а кнопка контактов плавно поднимается над ней (Михаил 01.10) */
    body.av55-m:has(.avw-tab:not([hidden])) .av55c-fab { bottom: calc(var(--av55m-tabs) + var(--av55m-safe) + 68px); }
    /* Баннер cookie — над нижним меню */
    body.av55-m .cookie-banner { bottom: calc(var(--av55m-tabs) + var(--av55m-safe) + 10px); left: 10px; right: 10px; }
}
