/* Reset e base */
.invexo-chat, .invexo-chat *,
.invexo-chat-launcher, .invexo-chat-launcher * {
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

/* Launcher */
.invexo-chat-launcher { position: fixed !important; right: 20px !important; bottom: 0 !important; z-index: 999998 !important; display: flex !important; align-items: center !important; justify-content: center; background: #2c3e50 !important; color: #ffffff !important; border-top-left-radius: 10px !important; border-top-right-radius: 10px !important; box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.15) !important; cursor: pointer !important; font-size: 15px !important; font-weight: 500 !important; transition: all 0.3s ease !important; padding: 14px 40px 14px 20px !important; min-height: auto !important; }
.invexo-chat-launcher:hover { transform: translateY(-2px) !important; background: #34495e !important; }
.invexo-launcher-text { font-weight: 500 !important; white-space: nowrap !important; }
.invexo-launcher-online-indicator { position: absolute !important; right: -2px !important; top: -8px !important; width: 28px !important; height: 28px !important; background: #2ecc71 !important; border-radius: 50% !important; border: 3px solid #ffffff !important; box-shadow: 0 0 10px rgba(46, 204, 113, 0.7); }

/* Container do widget */
.invexo-chat { position: fixed !important; right: 20px !important; bottom: 20px !important; z-index: 999999 !important; width: 380px !important; max-width: calc(100vw - 40px) !important; background: #ffffff !important; border-radius: 16px !important; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important; overflow: hidden !important; display: none !important; flex-direction: column !important; opacity: 0 !important; transform: scale(0.8) translateY(20px) !important; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important; height: 600px; max-height: calc(100vh - 40px); }
.invexo-chat.active { display: flex !important; opacity: 1 !important; transform: scale(1) translateY(0) !important; }

/* Header */
.invexo-chat-header { background: linear-gradient(135deg, #ff6b35 0%, #ff4500 100%) !important; color: #ffffff !important; padding: 20px !important; display: flex !important; align-items: center !important; justify-content: space-between !important; flex-shrink: 0; }
.invexo-chat-agent { display: flex !important; align-items: center !important; gap: 12px !important; }
.invexo-chat-agent-avatar img { width: 44px !important; height: 44px !important; border-radius: 50% !important; object-fit: cover !important; border: 2px solid rgba(255, 255, 255, 0.3) !important; }
.invexo-chat-agent-name { font-size: 16px !important; font-weight: 600 !important; }
.invexo-chat-agent-title { font-size: 13px !important; color: rgba(255, 255, 255, 0.9) !important; }
.invexo-chat-close { background: rgba(255, 255, 255, 0.2) !important; color: #ffffff !important; width: 32px !important; height: 32px !important; border-radius: 50% !important; cursor: pointer !important; font-size: 18px !important; display: flex !important; align-items: center !important; justify-content: center !important; transition: background 0.2s ease !important; }
.invexo-chat-close:hover { background: rgba(255, 255, 255, 0.3) !important; }

/* Telas do Widget */
.invexo-screen-identify { display: block; padding: 30px 20px !important; text-align: center !important; }
.invexo-form-group { margin-bottom: 16px !important; }
.invexo-form-group input { width: 100% !important; height: 50px !important; padding: 14px 16px !important; border: 2px solid #e9ecef !important; border-radius: 10px !important; font-size: 15px !important; }
.invexo-btn-start { width: 100% !important; height: 50px !important; background: #ff6b35 !important; color: #ffffff !important; border-radius: 10px !important; font-size: 16px !important; font-weight: 600 !important; cursor: pointer !important; margin-top: 8px !important; }

/* === CORREÇÃO DE LAYOUT DO CHAT === */
.invexo-screen-chat {
    display: none;
    flex-direction: column !important;
    height: 100%; /* Ocupa toda a altura do widget */
    overflow: hidden; /* Evita que o conteúdo vaze */
}

/* Visual das Mensagens (Área de Rolagem) */
.invexo-chat-messages {
    flex-grow: 1 !important; /* Faz esta área crescer para ocupar o espaço disponível */
    padding: 20px !important;
    overflow-y: auto !important; /* Apenas esta área terá rolagem vertical */
    background: #ffffff !important;
}

/* Input de mensagem (Fixo na Base) */
.invexo-chat-input {
    flex-shrink: 0; /* Impede que esta área encolha */
    padding: 15px !important;
    background: #f9f9f9 !important;
    border-top: 1px solid #e9ecef !important;
    display: flex !important;
    gap: 10px !important;
}

/* === ESTILOS DAS MENSAGENS E INPUT === */
.msg { margin-bottom: 12px !important; display: flex !important; flex-direction: column !important; }
.msg .author { display: none; }
.msg .text { max-width: 80% !important; padding: 10px 15px !important; border-radius: 20px !important; line-height: 1.5 !important; font-size: 15px !important; word-wrap: break-word; }
.msg .time { font-size: 11px !important; color: #999 !important; margin: 4px 8px 0 8px !important; }
.msg-agent { align-items: flex-start !important; }
.msg-agent .text { background: #e9e9eb !important; color: #000000 !important; border-bottom-left-radius: 5px !important; }
.msg-agent .time { align-self: flex-start; }
.msg-visitor { align-items: flex-end !important; }
.msg-visitor .text { background: #007bff !important; color: #ffffff !important; border-bottom-right-radius: 5px !important; }
.msg-visitor .time { align-self: flex-end; }
.msg-system .text { font-style: italic; color: #666; text-align: center; background: transparent !important; }

.invexo-chat-input input { flex: 1 !important; height: 48px !important; padding: 12px 16px !important; border: 1px solid #ddd !important; border-radius: 24px !important; font-size: 15px !important; outline: none !important; }
.invexo-chat-input input:focus { border-color: #007bff !important; }
.invexo-chat-input button { width: 80px !important; height: 48px !important; background: #007bff !important; color: #ffffff !important; border-radius: 24px !important; cursor: pointer !important; font-size: 15px !important; font-weight: 600 !important; }

/* Admin */
.invexo-admin-columns { display:flex; gap:24px; }
.invexo-admin-left { flex: 2; }
.invexo-admin-right { flex: 1; }
#invexo-admin-conversation.invexo-chat-messages { height: 500px; border: 1px solid #e9ecef; border-radius: 8px; background: #fff; }
.invexo-unread-indicator { display: inline-block; vertical-align: middle; width: 10px; height: 10px; background-color: #e74c3c; border-radius: 50%; margin-right: 8px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }