/*
 * mobile_bottom_bar.css — нижняя фиксированная панель навигации на мобиле.
 * Активна только на <=991px. Подключается из init.php OnBeforeProlog.
 *
 * Класс .ship-mbar отдельный от Аспровской .bottom-icons-panel — правило
 * скрытия (display:none !important) той панели нас не задевает.
 *
 * z-index: 100 — выше любого контента (бывший sticky_buy_bar был 90, сейчас
 * отключён, но запас оставляем); ниже модалок чекаута/OCB (1000+).
 */

/* ===== Скрыто на десктопе ===== */
nav.ship-mbar,
.ship-chat-modal { display: none; }

@media (max-width: 991px) {
    nav.ship-mbar,
    body nav.ship-mbar,
    .ship-mbar {
        display: flex !important;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        z-index: 100 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        background: #fff !important;
        border-top: 1px solid #ececec;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
        padding-bottom: env(safe-area-inset-bottom, 0);
        font-family: inherit;
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.has-ship-mobile-bar {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
    }

    .ship-mbar .ship-mbar__item,
    nav.ship-mbar .ship-mbar__item {
        flex: 1 1 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        height: 64px !important;
        padding: 6px 0 8px !important;
        margin: 0 !important;
        background: none !important;
        border: 0 !important;
        outline: 0 !important;
        text-decoration: none !important;
        color: #6b6b6b !important;
        font: inherit !important;
        font-size: 11px !important;
        line-height: 1.15 !important;
        cursor: pointer !important;
        visibility: visible !important;
        opacity: 1 !important;
        -webkit-tap-highlight-color: transparent;
    }

    .ship-mbar .ship-mbar__item:link,
    .ship-mbar .ship-mbar__item:visited,
    .ship-mbar .ship-mbar__item:hover,
    .ship-mbar .ship-mbar__item:active,
    .ship-mbar .ship-mbar__item:focus { color: #6b6b6b !important; text-decoration: none !important; }

    .ship-mbar .ship-mbar__item.is-active,
    .ship-mbar .ship-mbar__item.is-active:link,
    .ship-mbar .ship-mbar__item.is-active:visited {
        color: var(--theme-base-color, #e8a2e1) !important;
    }

    .ship-mbar .ship-mbar__icon {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 26px !important;
        height: 26px !important;
        color: inherit !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .ship-mbar .ship-mbar__icon svg {
        display: block !important;
        width: 24px !important;
        height: 24px !important;
        color: inherit !important;
        fill: currentColor;
        stroke: currentColor;
        visibility: visible !important;
        opacity: 1 !important;
    }
    /* SVG-пути: восстанавливаем оригинальные fill/stroke из атрибутов */
    .ship-mbar .ship-mbar__icon svg [stroke="currentColor"] { stroke: currentColor !important; }
    .ship-mbar .ship-mbar__icon svg [fill="currentColor"] { fill: currentColor !important; }
    .ship-mbar .ship-mbar__icon svg [fill="none"] { fill: none !important; }

    .ship-mbar .ship-mbar__label {
        display: block !important;
        font-size: 11px !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        font-weight: 500 !important;
        color: inherit !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .ship-mbar__badge {
        position: absolute;
        top: -6px;
        right: -8px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 8px;
        background: #ff5630;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
        box-shadow: 0 0 0 2px #fff;
        pointer-events: none;
    }

    /* ===== Модалка чатов ===== */
    .ship-chat-modal {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1100;
        pointer-events: none;
        opacity: 0;
        transition: opacity .18s ease;
    }

    .ship-chat-modal.is-open {
        pointer-events: auto;
        opacity: 1;
    }

    .ship-chat-modal__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, .45);
    }

    .ship-chat-modal__card {
        position: absolute;
        left: 12px;
        right: 12px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0));
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 12px 36px rgba(0, 0, 0, .18);
        transform: translateY(16px);
        transition: transform .18s ease;
        overflow: hidden;
    }

    .ship-chat-modal.is-open .ship-chat-modal__card { transform: translateY(0); }

    .ship-chat-modal__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 18px 8px;
    }

    .ship-chat-modal__title {
        margin: 0;
        font-size: 17px;
        font-weight: 700;
        color: #1a1a1a;
    }

    .ship-chat-modal__close {
        background: none;
        border: 0;
        padding: 4px;
        color: #b3b3b3;
        cursor: pointer;
        line-height: 0;
    }
    .ship-chat-modal__close:hover { color: #1a1a1a; }

    .ship-chat-list {
        list-style: none;
        margin: 0;
        padding: 4px 0 12px;
    }
    .ship-chat-list li { margin: 0; }

    .ship-chat-list__row {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 12px 18px;
        text-decoration: none;
        color: #1a1a1a;
        font-size: 15px;
        line-height: 1.3;
    }
    .ship-chat-list__row:hover,
    .ship-chat-list__row:visited { color: #1a1a1a; text-decoration: none; }
    .ship-chat-list__row:active { background: #f5f7fa; }

    .ship-chat-list__icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .ship-chat-list__icon--tg    { background: #29a3eb; }
    .ship-chat-list__icon--phone { background: #21c462; }
    .ship-chat-list__icon--max   { background: #6e5cf7; }
    .ship-chat-list__icon--vk    { background: #0077ff; }
    .ship-chat-list__icon svg { display: block; }

    .ship-chat-list__label {
        flex: 1 1 auto;
        font-weight: 500;
    }
}

/* Блокируем скролл body, пока модалка открыта */
body.ship-chat-open { overflow: hidden; }
