/* =========================================================
   Мобильное нижнее меню + «Избранное»
   (reboot-child / inc/mobile-nav.php)
   ========================================================= */

/* ---------- флажок «Избранное» (везде) ---------- */
.js-fav {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.js-fav .fav-ico path { transition: fill .2s ease, stroke .2s ease; }
.js-fav.is-active .fav-ico path { fill: currentColor; }
.js-fav.is-pop .fav-ico { animation: favPop .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes favPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.32); }
    100% { transform: scale(1); }
}

/* в футере карточки ленты */
.vc-card__btn--fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: -7px -6px -7px 0;
    border-radius: 50%;
    color: #8a9099;
    transition: color .2s ease, background .2s ease;
}
.vc-card__btn--fav:hover { color: #2d81e0; background: #eef4fd; }
.vc-card__btn--fav.is-active { color: #2d81e0; }

/* поверх фото в карусели главной */
.hr-card { position: relative; }
.hr-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #1c1c1c;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    transition: transform .15s ease, color .2s ease, background .2s ease;
}
.hr-fav:hover { transform: scale(1.06); }
.hr-fav.is-active { color: #fff; background: #2d81e0; }

/* в записи */
.vc-entry-stats .vc-entry-stat--fav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    padding: 6px 14px 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #2d81e0 !important;
    background: #eef4fd;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease, transform .15s ease;
}
.vc-entry-stats .vc-entry-stat--fav:hover { background: #e1ecfb; }
.vc-entry-stats .vc-entry-stat--fav.is-active { color: #fff !important; background: #2d81e0; }

/* ---------- всплывашка ---------- */
.fav-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 10002;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100vw - 32px);
    padding: 11px 16px;
    border-radius: 12px;
    font: 500 14px/1.3 'Inter', sans-serif;
    color: #fff;
    background: rgba(28, 30, 34, .94);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity .22s ease, transform .22s ease;
    pointer-events: none;
}
.fav-toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.fav-toast[hidden] { display: none; }
.fav-toast__link { color: #7db5ff !important; font-weight: 700; text-decoration: none !important; white-space: nowrap; }
.fav-toast__link[hidden] { display: none; }

/* ---------- нижнее меню ---------- */
.mnav,
.mnav-sheet { display: none; }

@media (max-width: 768px) {
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

    .mnav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10000;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: end;
        height: calc(62px + env(safe-area-inset-bottom, 0px));
        padding: 0 4px env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, .92);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        backdrop-filter: saturate(180%) blur(16px);
        border-top: 1px solid rgba(0, 0, 0, .06);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .05);
        font-family: 'Inter', sans-serif;
    }

    .mnav__item {
        -webkit-appearance: none;
        appearance: none;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        height: 62px;
        min-width: 0;
        padding: 0 2px;
        border: 0;
        background: none;
        color: #7b818a !important;
        text-decoration: none !important;
        font: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color .2s ease;
    }
    .mnav__item::before {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        width: 26px;
        height: 3px;
        border-radius: 0 0 3px 3px;
        background: #2d81e0;
        transform: translateX(-50%) scaleX(0);
        transition: transform .25s ease;
    }
    .mnav__item.is-active,
    .mnav__item.is-open { color: #2d81e0 !important; }
    .mnav__item.is-active::before,
    .mnav__item.is-open::before { transform: translateX(-50%) scaleX(1); }
    .mnav__item:active .mnav__ico { transform: scale(.9); }

    .mnav__ico {
        position: relative;
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        transition: transform .15s ease;
    }
    .mnav__ico svg { display: block; }
    .mnav__item.is-active .mnav__ico .fav-ico path { fill: currentColor; }

    .mnav__label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 10.5px;
        line-height: 1.1;
        font-weight: 600;
        letter-spacing: .01em;
    }

    /* «Добавить» — обычный пункт, как остальные */

    /* счётчик избранного */
    .mnav__badge {
        position: absolute;
        top: -3px;
        right: -9px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border-radius: 9px;
        box-sizing: border-box;
        font-size: 10px;
        font-weight: 700;
        line-height: 17px;
        text-align: center;
        color: #fff;
        background: #ef4d5e;
        box-shadow: 0 0 0 2px #fff;
    }
    .mnav__badge[hidden] { display: none; }

    /* аватар */
    .mnav__avatar,
    .mnav__ico img {
        width: 26px !important;
        height: 26px !important;
        border-radius: 50%;
        object-fit: cover;
        box-shadow: 0 0 0 1.5px #e3e6ea;
        transition: box-shadow .2s ease;
    }
    .mnav__item--user.is-active .mnav__ico img { box-shadow: 0 0 0 2px #2d81e0; }

    /* кнопки сайта, которые раньше стояли у нижнего края */
    .scrolltop.js-scrolltop { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
    .vc-live-pill { bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; }
    .fav-toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

    /* ---------- шторка «Категории» ---------- */
    .mnav-sheet {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: block;
    }
    .mnav-sheet[hidden] { display: none; }
    .mnav-sheet__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(15, 20, 30, .45);
        opacity: 0;
        transition: opacity .25s ease;
    }
    .mnav-sheet__panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        max-height: 82vh;
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        border-radius: 20px 20px 0 0;
        background: #fff;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.2, .8, .2, 1);
        font-family: 'Inter', sans-serif;
    }
    .mnav-sheet.is-open .mnav-sheet__backdrop { opacity: 1; }
    .mnav-sheet.is-open .mnav-sheet__panel { transform: translateY(0); }

    .mnav-sheet__grip {
        flex: 0 0 auto;
        width: 40px;
        height: 5px;
        margin: 8px auto 2px;
        border-radius: 3px;
        background: #dfe2e6;
    }
    .mnav-sheet__head {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 16px 10px;
    }
    .mnav-sheet__title {
        margin: 0;
        font-size: 20px;
        line-height: 1.2;
        font-weight: 700;
        color: #111;
    }
    .mnav-sheet__close {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        color: #444;
        background: #f2f4f7;
        cursor: pointer;
    }
    .mnav-sheet__body {
        flex: 1 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 2px 16px 16px;
    }

    .mnav-cats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .mnav-cat {
        --rb: #2d81e0;
        display: grid;
        grid-template-columns: 38px 1fr;
        grid-template-rows: auto auto;
        column-gap: 10px;
        align-items: center;
        min-height: 58px;
        padding: 10px;
        border-radius: 12px;
        text-decoration: none !important;
        color: #111 !important;
        background: color-mix(in srgb, var(--rb) 6%, #fff);
        border: 1px solid color-mix(in srgb, var(--rb) 14%, #fff);
        transition: transform .15s ease, background .2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .mnav-cat:active { transform: scale(.97); }
    .mnav-cat.is-current {
        border-color: var(--rb);
        background: color-mix(in srgb, var(--rb) 14%, #fff);
    }
    .mnav-cat.is-empty { opacity: .55; }
    .mnav-cat__icon {
        grid-row: 1 / 3;
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: 19px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    }
    .mnav-cat__name {
        align-self: end;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
        line-height: 1.25;
        font-weight: 600;
    }
    .mnav-cat__count {
        align-self: start;
        font-size: 12px;
        line-height: 1.3;
        color: #6b7280;
    }

    /* ---------- «Куда пойти сегодня» над рубриками ---------- */
    .mnav-sheet__sub {
        margin: 14px 2px 8px;
        font-size: 13px;
        line-height: 1.3;
        font-weight: 700;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: #6b7280;
    }
    .mnav-sheet__sub:first-child { margin-top: 4px; }
    .mnav-sheet__sub a { color: inherit !important; text-decoration: none !important; }
    .mnav-cat--kc {
        background: linear-gradient(135deg, color-mix(in srgb, var(--rb) 13%, #fff), color-mix(in srgb, var(--rb) 4%, #fff));
        border-color: color-mix(in srgb, var(--rb) 24%, #fff);
    }
    .mnav-cat--kc .mnav-cat__icon {
        background: color-mix(in srgb, var(--rb) 16%, #fff);
        box-shadow: none;
    }
    .mnav-cat--kc .mnav-cat__count { color: color-mix(in srgb, var(--rb) 70%, #374151); }

    html.mnav-lock,
    html.mnav-lock body { overflow: hidden; }
}

@media (max-width: 340px) {
    .mnav-cats { grid-template-columns: 1fr; }
}

/* ---------- страница «Избранное» ---------- */
.fav-page { font-family: 'Inter', sans-serif; }
.fav-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 18px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff 40%, #eef4fd);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.fav-head__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #3b8ff0, #1f6fcb);
    box-shadow: 0 6px 16px rgba(45, 129, 224, .3);
}
.fav-head__icon .fav-ico path { fill: currentColor; }
.fav-head__title {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
    color: #111;
}
.fav-head__sub { margin: 2px 0 0; font-size: 14px; color: #6b7280; }

.fav-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
    color: #3b3d41;
    background: #fff8e6;
    border: 1px solid #f6e3b0;
}
.fav-note p { margin: 0; }
.fav-note a { color: #2d81e0; font-weight: 600; }

.fav-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 16px;
    font-size: 14px;
    color: #6b7280;
}
.fav-loading[hidden] { display: none; }
.fav-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #dbe6f5;
    border-top-color: #2d81e0;
    border-radius: 50%;
    animation: favSpin .8s linear infinite;
}
@keyframes favSpin { to { transform: rotate(360deg); } }

.fav-empty {
    padding: 48px 24px;
    border-radius: 10px;
    text-align: center;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.fav-empty[hidden] { display: none; }
.fav-empty__icon {
    display: inline-grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: 14px;
    border-radius: 50%;
    color: #2d81e0;
    background: #eef4fd;
}
.fav-empty__title { margin: 0 0 6px; font-size: 19px; font-weight: 700; color: #111; }
.fav-empty__text { max-width: 420px; margin: 0 auto 18px; font-size: 15px; line-height: 1.5; color: #6b7280; }
.fav-empty__btn {
    display: inline-block;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #fff !important;
    text-decoration: none !important;
    background: #2d81e0;
    transition: background .2s ease, box-shadow .2s ease;
}
.fav-empty__btn:hover { background: #1f6fcb; box-shadow: 0 4px 14px rgba(45, 129, 224, .3); }

.fav-cards > .is-removing {
    opacity: 0;
    transform: scale(.96);
    transition: opacity .25s ease, transform .25s ease;
}
.fav-error { padding: 24px; text-align: center; color: #6b7280; }

@media (max-width: 768px) {
    .fav-head,
    .fav-empty { border-radius: 0; box-shadow: none; }
    .fav-head { padding: 16px; margin-bottom: 10px; }
    .fav-head__title { font-size: 22px; }
    .fav-note { margin: 0 12px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .js-fav.is-pop .fav-ico { animation: none; }
    .mnav-sheet__panel,
    .mnav-sheet__backdrop,
    .fav-toast { transition: none; }
}

/* «Избранное» в левой колонке ПК: счётчик скрыт, пока пусто */
.vc-nav-count.js-fav-badge[hidden] { display: none !important; }

/* ---------- шапка на телефоне: логотип по центру, переключатель города слева, поиск справа ----------
   Меню, «Войти» и «Написать» дублируются нижним меню */
@media (max-width: 768px) {
    #masthead .vc-burger,
    #masthead .lk-head,
    #masthead .social-links { display: none !important; }
    #masthead .site-header-inner {
        position: relative !important;
        justify-content: center !important;
    }
    #masthead .site-branding {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        text-align: center !important;
        z-index: 10 !important;
        max-width: calc(100% - 150px) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #masthead .site-branding .mh-logo {
        margin: 0 auto !important;
        align-items: center !important;
    }
    #masthead .site-logotype { margin: 0 auto !important; }
    #masthead .site-logotype img { height: 30px !important; max-width: 150px !important; width: auto !important; }
    #masthead .vc-city-select {
        position: absolute !important;
        left: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
        z-index: 20 !important;
    }
    #masthead .header-search {
        position: absolute !important;
        top: 50% !important;
        right: 10px !important;
        margin: 0 !important;
        transform: translateY(-50%);
        z-index: 20 !important;
    }
}
@media (max-width: 480px) {
    #masthead .vc-city-select { left: 8px !important; }
    #masthead .header-search { right: 8px !important; }
    #masthead .site-branding { max-width: calc(100% - 130px) !important; }
}

