/* ==================== */
/* CSS Variables */
/* ==================== */
:root {
    /* User Defined Color Palette */
    --primary-color: #26549E;
    --secondary-color: #FF5C0A;
    --bg-color: #f4f6f8;
    --text-color: #111827;

    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --button-hover-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    --button-background: #26549E;
    --button-hover-background: #FF5C0A;

    /* Semantic Mapping */
    --bg-primary: var(--bg-color);
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.4);

    --user-color: #b5d0ff47;

    /* Accent Colors */
    --accent-primary: var(--primary-color);
    --accent-secondary: var(--secondary-color);
    --accent-gradient: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    --accent-glow: rgba(38, 84, 158, 0.15);

    /* Text Colors */
    --text-primary: var(--text-color);
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    /* Status Colors */
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --error: #ef4444;
    --warning: #f59e0b;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Fonts */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ==================== */
/* Global Styles */
/* ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Accordion Sidebar Styles */
.nav-section-title {
    padding: 16px 24px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s;
    user-select: none;
    font-size: 0.65rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-section-title:hover {
    color: var(--primary-color);
}

.accordion-arrow {
    font-size: 0.7rem;
    color: #cbd5e1;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.accordion-section .accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.accordion-section.active .accordion-content {
    max-height: 800px;
    /* Large enough for content */
    opacity: 1;
    padding-bottom: 12px;
}

.accordion-section.active .accordion-arrow {
    transform: rotate(180deg);
}

.sidebar-selector-group {
    padding: 0 24px;
    margin-bottom: 15px;
}

.sidebar-selector-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.sidebar-selector-group select {
    width: 100%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.sidebar-selector-group select:hover {
    border-color: var(--primary-color);
    background-color: #f8fafc;
}

.sidebar-selector-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(38, 84, 158, 0.1);
}

/* Main Layout Structure */
.app-wrapper {
    height: calc(100vh - 55px - 30px);
    /* Account for top bar and copyright bar */
    display: flex;
    background: var(--bg-color);
    overflow: hidden;
    position: relative;
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    height: 100%;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    margin-left: -280px;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.03);
}

