/* Модальное окно консультации — стиль сайта */

:root {
    --cm-accent: #e63b2e;
    --cm-accent-hover: #cc2f23;
    --cm-dark: #1a1a1a;
    --cm-text: #4a4a4a;
    --cm-text-light: #6c757d;
    --cm-bg: #ffffff;
    --cm-bg-light: #f5f5f5;
    --cm-border: #e0e0e0;
    --cm-bar: #2d2d2d;
    --cm-overlay: rgba(0, 0, 0, 0.55);
    --cm-font: 'Montserrat', 'Roboto', 'Open Sans', sans-serif;
}

/* Overlay — скрыто по умолчанию (даже если CSS подгрузится с задержкой) */
.cm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--cm-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cm-modal-overlay.is-open {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.cm-modal-overlay[hidden] {
    display: none !important;
}

body.cm-modal-open {
    overflow: hidden;
}

/* Dialog */
.cm-modal {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--cm-bg);
    border-radius: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(16px);
    transition: transform 0.25s ease;
}

.cm-modal-overlay.is-open .cm-modal {
    transform: translateY(0);
}

/* Левая акцентная полоса как на карточках сайта */
.cm-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--cm-bar);
}

.cm-modal__inner {
    padding: 36px 40px 32px 46px;
}

/* Кнопка закрытия */
.cm-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--cm-dark);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.cm-modal__close:hover,
.cm-modal__close:focus {
    color: var(--cm-accent);
    outline: none;
}

/* Текст */
.cm-modal__title {
    margin: 0 0 12px;
    padding-right: 28px;
    color: var(--cm-dark);
    font-family: var(--cm-font);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: none;
}

.cm-modal__text {
    margin: 0 0 24px;
    color: var(--cm-text);
    font-family: var(--cm-font);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
}

/* Форма */
.cm-modal__form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cm-modal__field label {
    display: block;
    margin-bottom: 6px;
    color: var(--cm-dark);
    font-family: var(--cm-font);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cm-modal__field input[type='tel'] {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 2px solid var(--cm-border);
    border-radius: 0;
    background: var(--cm-bg-light);
    color: var(--cm-dark);
    font-family: var(--cm-font);
    font-size: 16px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.cm-modal__field input[type='tel']:focus {
    outline: none;
    border-bottom-color: var(--cm-accent);
    background: var(--cm-bg);
}

.cm-modal__field input.is-invalid {
    border-bottom-color: #dc3545;
}

.cm-modal__error {
    display: none;
    margin-top: 6px;
    color: #dc3545;
    font-size: 13px;
}

.cm-modal__error.is-visible {
    display: block;
}

/* Чекбоксы */
.cm-modal__checkboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cm-modal__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-family: var(--cm-font);
    font-size: 13px;
    line-height: 1.45;
    color: var(--cm-text-light);
}

.cm-modal__checkbox input[type='checkbox'] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--cm-accent);
    cursor: pointer;
}

.cm-modal__checkbox a {
    color: var(--cm-accent);
    text-decoration: underline;
}

.cm-modal__checkbox a:hover {
    text-decoration: none;
}

/* Кнопка отправки */
.cm-modal__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
    padding: 14px 24px;
    border: none;
    border-radius: 0;
    background: var(--cm-accent);
    color: #ffffff;
    font-family: var(--cm-font);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cm-modal__submit:hover:not(:disabled) {
    background: var(--cm-accent-hover);
}

.cm-modal__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.cm-modal__submit-arrow {
    font-size: 16px;
    line-height: 1;
}

/* Состояние успеха */
.cm-modal__success {
    display: none;
    padding: 20px 0 8px;
    text-align: center;
}

.cm-modal__success.is-visible {
    display: block;
}

.cm-modal__success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    background: var(--cm-bg-light);
    color: var(--cm-accent);
    font-size: 28px;
    font-weight: 700;
}

.cm-modal__success-text {
    margin: 0;
    color: var(--cm-dark);
    font-family: var(--cm-font);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
}

.cm-modal--success .cm-modal__form-wrap {
    display: none;
}

/* Honeypot — скрытое поле */
.cm-modal__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Телефон у логотипа: только мобильная шапка */
.mobphone {
    display: none;
}

