/* Variáveis de Cores e Fontes */
:root {
    --primary-color: #005c4b; /* Verde estilo WhatsApp Web */
    --secondary-color: #f0f2f5;
    --chat-bg: #efeae2;
    --user-msg-bg: #d9fdd3;
    --bot-msg-bg: #ffffff;
    --text-color: #111b21;
    --time-color: #667781;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    background-color: #d1d7db;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

/* Container Principal */
.main-container {
    width: 100%;
    max-width: 900px;
    height: 95vh;
    background-color: var(--secondary-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 0;
}

@media (min-width: 768px) {
    .main-container {
        height: 90vh;
        border-radius: 12px;
    }
}

/* Cabeçalho */
.chat-header {
    background-color: var(--primary-color);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    font-size: 20px;
    margin-right: 15px;
}

.header-text h3 {
    font-size: 16px;
    font-weight: 600;
}

.header-text .status {
    font-size: 12px;
    opacity: 0.8;
}

/* Área de Mensagens */
.chat-messages {
    flex: 1;
    background-color: var(--chat-bg);
    /* Padrão de fundo sutil opcional */
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23000000' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14.2px;
    line-height: 19px;
    position: relative;
    box-shadow: var(--shadow);
    word-wrap: break-word;
}

/* Mensagem do Sistema / Bot */
.system-message, .bot-message {
    background-color: var(--bot-msg-bg);
    align-self: flex-start;
    border-top-left-radius: 0;
}

/* Mensagem do Usuário */
.user-message {
    background-color: var(--user-msg-bg);
    align-self: flex-end;
    border-top-right-radius: 0;
}

.message p {
    margin-bottom: 4px;
    color: var(--text-color);
}

.message .time {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--time-color);
    margin-top: 2px;
}

/* Loading / Digitilizando */
.typing-indicator {
    background-color: var(--bot-msg-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border-top-left-radius: 0;
    align-self: flex-start;
    display: none; /* Hidden by default */
    width: fit-content;
    box-shadow: var(--shadow);
    margin-bottom: 10px;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #b9c0c5;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    margin: 0 1px;
}

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

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

/* Área de Input */
.chat-input-area {
    background-color: var(--secondary-color);
    padding: 10px 15px;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.input-wrapper {
    display: flex;
    background-color: white;
    border-radius: 8px;
    padding: 5px 10px;
    align-items: center;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.input-wrapper input {
    flex: 1;
    border: none;
    padding: 10px;
    font-size: 15px;
    outline: none;
}

.input-wrapper button {
    background: none;
    border: none;
    color: var(--time-color);
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s;
}

.input-wrapper button:hover {
    color: var(--primary-color);
}

.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffdddd;
    color: #d8000c;
    border: 1px solid #d8000c;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Novo botão */
.header-action-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-action-btn i {
    transition: transform 0.4s ease;
}

.header-action-btn:hover i {
    transform: rotate(180deg);
}
