/* ============================================
   AI KNOWLEDGE ASSISTANT - DEMO STYLES
   ============================================ */

:root {
    --bg-dark: #0a0a14;
    --bg-sidebar: #0f0f1a;
    --bg-chat: #0c0c18;
    --bg-input: #12121f;
    --bg-panel: #0d0d1a;
    --text-main: #f0f0ff;
    --text-muted: #8888a0;
    --aurora-1: #7c3aed;
    --aurora-2: #a855f7;
    --aurora-3: #ec4899;
    --aurora-4: #06b6d4;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.demo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 15, 26, 0.95);
    border-bottom: 1px solid rgba(168, 85, 247, 0.1);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--aurora-2), var(--aurora-3));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
}

.product-name {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-left: 0.75rem;
    margin-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.header-badge {
    background: rgba(236, 72, 153, 0.2);
    color: var(--aurora-3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    height: calc(100vh - 50px - 40px);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(168, 85, 247, 0.1);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.kb-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.kb-item:hover {
    background: rgba(168, 85, 247, 0.1);
    color: var(--text-main);
}

.kb-item.active {
    background: rgba(168, 85, 247, 0.15);
    color: var(--text-main);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.kb-icon {
    font-size: 1rem;
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: rgba(168, 85, 247, 0.08);
    color: var(--text-main);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(168, 85, 247, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-3));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-name {
    font-size: 0.9rem;
}

/* ============================================
   CHAT AREA
   ============================================ */
.chat-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.welcome-message>p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.suggested-questions h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.suggestion-btn {
    display: block;
    width: 100%;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.15);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-align: left;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
}

/* Chat Bubbles */
.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message-content {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    line-height: 1.6;
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: rgba(20, 20, 40, 0.6);
    border: 1px solid rgba(168, 85, 247, 0.1);
    border-bottom-left-radius: 4px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.powered-by {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--aurora-4);
    opacity: 0.7;
}

.sources-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(168, 85, 247, 0.1);
}

.sources-count {
    font-size: 0.8rem;
    color: var(--aurora-2);
}

/* Category Document View */
.category-view {
    background: rgba(124, 58, 237, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.category-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.category-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.category-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.doc-card {
    background: rgba(20, 20, 40, 0.5);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.doc-card:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}

.doc-icon {
    font-size: 1.5rem;
}

.doc-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.doc-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(168, 85, 247, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.category-hint {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(168, 85, 247, 0.1);
}

.category-hint p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ai-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--aurora-4), var(--aurora-2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.citation {
    display: inline-block;
    background: rgba(6, 182, 212, 0.15);
    color: var(--aurora-4);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.25rem;
    cursor: pointer;
}

.citation:hover {
    background: rgba(6, 182, 212, 0.25);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--aurora-2);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* ============================================
   INPUT AREA
   ============================================ */
.chat-input-area {
    padding: 1rem 2rem 1.5rem;
    background: var(--bg-input);
    border-top: 1px solid rgba(168, 85, 247, 0.1);
}

.input-container {
    display: flex;
    gap: 0.75rem;
    background: rgba(20, 20, 40, 0.4);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 12px;
    padding: 0.5rem;
}

.input-container:focus-within {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.1);
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    outline: none;
}

#user-input::placeholder {
    color: var(--text-muted);
}

.send-button {
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-button:hover {
    transform: scale(1.05);
}

.send-icon {
    color: white;
    font-size: 1.25rem;
}

.input-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ============================================
   CONTEXT PANEL
   ============================================ */
.context-panel {
    background: var(--bg-panel);
    border-left: 1px solid rgba(168, 85, 247, 0.1);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(168, 85, 247, 0.1);
}

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 500;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-context {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-context p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Source Cards */
.source-card {
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid rgba(168, 85, 247, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    animation: fadeIn 0.3s ease;
}

.source-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.source-icon {
    font-size: 1rem;
}

.source-title {
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
}

.source-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: rgba(6, 182, 212, 0.2);
    color: var(--aurora-4);
    border-radius: 4px;
}

.source-excerpt {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 0.5rem;
}

.source-excerpt em {
    color: var(--aurora-4);
    font-style: normal;
    background: rgba(6, 182, 212, 0.1);
    padding: 0 0.2rem;
    border-radius: 2px;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
    }
}

.message-content code {
    display: block;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    border-left: 3px solid var(--aurora-2);
}

/* ============================================
   DEMO BANNER
   ============================================ */
.demo-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(124, 58, 237, 0.1);
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    font-size: 0.85rem;
}

.demo-link {
    color: var(--aurora-2);
    text-decoration: none;
    font-weight: 500;
}

.demo-link:hover {
    text-decoration: underline;
}

/* KB Notification Toast */
.kb-notification {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.4);
}