/* На мобильном: сначала текст страницы, затем левая колонка с услугами и телефонами */
@media (max-width: 991.98px) {
    a.mobphone {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-left: 4px;
        margin-right: auto;
        padding: 8px 12px;
        border-radius: 8px;
        background: #ff322e;
        color: #fff !important;
        font-size: 13px;
        font-weight: 700;
        line-height: 1.15;
        letter-spacing: 0.01em;
        text-decoration: none;
        white-space: nowrap;
        box-shadow: 0 2px 8px rgba(255, 50, 46, 0.28);
        -webkit-tap-highlight-color: transparent;
    }

    a.mobphone::before {
        content: '';
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        background-color: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1.1-.2 1.2.4 2.5.6 3.8.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.6 21 3 13.4 3 4c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.6.6 3.8.1.4 0 .8-.3 1.1L6.6 10.8z'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1.1-.2 1.2.4 2.5.6 3.8.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.6 21 3 13.4 3 4c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.6.6 3.8.1.4 0 .8-.3 1.1L6.6 10.8z'/%3E%3C/svg%3E") center / contain no-repeat;
    }

    a.mobphone:hover,
    a.mobphone:focus-visible {
        background: #e02b27;
        color: #fff !important;
    }

    .navbar > .container {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .navbar-brand {
        width: 118px;
        flex-shrink: 0;
    }

    .life_insurance_section > .container > .row {
        display: flex;
        flex-direction: column;
    }

    .life_insurance_section > .container > .row > .col-lg-8 {
        order: 1;
    }

    .life_insurance_section > .container > .row > .col-lg-4 {
        order: 2;
        margin-top: 24px;
    }

    .common_banner_section {
        min-height: 220px;
        padding: 72px 12px 40px;
    }

    .common_banner_content h1 {
        font-size: 22px;
        line-height: 1.3;
        margin-bottom: 0;
        overflow-wrap: break-word;
    }

    .common_banner_bottom {
        bottom: -28px;
        padding: 0 12px;
    }

    .common_banner_bottom_content {
        height: auto;
        min-height: 0;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        gap: 6px 0;
        padding: 10px 14px;
        overflow: hidden;
    }

    .common_banner_bottom_content .text_home {
        font-size: 12px;
        line-height: 1.35;
        letter-spacing: 0.02em;
        font-weight: 600;
        text-transform: none;
        gap: 6px;
        max-width: 100%;
        min-width: 0;
    }

    .common_banner_bottom_content .text_home a,
    .common_banner_bottom_content .text_home p {
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .common_banner_bottom_content .text_home .icon,
    .common_banner_bottom_content .ensurx-home {
        font-size: 14px;
        margin-top: 0;
    }

    /* Декоративные линии крошек вылезают за экран — заменяем на короткий разделитель */
    .common_banner_bottom_content .common_divider::before {
        content: none;
    }

    .common_banner_bottom_content .common_divider::after {
        content: '/';
        position: static;
        width: auto;
        height: auto;
        margin-left: 8px;
        margin-right: 8px;
        background: none;
        border-radius: 0;
        transform: none;
        color: #b0b4ba;
        font-size: 12px;
        font-weight: 400;
        letter-spacing: 0;
    }

    .life_insurance_section {
        padding-top: 52px;
        padding-bottom: 24px;
    }

    .insurance_right_main h1 {
        font-size: 22px;
        line-height: 1.3;
        margin: 0 0 12px;
        overflow-wrap: break-word;
    }

    .insurance_right_main h2 {
        font-size: 18px;
        line-height: 1.3;
        margin: 20px 0 10px;
        overflow-wrap: break-word;
    }

    .insurance_right_main h3 {
        font-size: 16px;
        line-height: 1.35;
        margin: 16px 0 8px;
    }

    .insurance_right_main h4,
    .insurance_right_main h5 {
        font-size: 15px;
        line-height: 1.4;
        margin: 14px 0 8px;
    }

    .insurance_right_main p,
    .insurance_right_main li {
        font-size: 15px;
        line-height: 1.55;
    }

    .insurance_right_main p {
        margin: 0 0 12px;
    }

    .insurance_right_main ul,
    .insurance_right_main ol {
        margin: 0 0 12px;
        padding-left: 1.2em;
    }

    .insurance_right_main li {
        margin-bottom: 6px;
    }

    .insurance_left_main h3 {
        font-size: 18px;
        margin-bottom: 16px;
        line-height: 1.3;
    }

    .insurance_left_service,
    .insurance_left_download {
        padding: 22px 16px;
    }

    .left_service_wrapper {
        margin-top: 12px;
        height: auto;
        min-height: 48px;
        padding-left: 12px;
    }

    .left_service_wrapper h4 {
        font-size: 15px;
        line-height: 1.3;
    }

    .download_inside_content h5 {
        font-size: 14px;
        line-height: 1.3;
    }

    .download_inside_content p {
        font-size: 12px;
        line-height: 1.3;
    }
}

/* Мобильная адаптация */
@media (max-width: 575.98px) {
    .common_banner_section {
        min-height: 180px;
        padding: 64px 10px 36px;
    }

    .common_banner_content h1 {
        font-size: 18px;
        line-height: 1.28;
    }

    .insurance_right_main h1 {
        font-size: 20px;
    }

    .insurance_right_main h2 {
        font-size: 17px;
    }

    .insurance_right_main p,
    .insurance_right_main li {
        font-size: 14px;
        line-height: 1.5;
    }

    .life_insurance_section {
        padding-top: 44px;
    }

    a.mobphone {
        font-size: 12px;
        padding: 7px 10px;
    }

    .navbar-brand {
        width: 100px;
    }

    .cm-modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .cm-modal {
        max-height: calc(100vh - 24px);
    }

    .cm-modal__inner {
        padding: 28px 20px 24px 28px;
    }

    .cm-modal__title {
        font-size: 18px;
        padding-right: 24px;
    }

    .cm-modal__text {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .cm-modal__field input[type='tel'] {
        font-size: 16px; /* предотвращает zoom на iOS */
    }

    .cm-modal__submit {
        padding: 13px 20px;
        font-size: 13px;
    }
}
