/*
 * Media Mir Messenger Widget
 * Плавающий виджет связи на сайте.
 */

.mm-mw,
.mm-mw * {
    box-sizing: border-box;
}

.mm-mw {
    position: fixed;
    bottom: 22px;
    z-index: 99999;
    font-family: inherit;
}

.mm-mw-right {
    right: 22px;
}

.mm-mw-left {
    left: 22px;
}

.mm-mw-toggle {
    border: 0;
    border-radius: 999px;
    background: var(--mm-mw-primary, #1f5f9f);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 18px;
    min-height: 48px;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.mm-mw-toggle:hover,
.mm-mw-toggle:focus {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
    opacity: 0.96;
}

.mm-mw-toggle-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    font-size: 14px;
}

.mm-mw-panel {
    position: absolute;
    bottom: 62px;
    width: 315px;
    max-width: calc(100vw - 32px);
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
    color: #1d1d1f;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.mm-mw-right .mm-mw-panel {
    right: 0;
}

.mm-mw-left .mm-mw-panel {
    left: 0;
}

.mm-mw-panel.mm-mw-opened {
    animation: mmMwPanelIn 0.18s ease-out;
}

@keyframes mmMwPanelIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mm-mw-header {
    background: var(--mm-mw-primary, #1f5f9f);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 17px;
}

.mm-mw-header strong {
    font-size: 17px;
    line-height: 1.2;
}

.mm-mw-close {
    border: 0;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.mm-mw-subtitle {
    padding: 14px 17px 4px;
    color: #585858;
    font-size: 14px;
    line-height: 1.45;
}

.mm-mw-links {
    display: grid;
    gap: 9px;
    padding: 13px 14px 14px;
}

.mm-mw-link {
    text-decoration: none !important;
    color: #1d1d1f !important;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #f5f7fa;
    border: 1px solid #edf0f4;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 600;
    transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.mm-mw-link:hover,
.mm-mw-link:focus {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.14);
    transform: translateY(-1px);
}

.mm-mw-link-icon {
    width: 31px;
    height: 31px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--mm-mw-primary, #1f5f9f);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.mm-mw-note {
    padding: 0 17px 16px;
    font-size: 13px;
    line-height: 1.35;
    color: #696969;
}

.mm-mw-fallback {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.46);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.mm-mw-fallback-box {
    width: 360px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.mm-mw-fallback-box strong {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
}

.mm-mw-fallback-box p {
    margin: 0 0 16px;
    color: #444444;
    line-height: 1.45;
}

.mm-mw-fallback-close {
    border: 0;
    border-radius: 10px;
    background: var(--mm-mw-primary, #1f5f9f);
    color: #ffffff;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 640px) {
    .mm-mw {
        bottom: 14px;
    }

    .mm-mw-right {
        right: 14px;
    }

    .mm-mw-left {
        left: 14px;
    }

    .mm-mw-toggle-text {
        display: none;
    }

    .mm-mw-toggle {
        width: 54px;
        height: 54px;
        padding: 0;
        justify-content: center;
    }

    .mm-mw-toggle-icon {
        background: transparent;
        font-size: 20px;
    }

    .mm-mw-panel {
        bottom: 66px;
        width: calc(100vw - 28px);
    }
}

/* Настраиваемые иконки из медиабиблиотеки. */
.mm-mw-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mm-mw-link-icon img {
    border-radius: 8px;
}

.mm-mw-toggle-icon img {
    border-radius: 50%;
}

.mm-mw-info-box {
    margin: 0 14px 15px;
    padding: 12px 13px;
    border-radius: 14px;
    border: 1px solid rgba(31, 95, 159, 0.18);
    background: linear-gradient(180deg, rgba(31, 95, 159, 0.07), rgba(31, 95, 159, 0.035));
    color: #3f4a56;
    font-size: 13px;
    line-height: 1.45;
}
