/*
* FIDATI - FOLHA DE ESTILOS PARA O CHATBOT CÓRTEX
* Arquivo: chatbot.css
*/

/* ==========================================================================
   1. Widget Flutuante (Bolha Fechada)
   ========================================================================== */
.chat-bubble {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 70px;
    height: 70px;
    background-color: #007bff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-bubble video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-bubble .close-bubble-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    background: #333;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-bubble:hover .close-bubble-btn {
    opacity: 1;
}

/* ==========================================================================
   2. Janela de Chat Principal (Widget Aberto)
   ========================================================================== */
.chat-widget {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 370px;
    max-width: 90vw;
    height: 550px;
    max-height: 80vh;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    display: none; /* Começa escondido */
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-widget.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   3. Componentes do Widget
   ========================================================================== */
/* Cabeçalho */
.chat-header {
    background: #007bff;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Impede que o header encolha */
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.chat-header .close-widget-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Área de Vídeo/Processando */
.typing-video-area {
    height: 120px;
    background-color: #e9ecef;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.typing-video-area > video { /* Video principal de "digitando" */
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.typing-indicator { /* Container do vídeo de "processando" */
    position: absolute;
    bottom: 10px;
    left: 15px;
    display: none; /* Controlado por JavaScript */
    align-items: center;
}

.typing-indicator video {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #007bff;
}

/* Área de Mensagens */
.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 0.6rem 1rem;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-user {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.message-cortex {
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

/* Área de Input */
.chat-input-area {
    border-top: 1px solid #dee2e6;
    padding: 0.75rem;
    background-color: #fff;
    flex-shrink: 0;
}

#chat-form {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

#chat-input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

#chat-send-btn {
    border: none;
    background: #007bff;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0; /* Impede que o botão encolha */
    transition: background-color 0.2s;
}

#chat-send-btn:hover {
    background-color: #0056b3;
}


.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 100%;      /* Largura do widget */
    height: 348px;     /* Altura do widget */
    max-width: 100vw;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden; /* Garante que o conteúdo do iframe respeite as bordas arredondadas */
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.chat-widget-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Opcional: Efeito para telas menores */
@media (max-width: 420px) {
    .chat-widget-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}