body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    flex-direction: column;
}

.main-wrapper {
    width: 90%;
    max-width: 700px;
}

.header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-left: 10px;
}

.header img {
    height: 100px;
    margin-right: 15px;
}

.title-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.title-text h1 {
    font-size: 1.25rem;
    color: #333;
    margin: 0;
    font-weight: 600;
}

.title-text h2 {
    font-size: 0.75rem;
    color: #333;
    margin: 0;
    font-weight: 400;
}

.chat-container {
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 80vh;
}

.chat-history {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.user {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.agent {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
    margin-right: auto;
}

.chat-input {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f9f9f9;
}

.chat-input input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
    font-size: 1rem;
}

.chat-input button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input button:hover {
    background-color: #0056b3;
}

.message img {
    max-width: 100%;
    height: auto;
    margin-top: 10px;
    border-radius: 4px
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    margin-bottom: 15px;
    align-self: flex-start
}

.spinner {
    border: 4px solid rgba(0, 0, 0, .1);
    border-left-color: #007bff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.message p {
    margin: 0 0 10px
}

.message p:last-child {
    margin-bottom: 0
}

.message ul,
.message ol {
    padding-left: 20px;
    margin-top: 0
}

.message li {
    margin-bottom: 5px
}

.message code {
    background-color: rgba(0, 0, 0, .08);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace
}

.message pre {
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word
}

.message pre code {
    background-color: transparent;
    padding: 0
}

.message.agent img {
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

.message.agent img:hover {
    opacity: 0.85;
}


/* ======================================================= */
/* --- ESTILOS RESPONSIVOS PARA CELULARES (ATUALIZADO) --- */
/* ======================================================= */

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .main-wrapper {
        width: 100%;
        max-width: 100%;
        height: 100vh;
    }

    .header {
        padding: 10px 15px;
        margin-bottom: 0;
        /* Adicionamos uma borda inferior para separar do chat */
        border-bottom: 1px solid #eee;
    }

    .header img {
        height: 40px;
    }

    .header h1 {
        font-size: 1rem;
    }

    .chat-container {
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        /* Adicionado para garantir o contexto de posicionamento */
        position: relative;
    }

    .chat-history {
        padding: 15px;
        box-sizing: border-box;
        /* Garante que o padding não aumente o tamanho total */
        /* Adiciona um espaço no final da lista para não ficar atrás do input */
        padding-bottom: 80px;
    }

    .chat-input {
        position: fixed;
        /* Fixa o elemento na tela */
        bottom: 0;
        /* Alinha na parte inferior */
        left: 0;
        /* Alinha na esquerda */
        width: 100%;
        /* Ocupa toda a largura */
        padding: 10px;
        box-sizing: border-box;
        /* Garante que o padding não aumente a largura */
        border-top: 1px solid #ddd;
        /* Linha de separação visual */
        z-index: 10;
        /* Garante que fique sobre o histórico de chat */
    }

    .chat-input button {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
    }
}