/* --- Botão Flutuante (Estilo Original do Itamar) --- */
.chat-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 10px 20px;
    border-radius: 40px;
    height: auto;
    min-height: 60px;
    background-color: #f05f40; /* Laranja do tema */
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.chat-floating-btn:hover {
    transform: scale(1.05) translateY(-2px);
    background-color: #e04f30;
}

.assistant-branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    object-fit: cover;
}

.assistant-label {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Janela do Chat (Estilo Original + Correções) --- */
.chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Cabeçalho */
.chat-header {
    background-color: #212529;
    color: #ffffff;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.assistant-branding-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.assistant-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.online-indicator {
    width: 9px;
    height: 9px;
    background-color: #2ec4b6;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px #2ec4b6;
}

/* --- Estrutura das Mensagens e Corpo do Chat --- */
.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fdfdfd;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    overflow-y: auto;
}

.message-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 85%;
}

.iris-row {
    align-self: flex-start;
    flex-direction: row;
}

.user-row {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #dee2e6;
    flex-shrink: 0;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.42;
    word-break: break-word;
}

.iris-row .message-bubble {
    background-color: #f1f3f5;
    color: #212529;
    border-top-left-radius: 4px;
    border: 1px solid #e9ecef;
}

.user-row .message-bubble {
    background-color: #f05f40; /* Laranja Corporativo */
    color: #ffffff;
    border-top-right-radius: 4px;
}

/* Rodapé fixo */
.chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
}

.chat-footer input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ced4da;
    border-radius: 24px;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.chat-footer input:focus {
    border-color: #f05f40;
}

.chat-footer button {
    background-color: #f05f40;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.chat-footer button:hover:not(:disabled) {
    background-color: #e04f30;
}

.chat-footer button:disabled {
    background-color: #cccccc;
    color: #888888;
    cursor: not-allowed;
}

/* Animação dos três pontinhos */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
}

.typing-bubble .dot {
    width: 6px;
    height: 6px;
    background-color: #6c757d;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-bubble .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-bubble .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Container para abraçar o rodapé e o contador */
.chat-footer-container {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
}

/* Ajuste do padding do rodapé original para não acumular espaço */
.chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 4px 16px; /* Menos padding embaixo */
    border-top: none; /* Removido pois a borda agora fica no container pai */
}

/* Estilo do Contador */
.char-counter {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: right;
    padding: 0 24px 8px 0; /* Alinhado à direita, abaixo do input */
    font-family: monospace; /* Facilita a leitura de números mudando */
}

/* Destaque quando chegar a 90 caracteres */
.char-counter.counter-warn {
    color: #dc3545;
    font-weight: bold;
}