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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: white;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
}

.logo-jurema {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.title-group h1 {
    color: #52377c;
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    color: #6b7280;
    font-size: 0.875rem;
}

.new-chat-btn {
    background: #52377c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: #5855eb;
    transform: translateY(-1px);
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: #f8fafc;
}

/* Suggested questions */
.suggested-questions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 0 0 1rem 0;
}

.suggestion-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.02s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-btn:hover {
    background: #e5e7eb;
}

.suggestion-btn:active {
    transform: scale(0.99);
}

.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

.message-content {
    max-width: 80%;
    padding: 1rem 1.5rem;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: #52377c;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-dots {
    display: flex;
    align-items: center;
}

.typing-dots span {
    height: 8px;
    width: 8px;
    background: #6b7280;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

/* Input Area */
.input-area {
    padding: 1rem 1.25rem 1.25rem;
    background: white;
    border-top: 1px solid #e5e5e5;
}

.input-container {
    display: flex;
    align-items: flex-end;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.input-container:focus-within {
    border-color: #52377c;
}

#messageInput {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 1rem;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    padding: 0.25rem 0.75rem;
    font-family: inherit;
}

#messageInput::placeholder {
    color: #9ca3af;
}

#sendButton {
    background: #52377c;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    margin-left: 0.5rem;
}

#sendButton:hover:not(:disabled) {
    background: #5855eb;
    transform: scale(1.05);
}

#sendButton:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.disclaimer {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.disclaimer span {
    color: #52377c;
    font-weight: 500;
}

/* Sponsors strip */
.sponsors {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.sponsors-label {
    margin-right: 0.25rem;
    color: #9ca3af;
}

.sponsors img {
    height: 18px;
    width: auto;
    object-fit: contain;
    filter: grayscale(10%);
    opacity: 0.9;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.sponsors img[alt="NeuralMind"] {
    height: 48px; /* destaque maior para a marca */
}

.sponsors a:hover img {
    opacity: 1;
    filter: none;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Markdown Styling */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 0.5rem 0;
    font-weight: 600;
    color: inherit;
}

.message-content h1 { font-size: 1.5rem; }
.message-content h2 { font-size: 1.3rem; }
.message-content h3 { font-size: 1.1rem; }

.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.25rem 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.bot-message .message-content code {
    background: rgba(99, 102, 241, 0.1);
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.bot-message .message-content pre {
    background: rgba(99, 102, 241, 0.05);
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content blockquote {
    border-left: 4px solid #52377c;
    padding-left: 1rem;
    margin: 0.5rem 0;
    font-style: italic;
    opacity: 0.8;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content a {
    color: #52377c;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
}

.message-content th,
.message-content td {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    text-align: left;
}

.message-content th {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header-content {
        justify-content: center;
    }

    .messages-container {
        padding: 1rem;
    }

    .message-content {
        max-width: 95%;
    }

    .suggested-questions {
        grid-template-columns: repeat(2, 1fr);
    }

    .input-area {
        padding: 1rem;
    }

    .new-chat-btn {
        width: 100%;
        padding: 0.75rem;
    }

    .sponsors {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 0.75rem;
    }

    .title-group h1 {
        font-size: 1.25rem;
    }

    .messages-container {
        padding: 0.75rem;
    }

    .input-area {
        padding: 0.75rem;
    }

    .input-container {
        padding: 0.5rem;
    }

    #messageInput {
        font-size: 0.9rem;
    }

    .suggested-questions {
        grid-template-columns: 1fr;
    }
}

/* Consent modal */
.consent-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.consent-modal[aria-hidden="false"] {
    display: flex;
}

.consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.consent-content {
    position: relative;
    background: #ffffff;
    width: min(560px, 92vw);
    margin: 1rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 1rem;
}

.consent-body {
    padding: 0.5rem 0.5rem 1rem 0.5rem;
}

.consent-body h2 {
    color: #52377c;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.consent-body p {
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.5;
}

.consent-btn {
    display: inline-block;
    background: #52377c;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.consent-btn:active {
    transform: translateY(1px);
}
