/* CSS exclusivo para o chat flutuante */
.mi-chat, .mi-chat-opener {
    all: initial;
    font-size: initial;
    position: absolute;
    z-index: 99999999;
    top: 0;
    left: 0;
}

/* Estilos do atendente */
.mi-chat .mi-attendant,
.mi-chat-opener .mi-attendant {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.mi-chat .mi-attendant .mi-attendant-avatar,
.mi-chat-opener .mi-attendant .mi-attendant-avatar {
    position: relative;
    background: no-repeat center;
    background-size: cover;
    width: 60px;
    height: 60px;
    margin-right: 1rem;
    border-radius: 50%;
}

/* Indicador online */
.mi-chat .mi-attendant .mi-attendant-avatar:after,
.mi-chat-opener .mi-attendant .mi-attendant-avatar:after {
    position: absolute;
    bottom: 3px;
    right: 0px;
    display: block;
    content: " ";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2ecc71;
    border: 2px solid #000;
}

.mi-chat .mi-attendant .mi-attendant-name ._attendant_name,
.mi-chat-opener .mi-attendant .mi-attendant-name ._attendant_name {
    font-size: 14px;
}

.mi-chat .mi-attendant .mi-attendant-name ._attendant_status,
.mi-chat-opener .mi-attendant .mi-attendant-name ._attendant_status {
    padding-top: 4px;
    font-size: 12px;
}

/* Container principal */
.mi-chat .mi-wrapper,
.mi-chat-opener .mi-wrapper {
    display: flex;
    flex-direction: column;
    flex-wrap: no-wrap;
    width: 420px;
    max-height: 500px;
    border-radius: 6px !important;
    overflow: hidden;
    position: fixed;
    z-index: 32767;
    bottom: 24px;
    right: 24px;
}

/* Header do chat */
.mi-chat .mi-wrapper .mi-header,
.mi-chat-opener .mi-wrapper .mi-header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

/* Botão fechar */
.mi-chat .mi-wrapper .mi-header .mi-chat-close,
.mi-chat-opener .mi-wrapper .mi-header .mi-chat-close {
    background: no-repeat center;
    background-size: cover;
    width: 20px;
    height: 20px;
    margin-right: .5rem;
    cursor: pointer;
    opacity: .8;
}

.mi-chat .mi-wrapper .mi-header .mi-chat-close:hover,
.mi-chat-opener .mi-wrapper .mi-header .mi-chat-close:hover {
    opacity: 1;
}

/* Janela de mensagens */
.mi-chat .mi-wrapper .mi-window,
.mi-chat-opener .mi-wrapper .mi-window {
    flex-grow: 1;
    padding: 0;
    font-size: 13px;
    line-height: 16px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    transition: all .3s ease;
}

/* Mensagens */
.mi-chat .mi-wrapper .mi-window ._mi_message,
.mi-chat-opener .mi-wrapper .mi-window ._mi_message {
    align-self: flex-start;
    margin: 12px 12px 0;
    padding: 14px 22px;
    border-radius: 45px;
    transition: all .3s ease;
}

/* Loading */
.mi-chat .mi-wrapper .mi-window ._mi_message._mi_loading,
.mi-chat-opener .mi-wrapper .mi-window ._mi_message._mi_loading {
    background: no-repeat center;
    background-size: 50% auto;
    background-image: url(../img/loading.gif);
    margin-bottom: 20px;
}

/* Mensagem de resposta do usuário */
.mi-chat .mi-wrapper .mi-window ._mi_response,
.mi-chat-opener .mi-wrapper .mi-window ._mi_response {
    align-self: flex-end;
}

/* Grupos de input */
.mi-chat .mi-wrapper .mi-window .group,
.mi-chat-opener .mi-wrapper .mi-window .group {
    align-self: flex-end;
}

/* Botões múltiplos */
.mi-chat .mi-wrapper .mi-window .group.group-button,
.mi-chat-opener .mi-wrapper .mi-window .group.group-button {
    padding: 7px 7px 14px;
    text-align: right;
}

.mi-chat .mi-wrapper .mi-window .group.group-button button.executePath,
.mi-chat-opener .mi-wrapper .mi-window .group.group-button button.executePath {
    font-size: inherit;
    -webkit-appearance: none;
    border: none;
    cursor: pointer;
    padding: 14px 22px;
    border-radius: 45px;
    margin: 7px 7px 0 0;
}

/* Input de texto */
.mi-chat .mi-wrapper .mi-window .group.group-text,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text {
    position: relative;
    padding: 14px;
    width: 100%;
    box-sizing: border-box;
}

.mi-chat .mi-wrapper .mi-window .group.group-text input,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text input {
    font-size: inherit;
    -webkit-appearance: none;
    box-sizing: border-box;
    border: 2px solid #000;
    border-radius: 50px;
    width: 100%;
    padding: 14px;
}

.mi-chat .mi-wrapper .mi-window .group.group-text input:focus,
.mi-chat .mi-wrapper .mi-window .group.group-text input:active,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text input:focus,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text input:active {
    outline: none;
}

.mi-chat .mi-wrapper .mi-window .group.group-text input.error,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text input.error {
    border-color: red !important;
}

/* Botão de enviar */
.mi-chat .mi-wrapper .mi-window .group.group-text div._m_btn,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text div._m_btn {
    -webkit-appearance: none;
    position: absolute;
    top: 50%;
    right: 20px;
    border-radius: 50%;
    border: none;
    transform: translateY(-50%);
    cursor: pointer;
    width: 38px;
    height: 38px;
}

.mi-chat .mi-wrapper .mi-window .group.group-text div._m_btn:hover,
.mi-chat-opener .mi-wrapper .mi-window .group.group-text div._m_btn:hover {
    background-color: #333;
}

/* Tema do chat */
.mi-chat {
    font-family: inherit;
}

.mi-chat .mi-wrapper {
    background: #fff;
}

.mi-chat .mi-wrapper .mi-header {
    background: #000;
    color: #fff;
}

.mi-chat .mi-wrapper .mi-header .mi-attendant-name ._attendant_status {
    color: #9f9f9f;
}

.mi-chat .mi-wrapper .mi-header .mi-chat-close {
    background-image: url(../img/close.png);
}

.mi-chat .mi-wrapper .mi-window ._mi_message:not(._mi_response) {
    background-color: #eee;
}

.mi-chat .mi-wrapper .mi-window ._mi_response {
    background: #212121;
    color: #fff;
}

.mi-chat .mi-wrapper .mi-window .group button.executePath {
    background: rgba(0,0,0,0);
    border: 2px solid #212121 !important;
    color: #212121;
}

.mi-chat .mi-wrapper .mi-window .group button.executePath:hover {
    background-color: #212121;
    color: #fff;
}

.mi-chat .mi-wrapper .mi-window .group.group-text div._m_btn {
    background: #000 no-repeat center;
    background-size: 15px auto;
    background-image: 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='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-send'%3E%3Cline x1='22' y1='2' x2='11' y2='13'%3E%3C/line%3E%3Cpolygon points='22 2 15 22 11 13 2 9 22 2'%3E%3C/polygon%3E%3C/svg%3E");
}

/* Opener - Botão que abre o chat */
.mi-chat-opener {
    font-family: inherit;
    cursor: pointer;
}

.mi-chat-opener .mi-wrapper {
    width: initial;
    max-height: initial;
    flex-direction: row;
    align-items: center;
}

.mi-chat-opener .mi-message-box {
    position: relative;
    font-family: inherit;
    display: flex;
    background: #fff;
    padding: .75rem;
    font-size: .9rem;
    border-radius: 4px;
}

.mi-chat-opener .mi-message-box:after {
    position: absolute;
    top: 50%;
    right: -8px;
    display: block;
    content: " ";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8.7px;
    border-color: transparent transparent transparent #fff;
    transform: translateY(-50%);
}

.mi-chat-opener .mi-attendant .mi-attendant-avatar {
    margin: 0 0 0 1rem;
}

/* Responsividade para mobile */
@media(max-width: 468px) {
    .mi-chat .mi-wrapper {
        right: 0;
        bottom: 0;
        width: 100%;
        top: 0;
        max-height: 100%;
        border-radius: 0px !important;
    }

    .mi-chat .mi-wrapper .mi-window .group.group-text {
        font-size: 16px;
    }
}
