/* M&A Chat -- residual styles not covered by Tailwind utilities */

/* Color tokens per UX spec Section 4 */
:root {
    --navy-900: #0F1A2E;
    --navy-800: #1A2744;
    --navy-700: #243B5C;
    --navy-600: #2E4F74;
    --accent-600: #2563EB;
    --accent-700: #1D4ED8;
    --slate-100: #F1F5F9;
    --slate-200: #E2E8F0;
    --slate-300: #CBD5E1;
    --slate-400: #94A3B8;
}

/* Streaming cursor blink animation */
@keyframes blink {
    50% { opacity: 0; }
}

.cursor {
    width: 2px;
    background-color: #2563EB;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 0.8s step-end infinite;
}

/* Citations toggle -- animated grid-template-rows expand/collapse */
.citations-list {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 250ms ease;
    overflow: hidden;
}
.citations-list.open {
    grid-template-rows: 1fr;
}
.citations-list > * {
    overflow: hidden;
}

/* Markdown prose styles -- override whitespace-pre-wrap after markdown render */
.content.prose { white-space: normal; }
.content h1, .content h2, .content h3, .content h4 { font-weight: 600; margin: 1.3rem 0 0.15rem; }
.content h1 { font-size: 1.4rem; }
.content h2 { font-size: 1.2rem; }
.content h3 { font-size: 1.05rem; }
.content h4 { font-size: 0.95rem; }
.content ul, .content ol { padding-left: 1.5rem; margin: 0.2rem 0; }
.content ul { list-style: disc; }
.content ol { list-style: decimal; }
.content li { margin: 0.05rem 0; }
.content li > p { margin: 0; }
.content pre { background: #f3f4f6; padding: 0.75rem; border-radius: 0.375rem; overflow-x: auto; margin: 0.3rem 0; }
.content code { background: #f3f4f6; padding: 0.1rem 0.3rem; border-radius: 0.25rem; font-size: 0.875em; }
.content pre code { background: none; padding: 0; }
.content blockquote { border-left: 3px solid #9ca3af; padding-left: 0.75rem; font-style: italic; margin: 0.3rem 0; color: #6b7280; }
.content table { border-collapse: collapse; width: 100%; margin: 0.3rem 0; }
.content th, .content td { border: 1px solid #d1d5db; padding: 0.375rem 0.5rem; text-align: left; }
.content tr:nth-child(even) { background: #f9fafb; }
.content p { margin: 0.15rem 0; }
.mermaid { text-align: center; margin: 1rem 0; position: relative; }

/* Mermaid diagram export overlay -- visible on hover and touch */
.mermaid-export-overlay {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}
.mermaid:hover .mermaid-export-overlay,
.mermaid-export-overlay:focus-within,
.mermaid-export-overlay.touch-visible {
    opacity: 1;
}
.mermaid-export-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.mermaid-export-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* Inline citation [N] indicators injected pre-markdown */
sup.cite {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: white;
    background-color: var(--navy-800);
    border-radius: 4px;
    padding: 1px 5px;
    cursor: pointer;
    margin: 0 2px;
    line-height: 1;
    vertical-align: super;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
sup.cite:hover {
    background-color: var(--accent-600);
    transform: translateY(-1px);
}

/* "Sources (N)" toggle button */
.citations-toggle {
    font-size: 12px;
    font-weight: 500;
    color: #64748B;
    border: none;
    background: none;
    cursor: pointer;
    padding: 6px 0;
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.citations-toggle:hover { color: #2563EB; }
.citations-toggle .chevron {
    display: inline-block;
    transition: transform 200ms ease;
}
.citations-toggle.open .chevron { transform: rotate(180deg); }

/* Citation source cards */
.citation-card {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 8px;
}
.citation-card:hover { background: #F1F5F9; }
.citation-card-title { font-size: 13px; font-weight: 500; color: #1A2744; word-break: break-all; }
.citation-card-meta { font-size: 12px; color: #94A3B8; }
.citation-card-snippet {
    font-size: 12px;
    color: #475569;
    font-style: italic;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    border-left: 2px solid #E2E8F0;
    padding-left: 8px;
    margin-top: 4px;
}

/* Thinking indicator -- animated pulsing dots */
@keyframes pulse-dot {
    0%, 80%, 100% { opacity: 0.25; }
    40% { opacity: 0.8; }
}
.thinking-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--slate-400);
    margin: 0 2px;
    animation: pulse-dot 1.4s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot:nth-child(3) { animation-delay: 0.3s; }

/* Message enter animation */
@keyframes message-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
[data-role="user"], [data-role="assistant"] {
    animation: message-enter 200ms ease-out;
}
