/* ==========================================================================
   VIKODA AI ASSISTANT - EXECUTIVE CHATBOT WIDGET
   Styles for Floating Action Button, Drawer Window, Messages & Controls
   ========================================================================== */

:root {
    --vkd-ai-primary: #0a2463;
    --vkd-ai-accent: #1545e4;
    --vkd-ai-cyan: #00b0f0;
    --vkd-ai-emerald: #10b981;
    --vkd-ai-amber: #f59e0b;
    --vkd-ai-rose: #f43f5e;
    --vkd-ai-bg: #f8fafc;
    --vkd-ai-surface: #ffffff;
    --vkd-ai-border: #e2e8f0;
    --vkd-ai-text: #0f172a;
    --vkd-ai-muted: #64748b;
}

/* Floating Action Button (FAB) */
#vkd-ai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px 10px 14px;
    background: linear-gradient(135deg, #0a2463 0%, #1545e4 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    box-shadow: 0 8px 24px rgba(10, 36, 99, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

#vkd-ai-fab:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 30px rgba(21, 69, 228, 0.45);
    background: linear-gradient(135deg, #0e2f7f 0%, #1d52f5 100%);
}

#vkd-ai-fab:active {
    transform: translateY(0) scale(0.98);
}

.vkd-ai-fab-icon {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vkd-ai-fab-pulse {
    position: absolute;
    inset: -3px;
    border-radius: 9999px;
    background: rgba(0, 176, 240, 0.4);
    animation: vkdAiPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
}

@keyframes vkdAiPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.35); opacity: 0; }
}

.vkd-ai-fab-badge {
    background: #00b0f0;
    color: #002540;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chat Drawer / Window */
#vkd-ai-window {
    position: fixed;
    bottom: 84px;
    right: 24px;
    z-index: 9995;
    width: 500px;
    max-width: calc(100vw - 32px);
    height: 670px;
    max-height: calc(100vh - 100px);
    background: var(--vkd-ai-surface);
    border: 1px solid var(--vkd-ai-border);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(10, 36, 99, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--vkd-ai-text);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
}

#vkd-ai-window.vkd-ai-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92) translateY(20px);
}

#vkd-ai-window.vkd-ai-fullscreen {
    width: min(920px, calc(100vw - 32px));
    height: calc(100vh - 100px);
    right: max(16px, calc((100vw - 920px) / 2));
}

/* Header */
.vkd-ai-header {
    background: linear-gradient(135deg, #0a192f 0%, #0f2744 50%, #1545e4 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.vkd-ai-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vkd-ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.vkd-ai-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #0a192f;
}

.vkd-ai-title-wrap h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #ffffff;
}

.vkd-ai-title-wrap p {
    margin: 1px 0 0;
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.vkd-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vkd-ai-btn-icon {
    background: transparent;
    border: none;
    color: #cbd5e1;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.vkd-ai-btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Context Filter Bar */
.vkd-ai-context-bar {
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 14px;
    font-size: 11px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.vkd-ai-context-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vkd-ai-context-refresh {
    color: #1545e4;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    white-space: nowrap;
}

.vkd-ai-context-refresh:hover {
    text-decoration: underline;
}

/* Suggestion Chips */
.vkd-ai-chips-wrap {
    padding: 8px 14px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    gap: 6px;
    scrollbar-width: thin;
    flex-shrink: 0;
}

.vkd-ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 11.5px;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    flex-shrink: 0;
}

.vkd-ai-chip:hover {
    background: #eef2fa;
    border-color: #1545e4;
    color: #1545e4;
    transform: translateY(-1px);
}

/* Messages Area */
.vkd-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scrollbar-width: thin;
}

.vkd-ai-msg {
    display: flex;
    gap: 10px;
    max-width: 96%;
    animation: vkdAiFadeIn 0.2s ease-out;
}

@keyframes vkdAiFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.vkd-ai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.vkd-ai-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #475569;
}

.vkd-ai-msg-assistant .vkd-ai-msg-avatar {
    background: #1545e4;
    color: #ffffff;
}

.vkd-ai-msg-body {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.55;
}

.vkd-ai-msg-user .vkd-ai-msg-body {
    background: #0a2463;
    color: #ffffff;
    border-top-right-radius: 4px;
}

.vkd-ai-msg-assistant .vkd-ai-msg-body {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.vkd-ai-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.vkd-ai-msg-assistant .vkd-ai-msg-time {
    text-align: left;
}

/* Rich Message Formats */
.vkd-ai-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #0a2463;
    margin: 8px 0 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vkd-ai-section-title:first-child {
    margin-top: 0;
}

.vkd-ai-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 8px 0;
}

.vkd-ai-kpi-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
}

