/* Variáveis e Reset do Widget */
:root {
    --widget-color: #ef4f2f;
    --widget-color-hover: #d64225;
    --widget-bg: #ffffff;
    --widget-text: #111b21;
    --widget-font: 'Inter', -apple-system, sans-serif;
}

.rag-widget-wrapper {
    font-family: var(--widget-font);
}

.rag-widget-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Ensure inputs get the font */
.rag-widget-wrapper input,
.rag-widget-wrapper textarea,
.rag-widget-wrapper button,
.rag-widget-wrapper select {
    font-family: inherit;
}

/* Botão Flutuante (Launcher) */
.rag-widget-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--widget-color);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rag-widget-launcher:hover {
    transform: scale(1.1);
}

.rag-widget-launcher i {
    color: white;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.rag-widget-launcher.open i {
    transform: rotate(90deg);
}

/* Janela do Chat */
.rag-widget-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background-color: var(--widget-bg);
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid #e9edef;
}

.rag-widget-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.rag-widget-header {
    background-color: var(--widget-color);
    padding: 1rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rag-widget-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rag-widget-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.rag-widget-close:hover {
    opacity: 1;
}

/* Área de Mensagens */
.rag-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rag-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.rag-message.bot {
    align-self: flex-start;
    background-color: white;
    color: var(--widget-text);
    border-top-left-radius: 2px;
}

.rag-message.user {
    align-self: flex-end;
    background-color: var(--widget-color);
    color: white;
    border-top-right-radius: 2px;
}

.rag-message.user * {
    color: white !important;
}

.rag-message.error {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Input Area */
.rag-widget-input-area {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid #e9edef;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.rag-widget-input {
    flex: 1;
    border: 1px solid #e9edef;
    border-radius: 20px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    background: #f8f9fa;
}

.rag-widget-input:focus {
    border-color: var(--widget-color);
    background: white;
}

.rag-widget-send {
    background-color: var(--widget-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.rag-widget-send:hover {
    background-color: var(--widget-color-hover);
}

.rag-widget-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .rag-widget-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        max-height: 100vh;
        border-radius: 0;
    }
}

