/* ============================================================
   VBPL-AI â€” Chat Page Styles
   ============================================================ */

/* Light mode overrides for chat page */
html.light .chat-sidebar { background: #f8fafc; }
html.light .source-card { background: #ffffff; }
html.light .source-card:hover { background: #f1f5f9; }
html.light .chat-main { background: #fcfcfd; }
html.light .chat-header { background: #f8fafc; }
html.light .message-ai .message-bubble { background: #ffffff; }
html.light .message-user .message-bubble {
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.08));
}
html.light .chat-input-area { background: #f8fafc; }
html.light .thinking-steps { background: #f1f5f9; }
html.light .chat-input-box textarea { background: #ffffff; color: #0f172a; }
html.light .example-btn { background: rgba(59,130,246,0.05); }

.chat-page {
    height: calc(100vh - var(--topbar-h));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* â”€â”€ Chat Sidebar (sources) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.chat-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-sidebar-header h3 {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.sources-badge {
    min-width: 22px; height: 22px;
    background: var(--gradient-primary);
    border-radius: 100px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: white;
    padding: 0 6px;
}

.sources-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sources-empty {
    text-align: center;
    padding: 32px 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: all var(--transition);
    animation: fadeInLeft 0.3s ease;
}
.source-card:hover { border-color: var(--primary); background: var(--bg-card-hover); }
.source-card.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.source-card.active .source-card-title { color: var(--primary-light); }
html.light .source-card.active { background: rgba(59, 130, 246, 0.06); }

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.source-card-type {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(59,130,246,0.12);
    color: var(--primary-light);
    border: 1px solid rgba(59,130,246,0.25);
    margin-bottom: 6px;
}
.source-card-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.source-card-meta { font-size: 0.72rem; color: var(--text-muted); }
.source-card-num { font-size: 0.72rem; color: var(--accent-light); margin-bottom: 3px; }

.chat-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.btn-new-chat {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-new-chat:hover { border-color: var(--primary); color: var(--primary-light); }

/* â”€â”€ Doc Preview Panel (right) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.doc-preview-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-left: 1px solid var(--border);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.doc-preview-panel.open {
    width: 38%;
    min-width: 320px;
}

.doc-preview-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    background: var(--bg-card);
}

.doc-preview-header-info { flex: 1; min-width: 0; }

.doc-preview-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-preview-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-preview-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-top: 2px;
}
.doc-preview-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.doc-preview-meta {
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.preview-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(59,130,246,0.1);
    color: var(--primary-light);
    border: 1px solid rgba(59,130,246,0.2);
}

.preview-meta-date,
.preview-meta-auth {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.doc-preview-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 32px 16px;
}

.preview-empty p {
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0;
}

.preview-empty svg { opacity: 0.35; }

.preview-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 12px 0;
}

.preview-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(59,130,246,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.preview-no-match {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.preview-no-match p { margin-bottom: 6px; }

.excerpt-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-secondary);
    animation: fadeIn 0.2s ease;
}

html.light .excerpt-block {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    border-left-color: var(--primary);
}

.excerpt-text { word-break: break-word; }

/* Highlight tá»« khÃ³a â€” mÃ u vÃ ng ná»•i báº­t */
.kw-highlight {
    background: rgba(251, 191, 36, 0.35);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}

html.light .kw-highlight {
    background: rgba(234, 179, 8, 0.3);
}

/* Inline Doc Link */
.doc-inline-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    padding: 1px 4px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.doc-inline-link:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}

.doc-preview-fulllink {
    display: block;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-light);
    text-align: center;
    transition: background var(--transition);
    flex-shrink: 0;
    text-decoration: none;
    background: var(--bg-card);
}
.doc-preview-fulllink:hover {
    background: rgba(59,130,246,0.06);
}

/* â”€â”€ Chat Main â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.chat-header {
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info h2 { font-size: 1rem; font-weight: 700; }
.chat-header-info p { font-size: 0.8rem; color: var(--text-muted); }

.ai-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.status-dot {
    width: 8px; height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50%       { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}

.ai-status.busy .status-dot {
    background: var(--primary);
    animation: spin 1s linear infinite;
    border-radius: 50%;
    border: 2px solid rgba(59,130,246,0.25);
    border-top-color: var(--primary);
    background: transparent;
    width: 9px;
    height: 9px;
}
.ai-status.busy span { color: var(--primary-light); }

/* â”€â”€ Clarification bubble (AI há»i thÃªm) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.message-clarification {
    background: linear-gradient(135deg,
        rgba(245,158,11,0.07),
        rgba(234,179,8,0.04)) !important;
    border-color: rgba(245,158,11,0.28) !important;
}

.clarification-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #d97706;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(245,158,11,0.2);
}

html.light .clarification-label { color: #b45309; }

.error-text { color: var(--danger); margin: 0; }

/* â”€â”€ Messages â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message { display: flex; gap: 14px; max-width: 820px; }
.message-ai { align-self: flex-start; width: 100%; }
.message-user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.message-user .message-avatar {
    background: rgba(139,92,246,0.2);
    color: var(--accent-light);
    font-size: 0.8rem;
}

.message-content { flex: 1; min-width: 0; }

.message-bubble {
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--text-secondary);
}
.message-ai .message-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}
.message-user .message-bubble {
    background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(139,92,246,0.15));
    border: 1px solid rgba(59,130,246,0.25);
    color: var(--text-primary);
    border-top-right-radius: 4px;
    text-align: right;
}
.message-bubble p { margin-bottom: 10px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { color: var(--text-primary); font-weight: 600; }

/* Example questions â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.example-questions { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.example-questions p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.example-btn {
    text-align: left;
    padding: 8px 14px;
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius-sm);
    color: var(--primary-light);
    font-size: 0.83rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    line-height: 1.4;
}
.example-btn:hover { background: rgba(59,130,246,0.12); border-color: var(--primary); }

/* AI Answer Streaming â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.answer-content {
    color: var(--text-secondary);
    line-height: 1.75;
    font-size: 0.92rem;
}
.answer-content strong { color: var(--text-primary); font-weight: 600; }
.answer-content ul, .answer-content ol { padding-left: 20px; margin: 10px 0; }
.answer-content li { margin-bottom: 6px; }

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--primary);
    vertical-align: middle;
    animation: blink 0.8s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Citations â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.citations-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.citations-title { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.citation-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.citation-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    color: var(--primary-light);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.citation-chip:hover { background: rgba(59,130,246,0.15); border-color: var(--primary); }

/* â”€â”€ Thinking Steps â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.thinking-steps {
    padding: 10px 28px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}
.thinking-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.83rem;
    color: var(--text-secondary);
}
.thinking-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(59,130,246,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* â”€â”€ Chat Input â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.chat-input-area {
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.chat-input-box {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 20px;
}

.chat-input-box textarea {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 48px;
    max-height: 160px;
    line-height: 1.5;
    transition: border-color var(--transition), box-shadow var(--transition);
    overflow-y: auto;
}
.chat-input-box textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.chat-input-box textarea::placeholder { color: var(--text-muted); }

#chat-send-btn {
    width: 46px; height: 46px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--transition), transform var(--transition);
}
#chat-send-btn:hover { opacity: 0.88; transform: scale(1.04); }
#chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
#chat-send-btn svg { width: 20px; height: 20px; }

.chat-disclaimer {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0 20px 12px;
}

/* â”€â”€ Responsive â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 1100px) {
    .chat-sidebar {
        width: 200px;
        min-width: 200px;
    }
    .doc-preview-panel.open {
        width: 42%;
        min-width: 280px;
    }
}

@media (max-width: 820px) {
    .chat-sidebar { display: none; }

    /* Preview panel thÃ nh fixed drawer tá»« pháº£i */
    .doc-preview-panel {
        position: fixed;
        top: var(--topbar-h);
        right: 0;
        bottom: 0;
        width: 0 !important;
        min-width: 0 !important;
        z-index: 200;
        box-shadow: -4px 0 24px rgba(0,0,0,0.25);
        transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .doc-preview-panel.open {
        width: 92vw !important;
        min-width: 0 !important;
        max-width: 480px;
    }

    /* Backdrop má» phÃ­a sau drawer */
    .doc-preview-panel.open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: -1;
        animation: fadeIn 0.2s ease;
    }

    /* Äiá»u chá»‰nh chat-main chiáº¿m toÃ n bá»™ */
    .chat-layout { position: relative; }
    .chat-main { min-width: 0; }
}

@media (max-width: 480px) {
    .chat-header h2 { font-size: 1rem; }
    .ai-status span { display: none; }
    .chat-input-box { gap: 8px; }
    .doc-preview-panel.open { width: 100vw !important; }
}

/* ── Thinking Timeline (upgrade) ─────────────────────────── */
.thinking-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.thinking-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.thinking-step .step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.thinking-step.step-pending .step-dot   { background: var(--border-light); }
.thinking-step.step-pending .step-label { color: var(--text-muted); }

.thinking-step.step-active .step-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
    animation: pulse-dot 1s ease infinite;
}
.thinking-step.step-active .step-label { color: var(--primary-light); font-weight: 500; }

.thinking-step.step-done .step-dot    { background: var(--success); }
.thinking-step.step-done .step-label  { color: var(--text-secondary); }

.thinking-step.step-clarify .step-dot   { background: #f59e0b; }
.thinking-step.step-clarify .step-label { color: #f59e0b; font-weight: 500; }

/* ── Confidence Badge ────────────────────────────────────── */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 14px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.confidence-high {
    background: rgba(16,185,129,0.1);
    color: #10b981;
    border: 1px solid rgba(16,185,129,0.25);
}
.confidence-medium {
    background: rgba(245,158,11,0.1);
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,0.25);
}
.confidence-low {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.2);
}

/* ── Blockquote & Headings trong answer-content ─────────── */
.answer-content blockquote {
    margin: 10px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--primary);
    background: rgba(59,130,246,0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
    font-style: italic;
    line-height: 1.7;
}
html.light .answer-content blockquote {
    background: rgba(59,130,246,0.05);
}
.answer-content h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.answer-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px;
}

/* ── Typing Indicator Bubble ──────────────────────────────── */
.ai-typing-bubble {
    padding: 14px 20px !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.5;
    animation: typing-bounce 1.4s ease infinite;
}

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

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
    30%            { transform: translateY(-5px); opacity: 1;   }
}

.ai-step-current {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    min-height: 1.2em;
    transition: all 0.3s ease;
}

/* ── Answer Composing State (chờ Gemini generate) ──────────── */
.answer-composing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.composing-dots {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.composing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.5;
    animation: composing-bounce 1.2s ease-in-out infinite;
}

.composing-dots span:nth-child(1) { animation-delay: 0s; }
.composing-dots span:nth-child(2) { animation-delay: 0.2s; }
.composing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes composing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-6px); opacity: 1; }
}

.composing-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    animation: composing-fade 1.8s ease-in-out infinite;
}

@keyframes composing-fade {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}
