/* assets/css/style.css */

:root {
    --primary-color: #4f86f7;
    --background-color: #ffffff;
    --bot-message-bg: #f0f2f5;
    --user-message-bg: #4f86f7; 
    --text-color: #1d2129;
    --border-color: #e2e8f0;
    --button-border-color: #bec3c9;
    --button-text-color: #4b4f56;
}

/* Ícone Fechado */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
}

#chatbot-widget-icon {
    width: 80px;
    height: 80px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s ease-in-out;
    color: white;
    position: relative;
}

/* NOVO: Estilos para a imagem do ícone */
#chatbot-widget-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover; /* Garante que a imagem preencha o círculo sem distorcer */
}


#chatbot-widget-icon:hover {
    transform: scale(1.1);
}

#chatbot-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #fa3e3e;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
}

#chatbot-tooltip {
    position: absolute;
    bottom: 15px;
    right: 95px; /* Ajustado para melhor posicionamento com o ícone de 80px */
    background-color: var(--background-color);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    white-space: nowrap;
    opacity: 1; /* Alterado */
    visibility: visible; /* Alterado */
    font-size: 14px;
    transition: opacity 0.3s ease-in-out;
}

/* Janela do Chat Aberta */
#chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 370px;
    height: 75vh;
    max-height: 590px;
    background-color: var(--background-color);
    border-radius: 16px;
    box-shadow: 0 5px 40px rgba(0,0,0,0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transform: scale(0.5);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
}

#chatbot-window.open {
    transform: scale(1);
    opacity: 1;
}
#chatbot-window.closed {
    /* display:none é adicionado via JS após a animação */
    transform: scale(0);
    opacity: 0;
}


#chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

#chatbot-header #chatbot-title {
    font-weight: 600;
    color: var(--text-color);
    font-size: 18px;
}

#chatbot-header #chatbot-close-button {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #90949c;
    font-weight: 300;
}

#chatbot-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Espaçamento menor entre balões */
}

#chatbot-history-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #606770;
    margin: 0 auto 16px auto;
    cursor: pointer;
}

.message-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.bot-message, .user-message {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.4;
    font-size: 15px;
    word-wrap: break-word;
}

.bot-message {
    background-color: var(--bot-message-bg);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.user-message {
    background-color: var(--user-message-bg);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* NOVO ESTILO: Resposta do Admin */
.bot-message.admin-reply {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
}

/* NOVO ESTILO: Notificação do Sistema */
.bot-message.system-notification {
    width: 100%;
    max-width: 100%;
    text-align: center;
    font-style: italic;
    background-color: #fafafa;
    color: #8c8c8c;
    font-size: 13px;
    padding: 6px;
    border-radius: 8px;
}


#chatbot-input-area {
    border-top: 1px solid var(--border-color);
}

#chatbot-input-field-wrapper {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#chatbot-input-field-wrapper input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
}
#chatbot-input-field-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
}


#chatbot-input-field-wrapper .input-wrapper-text {
    color: #8a8d91;
    font-size: 13px;
    text-align: center;
    width: 100%;
    padding-top: 4px;
}

#chatbot-input-field-wrapper .buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end; /* Alinha os botões à direita */
    gap: 8px;
}

#chatbot-input-field-wrapper button.quick-reply-button {
    padding: 8px 16px;
    border: 1px solid var(--button-border-color);
    color: var(--button-text-color);
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s, border-color 0.2s;
}

#chatbot-input-field-wrapper button.quick-reply-button:hover {
    background-color: #f0f2f5;
    border-color: #adb1b7;
}

#chatbot-input-field-wrapper form button[type="submit"] {
    width: 100%;
    padding: 12px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}
#chatbot-input-field-wrapper form input {
    margin-bottom: 8px;
}

#chatbot-footer {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: #94a3b8;
    background-color: #f9fafb;
}

#chatbot-footer strong {
    font-weight: bold;
    color: #64748b;
}