:root {
    --bd-purple: #9d29d0;
    --bd-black: #000000;
    --bd-white: #ffffff;
    --bd-background: #f7f7f8;
    --bd-border: #e8e8e8;
    --bd-text: #171717;
    --bd-muted: #777777;
}

#bd-chat-button,
#bd-chat-window,
#bd-chat-invite {
    font-family: Arial, Helvetica, sans-serif;
    box-sizing: border-box;
}

#bd-chat-button {
    position: fixed;
    right: 25px;
    bottom: 25px;

    width: 64px;
    height: 64px;

    border: 0;
    border-radius: 50%;

    background: var(--bd-purple);
    color: var(--bd-white);

    font-size: 25px;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;

    z-index: 999999;

    box-shadow:
        0 8px 30px rgba(157, 41, 208, .30);

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

#bd-chat-button:hover {
    transform: translateY(-3px) scale(1.03);

    box-shadow:
        0 12px 35px rgba(157, 41, 208, .40);
}


/* WINDOW */

#bd-chat-window {
    position: fixed;

    right: 25px;
    bottom: 100px;

    width: 390px;
    height: 570px;

    background: var(--bd-white);

    border-radius: 18px;

    box-shadow:
        0 15px 60px rgba(0, 0, 0, .22);

    z-index: 999998;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(20px) scale(.97);

    transform-origin:
        bottom right;

    transition:
        opacity .2s ease,
        transform .2s ease,
        visibility .2s;
}

#bd-chat-window.open {
    opacity: 1;
    visibility: visible;

    transform:
        translateY(0) scale(1);
}


/* HEADER */

#bd-chat-header {
    min-height: 72px;

    background: var(--bd-purple);
    color: var(--bd-white);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 18px;
}

.bd-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bd-chat-header-info strong {
    display: block;
    font-size: 15px;
}

.bd-chat-header-info span {
    display: block;

    margin-top: 3px;

    font-size: 12px;

    opacity: .7;
}

.bd-chat-avatar {
    width: 42px;
    height: 42px;

    border-radius: 50%;

    background: var(--bd-white);
    color: var(--bd-purple);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 13px;
    font-weight: 800;

    box-shadow: 0 2px 8px rgba(0, 0, 0, .10);
}

#bd-chat-close {
    border: 0;
    background: transparent;

    color: var(--bd-white);

    font-size: 27px;
    line-height: 1;

    cursor: pointer;

    opacity: .8;
}


/* MESSAGES */

#bd-chat-messages {
    flex: 1;

    overflow-y: auto;

    padding: 20px 16px;

    background: var(--bd-background);
}

.bd-message {
    display: flex;

    margin-bottom: 14px;
}

.bd-message-content {
    max-width: 82%;

    padding: 11px 14px;

    border-radius: 15px;

    font-size: 14px;
    line-height: 1.5;

    word-break: break-word;
}

.bd-message-bot {
    justify-content: flex-start;
}

.bd-message-bot .bd-message-content {
    background: var(--bd-white);
    color: #222;

    border-bottom-left-radius: 5px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, .05);
}

.bd-message-user {
    justify-content: flex-end;
}

.bd-message-user .bd-message-content {
    background: var(--bd-purple);
    color: var(--bd-white);

    border-bottom-right-radius: 5px;
}


/* TYPING */

#bd-chat-typing {
    display: none;

    align-items: center;

    gap: 4px;

    padding:
        8px 18px 4px;

    background: var(--bd-background);

    color: #777;
}

#bd-chat-typing.show {
    display: flex;
}

#bd-chat-typing span {
    width: 6px;
    height: 6px;

    background: #777;

    border-radius: 50%;

    animation:
        bdTyping 1.2s infinite ease-in-out;
}

#bd-chat-typing span:nth-child(2) {
    animation-delay: .15s;
}

#bd-chat-typing span:nth-child(3) {
    animation-delay: .3s;
}

