* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.5;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #f0f2f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message .sources {
    font-size: 0.75rem;
    color: #666;
    margin-top: 8px;
    padding-left: 10px;
    border-left: 2px solid #ddd;
}

.message audio {
    margin-top: 10px;
    width: 100%;
    max-width: 300px;
}

#question-form {
    padding: 15px 20px 20px;
    border-top: 1px solid #eee;
}

.input-group {
    display: flex;
    gap: 10px;
}

#question-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#question-input:focus {
    border-color: #667eea;
}

#send-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.options {
    margin-top: 10px;
    padding-left: 5px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
}

.options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

footer {
    padding: 10px;
    text-align: center;
    font-size: 0.8rem;
    color: #999;
    border-top: 1px solid #eee;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* Responsivo */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        height: 100vh;
        max-height: none;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .message {
        max-width: 90%;
    }

    #send-btn {
        padding: 14px 20px;
    }
}
