/* style.css */

:root {
    --primary-color: #03747A; /* Azul primário para botões e header */
    --secondary-color: #f8f9fa; /* Fundo claro para o corpo do chat */
    --bot-bubble-color: #e2f4ff; /* Fundo levemente azul para mensagens do bot */
    --user-bubble-color: #d1e7dd; /* Fundo verde claro para mensagens do usuário */
    --success-color: #28a745; /* Verde para sucesso (Copiado/Pago) */
    --warning-color: #ffc107; /* Amarelo para débito anterior/Alerta */
    --danger-color: #dc3545; /* Vermelho para erro/Sair */
    --text-color: #343a40;
    --border-radius: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #e9ecef;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* --- Container Principal do Chat --- */
.chat-container {
    width: 100%;
    max-width: 450px;
    height: 90vh;
    max-height: 700px;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* --- Header --- */
.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-header h1 {
    margin: 0 0 5px 0;
    font-size: 1.4em;
}

.chat-header p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.8;
}

/* --- Body (Onde as Mensagens Aparecem) --- */
.chat-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--secondary-color);
}

/* Estilo para a Linha Horizontal de separação de contratos */
.message-bubble hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 10px 0;
}

/* --- Mensagens --- */
.message {
    display: flex;
    margin-bottom: 15px;
}

.message-bubble {
    padding: 10px 15px;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Mensagens do Bot */
.message.bot {
    justify-content: flex-start;
}

.message.bot .message-bubble {
    background-color: var(--bot-bubble-color);
    color: var(--text-color);
    border-bottom-left-radius: 2px;
}

/* Mensagens do Usuário */
.message.user {
    justify-content: flex-end;
}

.message.user .message-bubble {
    background-color: var(--user-bubble-color);
    color: var(--text-color);
    border-bottom-right-radius: 2px;
}

/* Estilos de Alerta e Status dentro das bolhas */
.message-bubble strong {
    font-weight: 600;
}

/* --- Footer (Input e Botão) --- */
.chat-footer {
    padding: 10px 15px;
    background-color: #fff;
    border-top: 1px solid #dee2e6;
}

#chatForm {
    display: flex;
    gap: 10px;
}

#textInput {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 1em;
}

#sendButton {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

#sendButton:hover {
    background-color: #0056b3;
}

#sendButton:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
}


/* --- Cartão de Boleto --- */
.boleto-card {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.boleto-card p {
    margin: 5px 0;
    font-size: 0.95em;
}

.boleto-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    display: block;
    margin-top: 10px;
}

.boleto-card a:hover {
    text-decoration: underline;
}

/* Status do Boleto */
.status-pago {
    color: var(--success-color);
    font-weight: bold;
}

.status-aberto {
    color: var(--danger-color);
    font-weight: bold;
}

/* Botões de Ação (PIX/Cód. Barras/Menu/Seleção) */
.payment-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-direction: column; /* Padrão em coluna para botões de menu/seleção */
}

.copy-btn {
    flex-grow: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    transition: opacity 0.2s, background-color 0.2s;
    /* Estilo base para botões de menu e seleção */
    background-color: var(--primary-color); 
    color: white;
    text-decoration: none; /* Para links do WhatsApp */
}

.copy-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.copy-btn:disabled {
    background-color: #adb5bd !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Utilitário para ocultar boletos antigos */
.hidden {
    display: none !important;
}

/* Media Query para telas menores (Responsividade) */
@media (max-width: 600px) {
    body {
        min-height: 100vh;
        align-items: flex-start;
        padding: 0;
        background-color: #fff;
    }
    .chat-container {
        height: 100vh;
        max-height: 100vh;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    .chat-footer {
        padding: 10px;
    }
    #chatForm {
        gap: 8px;
    }
    .message-bubble {
        max-width: 95%;
    }
    /* Adaptação para botões de pagamento dentro do cartão, se houver */
    .boleto-card .payment-buttons {
        flex-direction: row; 
    }
}