.sidebar.active {
    margin-left: 0;
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.close-button {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.upload-zone {
    border: 2px dashed rgba(38, 84, 158, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl) var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: rgba(38, 84, 158, 0.02);
}

.upload-zone:hover {
    background: rgba(38, 84, 158, 0.05);
    border-color: var(--primary-color);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.upload-zone p {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.knowledge-list {
    margin-top: var(--spacing-xl);
}

.knowledge-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin-right: 4px;
}

.knowledge-checkbox:checked+.feature-icon+.feature-text h3 {
    color: var(--primary-color);
}

/* System Prompt Panel */
.system-prompt-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 400px;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 100;
    transform: translateX(450px);
    transition: transform var(--transition-normal);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.system-prompt-panel.active {
    transform: translateX(0);
}

.panel-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-content {
    padding: var(--spacing-lg);
}

#system-prompt-input {
    width: 100%;
    height: 200px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    resize: none;
    outline: none;
    margin-bottom: var(--spacing-md);
}

.primary-button {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.primary-button:hover {
    background: var(--secondary-color);
}

/* Mesh Gradient Background */
.app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(at 0% 0%, rgba(38, 84, 158, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(255, 92, 10, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(38, 84, 158, 0.08) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(255, 92, 10, 0.05) 0px, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Texture overlay for premium feel */
.app-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: 1;
}

/* ==================== */
/* Chat Messages Area */
/* ==================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    position: relative;
    z-index: 1;
}

.welcome-message {
    max-width: 900px;
    margin: 2.5rem auto;
    text-align: center;
    animation: welcome-entrance 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes welcome-entrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-icon {
    width: 70px;
    height: 70px;
    background: white;
    border-radius: var(--radius-lg);
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.03);
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-icon::after {
    content: '';
    position: absolute;
    inset: -10px;
    background: var(--accent-glow);
    border-radius: inherit;
    z-index: -1;
    filter: blur(20px);
    opacity: 0.5;
}

.welcome-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.welcome-message h2 {
    font-size: 2.25rem;
    font-weight: 900;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
    letter-spacing: -0.04em;
}

.welcome-message>p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.welcome-credits {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    padding: 0.65rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 2rem;
    gap: 1.25rem;
    transition: all var(--transition-normal);
}

.welcome-credits:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.credit-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.credit-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.credit-value {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 700;
}

.credit-divider {
    width: 1px;
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-normal);
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    animation: slideUpFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.feature-card:nth-child(1) {
    animation-delay: 0.2s;
}

.feature-card:nth-child(2) {
    animation-delay: 0.3s;
}

.feature-card:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card:hover {
    transform: translateY(-6px);
    background: white;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    background: white;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.feature-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.feature-text p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Message Bubbles */
.message {
    margin-bottom: var(--spacing-lg);
    animation: fade-in-up 0.3s ease;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-wrapper {
    display: flex;
    gap: var(--spacing-md);
    max-width: 900px;
    padding: 5px;
}

.message.user .message-wrapper {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: white;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.assistant .message-avatar {
    padding: 2px;
}

.message.user .message-avatar {
    border-color: var(--primary-color);
}

.user-avatar-icon svg {
    width: 100%;
    height: 100%;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.message-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.message.assistant .message-author {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    opacity: 0.8;
}

.message-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(10px);
}

.message:hover .message-actions {
    opacity: 1;
    transform: translateX(0);
}

.msg-action-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    /* Restore readable size */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
}

.message.user .msg-action-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.msg-action-btn i {
    color: #64748b;
    /* Neutral gray normal */
    transition: color 0.2s;
}

.msg-action-btn:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.msg-action-btn.copy-btn:hover i {
    color: var(--primary-color);
    /* Blue for copy */
}

.msg-action-btn.delete-btn:hover i {
    color: #ef4444;
    /* Red for delete */
}

.message-bubble {
    background: white;
    box-shadow: 0 2px 5px var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 5px var(--spacing-lg);
    font-size: 0.95rem;
    color: var(--text-color);
}

.message.user .message-bubble {
    background: var(--user-color);
    border: none;
    color: rgb(1, 1, 9);
    box-shadow: 0 4px 10px rgba(38, 84, 158, 0.2);
}

.message.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* Premium Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.sidebar ::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
}

.chat-messages:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

/* Markdown Styling */
.message-bubble {
    font-size: 0.95rem;
    line-height: 1.6;
}

.message-bubble p {
    margin-bottom: 0.75rem;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    font-weight: 700;
    color: var(--primary-color);
}

.message.user .message-bubble strong {
    color: white;
    text-decoration: underline;
}

.message-bubble em {
    font-style: italic;
    opacity: 0.9;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: #e03131;
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.code-block-container {
    background: #272822;
    /* Monokai Background */
    border-radius: 8px;
    margin: 1.5rem 0;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.code-block-header {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
}

.code-lang {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-family);
    pointer-events: none;
}

.code-copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.code-copy-btn.copied {
    background: #a6e22e;
    /* Monokai Green */
    color: #272822;
    border-color: #a6e22e;
}

.message-bubble pre {
    margin: 0;
    padding: 2.5rem 1.5rem 1.5rem;
    /* Extra top padding for floating header */
    overflow-x: auto;
    background: transparent;
}

.message-bubble pre code {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #f8f8f2;
    background: transparent;
    padding: 0;
}

.message-bubble table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.25rem 0;
    font-size: 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.message.user .message-bubble table {
    border-color: rgba(255, 255, 255, 0.2);
}

.message-bubble th,
.message-bubble td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
}

.message.user .message-bubble th,
.message.user .message-bubble td {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.message-bubble th {
    background: rgba(0, 0, 0, 0.03);
    font-weight: 600;
    color: var(--primary-color);
}

.message.user .message-bubble th {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.message-bubble tr:last-child td {
    border-bottom: none;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-bubble li {
    margin-bottom: 0.4rem;
}

.message-bubble blockquote {
    border-left: 4px solid var(--secondary-color);
    padding: 0.5rem 0 0.5rem 1rem;
    margin: 1rem 0;
    background: rgba(255, 92, 10, 0.05);
    border-radius: 0 4px 4px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.message.user .message-bubble blockquote {
    border-left-color: white;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--spacing-md);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* ==================== */
/* App Layout Upgrades (Coderstation Style) */
/* ==================== */

.top-bar {
    height: 55px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.menu-button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-button i {
    font-size: 1.2rem;
}

.top-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.top-logo img {
    width: 32px;
    height: 32px;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* Sidebar Navigation Styles Moved/Consolidated */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md) 0;
}

.nav-section {
    margin-bottom: var(--spacing-lg);
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    color: #94a3b8;
    margin-bottom: var(--spacing-xs);
    padding: 0 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    text-decoration: none;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.nav-item:hover {
    background: rgba(38, 84, 158, 0.04);
    color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(90deg, #eef4ff 0%, #ffffff 100%);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

.nav-icon {
    width: 20px;
    display: flex;
    justify-content: center;
    font-size: 1rem;
    opacity: 0.9;
}

/* Colored Navigation Icons - Multi-Color Design System */
.fa-comments {
    color: #0ea5e9 !important;
    filter: drop-shadow(0 0 1px rgba(14, 165, 233, 0.2));
}

.fa-plus {
    color: #10b981 !important;
    filter: drop-shadow(0 0 1px rgba(16, 185, 129, 0.2));
}

.fa-file-export {
    color: #f59e0b !important;
    filter: drop-shadow(0 0 1px rgba(245, 158, 11, 0.2));
}

.fa-trash-alt {
    color: #ef4444 !important;
    filter: drop-shadow(0 0 1px rgba(239, 68, 68, 0.2));
}

.fa-cog {
    color: #8b5cf6 !important;
    filter: drop-shadow(0 0 1px rgba(139, 92, 246, 0.2));
}

.fa-folder {
    color: #3b82f6 !important;
    filter: drop-shadow(0 0 1px rgba(59, 130, 246, 0.2));
}

.fa-bars {
    color: #64748b !important;
}

.fa-paper-plane {
    color: #ffffff !important;
}

.fa-microphone {
    color: #ec4899 !important;
}

.fa-ellipsis-h {
    color: #94a3b8 !important;
}

.fa-chevron-down {
    color: #94a3b8 !important;
}

.fa-history {
    color: #6366f1 !important;
}

.fa-download {
    color: #84cc16 !important;
}

.fa-times {
    color: #ef4444 !important;
}

.nav-group {
    margin-bottom: 2px;
}

.nav-sub-items {
    padding: 4px 0 8px 48px;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    margin: 2px 16px 2px 0;
    transition: all 0.2s;
}

.nav-sub-item:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.nav-sub-item.active {
    color: var(--primary-color);
    background: #f0f7ff;
    font-weight: 600;
}

.nav-sub-icon {
    font-size: 0.9rem;
    width: 18px;
    display: flex;
    justify-content: center;
    opacity: 0.9;
}



.nav-sub-item.active .nav-sub-icon {
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(38, 84, 158, 0.3));
}

/* Top Bar Status Badge */
.status-badge {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Messages Upgrades */
.chat-messages {
    flex: 1;
    background: white;
    max-width: 1500px;
    width: calc(100% - 4rem);
    margin: var(--spacing-md) auto 0;
    border-radius: 8px 8px 0 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    padding: 20px var(--spacing-xl);
    /* Set to 20px as requested for display container */
}

/* Welcome Screen Enhancement */
.center-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 40px 0 20px;
}

.center-logo img {
    width: 65px;
    height: 65px;
    background: white;
    border-radius: 50%;
    padding: 8px;
    box-shadow: 0 10px 25px rgba(38, 84, 158, 0.15);
}

.center-logo span {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: -2px;
}

.welcome-sub {
    font-size: 1.15rem;
    color: #64748b;
    margin-bottom: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.suggest-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
}

.suggest-pill {
    padding: 12px 28px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.suggest-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f8fbff;
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(38, 84, 158, 0.1);
}

/* Input Area Redesign */
.chat-footer {
    padding: 5px var(--spacing-xl) 10px;
    background: transparent;
    position: relative;
    z-index: 5;
}

.input-area-wrapper {
    max-width: 1500px;
    margin: 0 auto;
}

.input-box {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    padding: 5px 16px;
    display: flex;
    align-items: flex-end;

    /* Align to bottom for multiline auto-resize */
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
}

.input-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.input-icon-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-bottom: 2px;
    font-size: 1.1rem;
    /* Align with text */
}

.input-icon-btn:hover {
    color: var(--primary-color);
}

.input-box textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 150px;
    color: var(--text-color);
}

.send-btn-primary {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(38, 84, 158, 0.2);
    margin-bottom: 2px;
    font-size: 1.1rem;
}

.send-btn-primary:hover:not(:disabled) {
    background: var(--secondary-color);
    box-shadow: var(--button-hover-shadow);
    transform: scale(1.05);
}

.send-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #cbd5e1;
    box-shadow: none;
}

.disclaimer {
    text-align: center;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 8px;
    font-weight: 500;
}

/* Copyright Bar Styling */
.copyright-bar {
    height: 30px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    gap: 6px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.copyright-bar strong {
    color: #ffd2b3;
}

/* Knowledge Section Styling */
.knowledge-upload-section {
    padding: var(--spacing-md);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8fafc;
}

.knowledge-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.knowledge-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.knowledge-file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.65rem;
    color: #94a3b8;
}

.delete-file-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.delete-file-btn:hover {
    color: #ef4444;
}

.upload-zone {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    background: white;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        box-shadow: 15px 0 30px rgba(0, 0, 0, 0.1);
    }

    .center-logo span {
        font-size: 2rem;
    }

    .bot-info h2 {
        font-size: 0.9rem;
    }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fafafa;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

.user-profile:hover {
    background: #f1f5f9;
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.settings-mini-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.settings-mini-btn:hover {
    color: var(--primary-color);
}

.fa-rocket {
    color: #f43f5e !important;
}

.fa-lock {
    color: #10b981 !important;
}

.fa-bolt {
    color: #f59e0b !important;
}

.fa-exclamation-circle {
    color: #ef4444 !important;
}

.fa-check {
    color: #10b981 !important;
}

/* ==================== */
/* Message Editing */
/* ==================== */
.edit-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 10px 0;
}

.edit-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    font-family: var(--font-family);
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    line-height: 1.5;
}

.edit-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(38, 84, 158, 0.1);
}

.edit-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.edit-save-btn,
.edit-cancel-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.edit-save-btn {
    background: var(--primary-color);
    color: white;
}

.edit-save-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

.edit-cancel-btn {
    background: #f1f5f9;
    color: #64748b;
}

.edit-cancel-btn:hover {
    background: #e2e8f0;
    color: #334155;
}