/* AI Assistant Demo Styles - Aligned with WorkBook MOOSE UI */

.ai-assistant-demo {
    min-height: calc(100vh - 120px);
    background-color: #f8f9fa;
}

/* Introduction Section */
.intro-section {
    padding: 60px 0 40px;
    background: linear-gradient(135deg, #556DAF 0%, #7489C6 100%);
    color: white;
}

.intro-section h1 { color: white; }

.intro-section .lead {
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto;
}

/* Data Cards */
.data-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 25px;
    height: 100%;
    backdrop-filter: blur(10px);
}

.data-card h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.data-card ul { list-style: none; padding: 0; margin: 0; }

.data-card li {
    color: rgba(255, 255, 255, 0.9);
    padding: 5px 0 5px 20px;
    position: relative;
}

.data-card li:before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: #00C896;
}

/* Knowledge Base Card */
.knowledge-base-card {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.knowledge-base-card h3 { color: white; }
.knowledge-base-card h5 { color: rgba(255, 255, 255, 0.95); font-weight: 600; margin-bottom: 15px; }
.knowledge-base-card ul { list-style: none; padding: 0; margin: 0; }

.knowledge-base-card li {
    color: rgba(255, 255, 255, 0.9);
    padding: 5px 0 5px 20px;
    position: relative;
}

.knowledge-base-card li:before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: #00C896;
}

/* ================================================ */
/* CHAT SECTION                                     */
/* ================================================ */
.chat-section { padding: 40px 0; }

.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Chat Header */
.chat-header {
    background: white;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.moose-icon {
    height: 44px;
    width: auto;
    opacity: 0.2;
    flex-shrink: 0;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}

.chat-header-sub {
    font-size: 0.75rem;
    color: #9ca3af;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.language-selector label { margin: 0; font-weight: 500; color: #6b7280; }
.language-selector select { width: 140px; font-size: 0.85rem; }

/* Chat Messages Area */
.chat-messages {
    height: 520px;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

/* Message Layout */
.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
}

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

/* User Messages - right-aligned blue pill */
.message.user .message-content {
    background: #2563eb;
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    max-width: 75%;
    font-size: 0.93rem;
    line-height: 1.5;
}

.message.user .message-content p { margin: 0; }

/* Assistant Messages - full-width structured content */
.message.assistant .message-content {
    background: #f3f4f6;
    color: #111827;
    padding: 16px 20px;
    border-radius: 12px;
    max-width: 100%;
    width: 100%;
    font-size: 0.93rem;
    line-height: 1.7;
    border: none;
    box-shadow: none;
}

/* Markdown-like content styling inside assistant messages */
.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3,
.message.assistant .message-content h4 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #111827;
}

.message.assistant .message-content h2 { font-size: 1.1rem; }
.message.assistant .message-content h3 { font-size: 1rem; }

.message.assistant .message-content p {
    margin: 8px 0;
}

.message.assistant .message-content p:last-child { margin-bottom: 0; }
.message.assistant .message-content p:first-child { margin-top: 0; }

.message.assistant .message-content ul,
.message.assistant .message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message.assistant .message-content li {
    margin: 4px 0;
    line-height: 1.6;
}

.message.assistant .message-content strong {
    font-weight: 600;
    color: #111827;
}

.message.assistant .message-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    color: #e83e8c;
}

.message.assistant .message-content pre {
    background: #1e2430;
    color: #d4d4d4;
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    font-size: 0.85rem;
    line-height: 1.6;
    position: relative;
}

.message.assistant .message-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* Key Findings box - matches WorkBook blue box */
.key-findings {
    margin-top: 12px;
    padding: 14px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
}

.key-findings h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e40af;
}

.key-findings ul {
    margin: 0;
    padding-left: 18px;
}

.key-findings li {
    font-size: 0.88rem;
    color: #1e3a5f;
    line-height: 1.5;
}

/* Image display in messages */
.message-image {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    padding: 8px;
    border: 1px solid #e5e7eb;
}

