/* Bot Helper IA — box de conversas do assistente.
 * Não usa classes .pb-* (órfãs no tema). */

.contact-bot .contact-name i {
    margin-right: 6px;
}

.bot-helper-preview {
    font-style: italic;
}

.bot-helper-toggle {
    cursor: pointer;
}

/* ---------------------------------------------------------------- box */

.bot-helper-box {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 720px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.bot-helper-box.bot-helper-aberto,
.bot-helper-box.bot-helper-minimizado {
    display: flex;
}

.bot-helper-box.bot-helper-minimizado {
    width: auto;
    min-width: 280px;
}

.bot-helper-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--chat-primary-color, #2c3e50);
    color: var(--chat-secondary-color, #fff);
    cursor: pointer;
    user-select: none;
}

.bot-helper-titulo {
    font-weight: 500;
    font-size: 14px;
}

/* Indicador da sessao: em andamento / finalizada / erro. */
.bot-helper-status-sessao {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.9;
}

.bot-helper-status-sessao[data-status="ocioso"] i {
    opacity: 0.55;
}

.bot-helper-status-sessao[data-status="andamento"] i {
    color: #ffd479;
}

.bot-helper-status-sessao[data-status="finalizada"] i {
    color: #8ce99a;
}

.bot-helper-status-sessao[data-status="erro"] i {
    color: #ff8787;
}

.bot-helper-bar-acoes {
    display: flex;
    gap: 4px;
}

.bot-helper-btn,
.bot-helper-btn-pequeno {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
}

.bot-helper-btn:hover,
.bot-helper-btn-pequeno:hover {
    background: rgba(255, 255, 255, 0.18);
}

.bot-helper-corpo {
    display: flex;
    flex-direction: row;
    min-height: 380px;
    height: 460px;
}

/* ------------------------------------------------------- lista de conversas */

.bot-helper-conversas {
    width: 210px;
    flex: 0 0 210px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #f7f7f7;
}

.bot-helper-sem-conversas {
    padding: 12px;
    font-size: 12px;
    color: #757575;
}

.bot-helper-conversa-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #ececec;
    font-size: 13px;
}

.bot-helper-conversa-item:hover {
    background: #ececec;
}

.bot-helper-conversa-ativa {
    background: #e2eefc;
    font-weight: 500;
}

.bot-helper-conversa-titulo {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Estado da sessao na lista de conversas. */
.bot-helper-conversa-estado {
    font-size: 11px;
    line-height: 1;
    color: #999;
}

.bot-helper-conversa-estado[data-status="andamento"] {
    color: #d97706;
}

.bot-helper-conversa-estado[data-status="finalizada"] {
    color: #2f9e44;
}

.bot-helper-conversa-acoes {
    display: flex;
    gap: 2px;
    opacity: 0;
}

.bot-helper-conversa-item:hover .bot-helper-conversa-acoes,
.bot-helper-conversa-ativa .bot-helper-conversa-acoes {
    opacity: 1;
}

.bot-helper-conversa-acoes .bot-helper-btn-pequeno {
    color: #555;
    font-size: 11px;
    padding: 2px 4px;
}

/* ------------------------------------------------------ conversa ativa */

.bot-helper-conversa {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bot-helper-mensagens {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.bot-helper-mensagens .message {
    max-width: 85%;
    margin-bottom: 10px;
    padding: 7px 9px;
    border-radius: 7px;
}

.bot-helper-mensagens .message.incoming {
    align-self: flex-start;
    background: #ececec;
}

.bot-helper-mensagens .message.outgoing {
    align-self: flex-end;
    background: #dcf8c6;
}

.bot-helper-mensagens .message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.bot-helper-input-linha {
    display: flex;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
}

.bot-helper-input {
    flex: 1;
    border: none;
    padding: 6px;
    outline: none;
    min-width: 0;
}

.bot-helper-btn-enviar {
    background: var(--chat-primary-color, #2c3e50);
    color: var(--chat-secondary-color, #fff);
    border: none;
    padding: 6px 12px;
    cursor: pointer;
}

/* ---------------------------------------------------------------- extras */

.bot-helper-dots::after {
    content: '...';
    animation: bot-helper-blink 1.2s infinite steps(2, start);
}

@keyframes bot-helper-blink {
    to { visibility: hidden; }
}

/* Plano de investigacao: o que o bot vai verificar. */
.bot-helper-plano {
    opacity: 0.92;
}

.bot-helper-plano-titulo {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.85;
}

.bot-helper-plano-lista {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    line-height: 1.45;
}

.bot-helper-plano-lista li {
    margin-bottom: 2px;
}

/* Pensamento do modelo, em tempo real. */
.bot-helper-pensamento {
    opacity: 0.8;
}

.bot-helper-pensamento-texto {
    font-size: 12px;
    font-style: italic;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Resposta sendo escrita: mesmo balao da resposta final, sem o cartao
   de fontes (esse chega quando o turno termina). */
.bot-helper-escrevendo-texto {
    white-space: pre-wrap;
    word-break: break-word;
}

.bot-helper-fontes,
.bot-helper-escopos {
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.85;
}

.bot-helper-fontes ul,
.bot-helper-escopos ul {
    margin: 2px 0 0;
    padding-left: 16px;
}

.bot-helper-memoria {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    font-style: italic;
    opacity: 0.8;
}

.bot-helper-erro .message-text {
    color: #b80531;
}

.bot-helper-reenviar {
    margin-top: 6px;
    background: none;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}