.vkd-ai-kpi-label {
    font-size: 10.5px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.vkd-ai-kpi-val {
    font-size: 15px;
    font-weight: 800;
    color: #0a2463;
    margin-top: 2px;
}

.vkd-ai-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.vkd-ai-badge-success { background: #dcfce7; color: #15803d; }
.vkd-ai-badge-warning { background: #fef3c7; color: #b45309; }
.vkd-ai-badge-danger { background: #ffe4e6; color: #be123c; }
.vkd-ai-badge-info { background: #e0f2fe; color: #0369a1; }

.vkd-ai-table-wrap {
    overflow-x: auto;
    margin: 8px 0;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.vkd-ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.vkd-ai-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #cbd5e1;
}

.vkd-ai-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.vkd-ai-table tr:last-child td {
    border-bottom: none;
}

.vkd-ai-table tr:hover td {
    background: #f8fafc;
}

.vkd-ai-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.vkd-ai-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #eef2fa;
    color: #1545e4;
    border: 1px solid rgba(21, 69, 228, 0.2);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.vkd-ai-action-btn:hover {
    background: #1545e4;
    color: #ffffff;
}

.vkd-ai-copy-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 4px;
}

.vkd-ai-copy-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

/* Typing Indicator */
.vkd-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.vkd-ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: vkdAiBounce 1.4s infinite ease-in-out both;
}

.vkd-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.vkd-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes vkdAiBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.vkd-ai-input-wrap {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.vkd-ai-textarea {
    flex: 1;
    min-height: 38px;
    max-height: 100px;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.vkd-ai-textarea:focus {
    border-color: #1545e4;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(21, 69, 228, 0.15);
}

.vkd-ai-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #1545e4;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.vkd-ai-send-btn:hover {
    background: #0a2463;
    transform: scale(1.04);
}

.vkd-ai-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Settings Modal */
#vkd-ai-settings-modal {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.vkd-ai-settings-card {
    background: #ffffff;
    width: 100%;
    max-width: 360px;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.vkd-ai-settings-title {
    font-size: 15px;
    font-weight: 700;
    color: #0a2463;
    margin: 0 0 8px;
}

.vkd-ai-settings-desc {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 16px;
    line-height: 1.45;
}

.vkd-ai-field {
    margin-bottom: 12px;
}

.vkd-ai-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.vkd-ai-field input, .vkd-ai-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    box-sizing: border-box;
}

.vkd-ai-settings-btns {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* ==========================================================================
   VIKODA INTELLIGENT BI AGENT - REACT PIPELINE, TRACE & EVIDENCE STYLES
   ========================================================================== */

.vkd-agent-pipeline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: linear-gradient(90deg, #f1f5f9 0%, #eef2ff 100%);
    border: 1px solid #dbeafe;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
}

.vkd-agent-stage {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ffffff;
    color: #0a2463;
    border: 1px solid #cbd5e1;
    letter-spacing: 0.2px;
}

.vkd-agent-stage.done {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.vkd-agent-stage.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.vkd-agent-arrow {
    color: #94a3b8;
    font-size: 9px;
}

/* Expandable Reasoning & Evidence Trace */
.vkd-agent-trace {
    margin: 8px 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
    font-size: 11.5px;
}

.vkd-agent-trace summary {
    padding: 7px 10px;
    cursor: pointer;
    font-weight: 600;
    color: #1e3a8a;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    list-style: none;
}

.vkd-agent-trace summary::-webkit-details-marker {
    display: none;
}

.vkd-agent-trace summary:hover {
    background: #dbeafe;
}

.vkd-agent-trace-body {
    padding: 10px;
    border-top: 1px solid #dbeafe;
    background: #ffffff;
    max-height: 240px;
    overflow-y: auto;
}

.vkd-agent-plan-steps {
    margin: 0 0 8px;
    padding-left: 16px;
    color: #334155;
    line-height: 1.5;
}

.vkd-agent-tool-call {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    margin-bottom: 5px;
    background: #f1f5f9;
    border-left: 3px solid #1545e4;
    border-radius: 4px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 10.5px;
    color: #1e293b;
}

.vkd-agent-ev-badge {
    display: inline-block;
    padding: 1px 5px;
    background: #e0e7ff;
    color: #1d4ed8;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 9.5px;
    font-weight: 700;
    vertical-align: middle;
}

/* Findings Cards: Observation / Hypothesis / Proposal */
.vkd-agent-findings {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.vkd-agent-finding {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.48;
    border-left: 3.5px solid #1545e4;
    background: #f8fafc;
}

.vkd-agent-finding.observation {
    border-left-color: #0284c7;
    background: #f0f9ff;
}

.vkd-agent-finding.hypothesis {
    border-left-color: #d97706;
    background: #fffbeb;
}

.vkd-agent-finding.proposal {
    border-left-color: #059669;
    background: #ecfdf5;
}

.vkd-agent-finding-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
}

.vkd-agent-finding.observation .vkd-agent-finding-tag { color: #0369a1; }
.vkd-agent-finding.hypothesis .vkd-agent-finding-tag { color: #b45309; }
.vkd-agent-finding.proposal .vkd-agent-finding-tag { color: #047857; }

.vkd-agent-guardrail {
    margin-top: 8px;
    padding: 6px 9px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    font-size: 10.5px;
    color: #64748b;
    line-height: 1.4;
}

.vkd-agent-live-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #1e3a8a;
}