#bd-chat-typing small {
    margin-left: 5px;
}

@keyframes bdTyping {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


/* FORM */

#bd-chat-form {
    display: flex;
    align-items: flex-end;

    gap: 10px;

    padding: 13px;

    border-top:
        1px solid #eee;

    background: var(--bd-white);
}

#bd-chat-input {
    flex: 1;

    min-height: 42px;
    max-height: 100px;

    padding:
        11px 13px;

    resize: none;

    border:
        1px solid #ddd;

    border-radius: 12px;

    outline: none;

    font-family: inherit;
    font-size: 14px;

    box-sizing: border-box;
}

#bd-chat-input:focus {
    border-color: var(--bd-purple);
    box-shadow: 0 0 0 2px rgba(157, 41, 208, .08);
}

#bd-chat-send {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: 0;
    border-radius: 50%;

    background: var(--bd-purple);
    color: var(--bd-white);

    cursor: pointer;

    font-size: 17px;
}

#bd-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
}

#bd-chat-send:disabled {
    opacity: .4;
    cursor: default;
}


/* INVITATION */

#bd-chat-invite {
    position: fixed;

    right: 25px;
    bottom: 100px;

    width: 285px;

    padding: 16px 38px 16px 17px;

    background: var(--bd-white);
    color: #222;

    border-left: 4px solid var(--bd-purple);
    border-radius: 14px;

    box-shadow:
        0 8px 35px rgba(0, 0, 0, .18);

    z-index: 999997;

    cursor: pointer;

    opacity: 0;
    visibility: hidden;

    transform: translateY(10px);

    transition:
        opacity .25s ease,
        transform .25s ease,
        visibility .25s;
}

#bd-chat-invite.show {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);
}

#bd-chat-invite strong {
    display: block;

    margin-bottom: 5px;

    font-size: 14px;
}

#bd-chat-invite span {
    display: block;

    font-size: 13px;
    line-height: 1.45;
}

#bd-chat-invite-close {
    position: absolute;

    right: 8px;
    top: 7px;

    border: 0;
    background: transparent;

    color: #777;

    font-size: 20px;

    cursor: pointer;
}

.bd-message-bot .bd-message-content strong {
    font-weight: 700;
}

.bd-message-bot .bd-message-content ul {
    margin: 8px 0 8px 18px;
    padding: 0;
}

.bd-message-bot .bd-message-content li {
    margin: 4px 0;
}

.bd-chat-paragraph {
    margin-bottom: 7px;
}

.bd-chat-paragraph:last-child {
    margin-bottom: 0;
}



/* QUICK ACTIONS */

#bd-chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 4px 0 18px;
}

#bd-chat-quick-actions button {
    border: 1px solid rgba(157, 41, 208, .30);
    background: var(--bd-white);
    color: #7d1da7;
    border-radius: 20px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;

    transition:
        background .15s ease,
        color .15s ease,
        border-color .15s ease,
        transform .15s ease;
}

#bd-chat-quick-actions button:hover {
    background: var(--bd-purple);
    color: var(--bd-white);
    border-color: var(--bd-purple);
    transform: translateY(-1px);
}

.bd-chat-button-icon {
    width: 50px;
    height: 50px;
    display: block;
    object-fit: contain;
    object-position: center;
    margin: 0;
    pointer-events: none;
}

/* MOBILE */

@media (max-width: 600px) {

    #bd-chat-button {
        right: 16px;
        bottom: 16px;

        width: 58px;
        height: 58px;
    }

    .bd-chat-button-icon {
        width: 46px;
        height: 46px;
    }

    #bd-chat-window {
        right: 10px;
        bottom: 84px;

        width:
            calc(100vw - 20px);

        height:
            min(650px, calc(100vh - 105px));

        border-radius: 16px;
    }

    #bd-chat-invite {
        right: 16px;
        bottom: 88px;

        width:
            calc(100vw - 70px);

        max-width: 285px;
    }
}