.message-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.image-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.image-caption {
    text-align: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Thinking indicator - pulsing dots */
.thinking-indicator .message-content {
    background: #f3f4f6 !important;
    padding: 16px 24px !important;
    display: inline-block !important;
    width: auto !important;
}

.thinking-completed {
    margin-bottom: 10px;
}

.thinking-step-done {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.83rem;
    color: #059669;
    padding: 2px 0;
}

.thinking-step-done svg { flex-shrink: 0; }

.thinking-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thinking-action {
    font-size: 0.85rem;
    color: #6b7280;
}

.thinking-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 20px;
}

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

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

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Inline Progress Indicator (replaces full-screen overlay) */
.message.progress-indicator .message-content {
    background: transparent;
    border: none;
    padding: 12px 0;
    box-shadow: none;
}

.progress-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #6b7280;
}

.progress-dot {
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.progress-bar-inline {
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar-inline .bar {
    height: 100%;
    background: #2563eb;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Todo list in progress */
.progress-todos {
    margin-top: 8px;
    font-size: 0.82rem;
}

.progress-todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    color: #6b7280;
}

.progress-todo-item.completed { color: #059669; }
.progress-todo-item.in-progress { color: #2563eb; }
.progress-todo-item.failed { color: #dc2626; }

.progress-todo-item .todo-icon,
.progress-todo-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.todo-detail {
    color: #9ca3af;
    font-size: 0.78rem;
}

/* Chat Input - matches WorkBook input */
.chat-input-container {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-container .input-group {
    position: relative;
}

.chat-input-container textarea {
    resize: none;
    border-radius: 12px;
    padding: 12px 16px;
    padding-right: 80px;
    border: 1px solid #d1d5db;
    font-size: 0.93rem;
    line-height: 1.5;
    transition: border-color 0.2s;
    max-height: 150px;
}

.chat-input-container textarea:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.chat-input-container .btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 500;
}

.chat-input-container .btn-primary {
    background: #2563eb;
    border: none;
}

.chat-input-container .btn-primary:hover {
    background: #1d4ed8;
}

.input-info {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.78rem;
    color: #9ca3af;
}

.session-timer { font-weight: 500; }
.request-count { font-weight: 500; }
.request-count.warning { color: #d97706; }
.request-count.danger { color: #dc2626; }

/* Error messages */
.message.error .message-content {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* Privacy Notice */
.privacy-notice { padding: 40px 0; }

.privacy-notice .alert {
    max-width: 960px;
    margin: 0 auto;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Dataset Browser Section */
.dataset-browser-section {
    padding: 40px 0;
    background: #f8f9fa;
}

.dataset-browser-section h2 {
    color: #3A4A7A;
    font-weight: 700;
}

.dataset-browser-section .accordion {
    max-width: 960px;
    margin: 0 auto;
}

.dataset-browser-section .accordion-button {
    font-weight: 600;
    color: #3A4A7A;
    background-color: white;
}

.dataset-browser-section .accordion-button:not(.collapsed) {
    background-color: #556DAF;
    color: white;
}

.dataset-browser-section .accordion-button:not(.collapsed) .badge {
    background-color: white !important;
    color: #556DAF !important;
}

.dataset-browser-section .accordion-button:focus {
    box-shadow: none;
    border-color: rgba(85, 109, 175, 0.3);
}

.dataset-list { list-style: none; padding-left: 0; margin: 0; }

.dataset-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.dataset-list li:last-child { border-bottom: none; }

.dataset-list code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    color: #556DAF;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.dataset-list code:hover {
    background: #e8f4f8;
    border-color: #556DAF;
}

/* Example Queries */
.example-queries {
    max-width: 960px;
    margin: 0 auto;
}

.example-query-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
}

.example-query-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.example-query-card strong {
    color: #556DAF;
    display: block;
    margin-bottom: 8px;
}

.example-query-card p {
    color: #6c757d;
    font-style: italic;
    font-size: 0.95rem;
}

/* Session Expired Modal */
.session-expired-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 10000;
    max-width: 400px;
}

.session-expired-modal h3 { color: #dc2626; margin-bottom: 15px; }
.session-expired-modal p { margin-bottom: 20px; color: #6b7280; }

/* Responsive */
@media (max-width: 768px) {
    .data-card { margin-bottom: 20px; }

    .chat-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .message.user .message-content { max-width: 85%; }
    .chat-messages { height: 400px; }
}
