/* ── Popup system ─────────────────────────────────────────────────────────── */

.popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ds-color-overlay);
    z-index: var(--ds-z-dropdown);
    display: none;
    overflow-y: auto;
    padding: 56px 12px 24px;
    box-sizing: border-box;
}
.popup {
    position: relative;
    top: auto;
    left: auto;
    width: min(600px, calc(100vw - 24px));
    margin: 0 auto;
    box-sizing: border-box;
    padding: var(--ds-space-7-5);
    background: var(--ds-color-white);
    max-height: none;
}
.popup-big {
    width: min(900px, calc(100vw - 24px));
    margin-left: auto;
}
.popup-close {
    position: absolute;
    width: 31px;
    height: 31px;
    top: -30px;
    right: -30px;
    cursor: pointer;
    border: var(--ds-space-px) solid var(--ds-color-heading);
    border-radius: var(--ds-radius-full);
    padding: 0;
    font-size: 0;
    background: var(--ds-color-heading);
    --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18' /%3E%3Cpath d='m6 6 12 12' /%3E%3C/svg%3E");
    -webkit-mask-image: var(--mask);
    mask-image: var(--mask);
    -webkit-mask-size: 60%;
    mask-size: 60%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transition: opacity 0.1s linear;
}
.popup-close:hover {
    opacity: 0.8;
}
.popup-title {
    font-size: 25px;
    color: var(--ds-color-heading);
    margin-bottom: var(--ds-space-7-5);
    font-weight: 700;
}
.popup-subtitle {
    font-size: var(--ds-font-size-lg);
    font-weight: 400;
}
.popup-content {
    padding-bottom: 15px;
    overflow-y: auto;
    max-height: calc(100dvh - 180px);
    padding-right: var(--ds-space-7-5);
    margin-right: -30px;
}
.popup-content .button-gr {
    text-decoration: none !important;
    color: var(--ds-color-white) !important;
    margin-bottom: 0;
    margin-top: var(--ds-space-7-5);
}
.popup-content ul,
.popup-content ol {
    padding-left: var(--ds-space-5);
    margin-bottom: var(--ds-space-5);
}
.popup-content ul li {
    font-size: var(--ds-font-size-md);
    line-height: 1.25em;
    margin-bottom: var(--ds-space-1);
}
.popup-content ol ul {
    margin-top: var(--ds-space-2-5);
}
.popup-content .b24-web-form-popup-btn-22 {
    border: none;
    border-radius: 0;
    color: var(--ds-color-white);
    background-color: var(--ds-color-link);
    font: var(--ds-font-size-lg) var(--ds-font-family);
    padding: var(--ds-space-1-25) 15px;
}
.popup-content .b24-web-form-popup-btn-22:hover {
    opacity: 0.8;
}

.bitrix-chat-placeholder {
    position: fixed;
    right: var(--ds-space-6);
    bottom: var(--ds-space-6);
    display: flex;
    align-items: flex-end;
    gap: var(--ds-space-2-5);
    z-index: 998;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.bitrix-chat-placeholder.is-hidden {
    display: none;
    opacity: 0;
    visibility: hidden;
}

.bitrix-chat-placeholder__label {
    width: 140px;
    height: 26px;
    border-radius: var(--ds-radius-pill);
    background: rgba(13, 31, 60, 0.1);
}

.bitrix-chat-placeholder__bubble {
    width: 56px;
    height: 56px;
    border-radius: var(--ds-radius-full);
    background: linear-gradient(135deg, var(--ds-color-link), var(--ds-color-brand-sky-soft));
    box-shadow: var(--ds-shadow-popover);
}

/* ── Popup responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
    .popup-close {
        right: var(--ds-space-1-25);
        top: -36px;
    }
}
@media (max-width: 900px) {
    .popup-big {
        width: 100%;
        margin-left: 0;
    }
}
@media (max-width: 600px) {
    .popup {
        width: 100%;
        margin: 0 auto;
        left: auto;
    }
    .popup-close {
        top: var(--ds-space-1-25);
        right: var(--ds-space-1-25);
    }

    .bitrix-chat-placeholder {
        right: var(--ds-space-4);
        bottom: var(--ds-space-4);
        gap: var(--ds-space-2);
    }

    .bitrix-chat-placeholder__label {
        width: 104px;
    }

    .bitrix-chat-placeholder__bubble {
        width: var(--ds-space-12-5);
        height: var(--ds-space-12-5);
    }
}
@media (max-height: 800px) {
    .popup {
        top: 0;
    }
    .popup-close {
        top: var(--ds-space-1-25);
    }
}
