/* ==========================================================================
   ESTILOS DO ASSISTENTE BÍBLICO (RAG CHAT)
   ========================================================================== */

.chat-page-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    padding: 16px 20px;
}

.chat-container {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--surface-subtle);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.assistant-meta h2 {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.assistant-meta p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Área de Mensagens com Scroll */
.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    gap: 12px;
    max-width: 88%;
}

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

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

.message-bubble {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    line-height: 1.6;
}

.message-row.user .message-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    border-bottom-right-radius: var(--radius-sm);
}

.message-row.assistant .message-bubble {
    background-color: var(--surface-subtle);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

/* Markdown dentro da resposta do assistente */
.message-bubble p {
    color: inherit;
    margin-bottom: 12px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble ul, .message-bubble ol {
    margin: 10px 0 10px 20px;
}

.message-bubble strong {
    font-weight: 700;
}

/* Passagens Relacionadas no Chat */
.chat-citations-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.chat-citations-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

[data-theme="dark"] .chat-citations-title {
    color: var(--secondary);
}

.citation-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

[data-theme="dark"] .citation-card {
    border-left-color: var(--secondary);
}

.citation-ref {
    font-weight: 700;
    color: var(--primary);
    display: inline-block;
    margin-bottom: 4px;
    text-decoration: none;
}

[data-theme="dark"] .citation-ref {
    color: var(--secondary);
}

.citation-ref:hover {
    text-decoration: underline;
}

/* Sugestões de Continuação */
.chat-suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.suggestion-chip-btn {
    background-color: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.suggestion-chip-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--secondary-light);
}

/* Área de Input do Chat */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background-color: var(--surface);
}

.chat-input-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background-color: var(--surface-subtle);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: border-color var(--transition-fast);
}

.chat-input-form:focus-within {
    border-color: var(--primary);
}

.chat-textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    font-size: 0.98rem;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 4px 0;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading / Digitando Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 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 typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@media (max-width: 768px) {
    .chat-page-wrapper {
        padding: 0;
        height: calc(100vh - var(--header-height));
        height: calc(100dvh - var(--header-height));
    }

    .chat-container {
        border-radius: 0;
        border: none;
    }

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