:root {
    --primary-peach: #d17d21;

    --height-default: 375px;
    --width-default: 320px;

    --height-chat-closed: 45px;
    --scale-chat-mobile: 70px;
}

body {
    font-family: Arial, sans-serif;
}

#chat-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: var(--width-default);
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: aparecer 0.3s ease-out;
    z-index: 10000;
}

#chat-res {
    display: none;
}

#chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-peach);
    color: white;
    padding: 12px;
    font-weight: bold;
    font-size: 15px;
}

#chat-header #chat-close {
    display: block;
    padding: 0px 5px;
    cursor: pointer;
}

#chat-header #chat-close svg {
    --tamanho: 10px;
    width: var(--tamanho);
    height: var(--tamanho);
    transform: scale(2.5);
}

#chat-header #chat-open-desktop svg {
    --tamanho: 10px;
    width: var(--tamanho);
    height: var(--tamanho);
    transform: scale(2) translateX(-2px);
    cursor: pointer;
}

#chat-messages {
    position: relative;
    height: 286px;
    padding: 12px;
    overflow-y: auto;
    font-size: 14px;
    background: #fafafa;
}

.msg {
    margin-bottom: 10px;
    line-height: 1.4;
}

.bot {
    color: var(--primary-peach);
}

.user {
    text-align: right;
    color: #333;
}

.options button {
    display: block;
    width: 100%;
    margin: 6px 0;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #eee;
    background: white;
    cursor: pointer;
    transition: 0.2s;
}

.options button:hover {
    background: var(--primary-peach);
    color: white;
    border-color: var(--primary-peach);
}

#chat-input {
    display: flex;
    border-top: 1px solid #eee;
}

#chat-input input {
    flex: 1;
    border: none;
    padding: 10px;
    outline: none;
}

#chat-input button {
    border: none;
    background: var(--primary-peach);
    color: white;
    padding: 10px 14px;
    cursor: pointer;
}

#chat-messages .whatsapp-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--primary-peach);
    color: white;
    cursor: pointer;
}

@keyframes aparecer {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 1218px) {
    #chat-box {
        bottom: 80px;
    }
}

@media (min-width: 900px) {
    #chat-box {
        bottom: 95px;
    }
}

@media (min-width: 768px) {
    #chat-box {
        width: 320px;
        height: var(--height-default);
        bottom: 105px;
    }

    #chat-box.open {
        animation: animationChatOpen .6s linear 0s forwards;
    }

    #chat-box:not(.loaded, .open) {
        animation: animationChatClose .6s linear 0s forwards;
    }

    #chat-box.open #chat-close,
    #chat-box #chat-open-desktop {
        display: block;
    }

    #chat-box #chat-close,
    #chat-box.open #chat-open-desktop {
        display: none;
    }

    #chat-header {
        height: var(--height-chat-closed);
        padding: 0px 15px;
    }


    @keyframes animationChatOpen {
        from {
            height: var(--height-chat-closed);
        }

        to {
            height: var(--height-default);
        }
    }

    @keyframes animationChatClose {
        from {
            height: var(--height-default);
        }

        to {
            height: var(--height-chat-closed);
        }
    }

}

@media (max-width: 768px) {
    #chat-box {
        height: calc(var(--height-default) + 200px);
        right: 20px;
        left: auto;
        transition: border-radius 0.3s ease;
    }

    #chat-messages {
        height: calc(100% - 92px);
        font-size: 15px;
    }

    .options button,
    #chat-messages .whatsapp-btn {
        font-size: 16px;
    }

    #chat-open-desktop {
        display: none;
    }

    #chat-box:not(.loaded) {
        width: auto;
        height: calc(var(--height-default) + 200px);
    }

    #chat-box:not(.open),
    #chat-box.loaded {
        width: var(--scale-chat-mobile);
        height: var(--scale-chat-mobile);
    }

    #chat-box:not(.loaded, .open) {
        left: auto;
        right: 20px;
        animation: animationContainerChatClose 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    #chat-box.open {
        right: 20px;
        width: calc(100vw - 40px);
        animation: animationContainerChatOpen 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    #chat-res {
        position: absolute;
        background-color: var(--primary-peach);
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #fff;
        overflow: hidden;
    }

    #chat-box:not(.loaded, .open) #chat-res {
        animation: animationIconChat .3s linear 0s forwards;
    }

    #chat-box.open #chat-res {
        animation: animationIconChatOpen .5s linear .6s forwards;
    }

    #chat-res svg {
        --tamanho: 30px;
        width: var(--tamanho);
        height: var(--tamanho);
    }

    @keyframes animationIconChat {
        from {
            width: 0%;
            height: 0%;
        }

        to {
            width: 100%;
            height: 100%;
        }
    }


    @keyframes animationIconChatOpen {
        from {
            opacity: 1;
        }

        to {
            opacity: 0;
            z-index: -1;
        }
    }

    @keyframes animationContainerChatOpen {
        from {
            width: var(--scale-chat-mobile);
            height: var(--scale-chat-mobile);
        }

        to {
            width: calc(100vw - 40px);
            height: calc(var(--height-default) + 200px);
        }
    }

    @keyframes animationContainerChatClose {
        from {
            width: calc(100vw - 40px);
            height: calc(var(--height-default) + 200px);
        }

        to {
            width: var(--scale-chat-mobile);
            height: var(--scale-chat-mobile);
        }
    }
}

@media (max-width: 488px) {
    #chat-box {
        bottom: 180px;
    }
}