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

:root {
    --black: #000000;
    --dark-gray: #111111;
    --medium-gray: #222222;
    --light-gray: #333333;
    --white: #ffffff;
    --off-white: #f5f5f5;
    --border-color: #333333;
    --hover-color: #2a2a2a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--black);
    color: var(--white);
    overflow: hidden;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--black);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 2rem;
}

.splash-logo span {
    color: var(--white);
    opacity: 0.7;
}

.splash-loader {
    width: 50px;
    height: 50px;
    border: 3px solid var(--light-gray);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.app-container.visible {
    opacity: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--black);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--white) 0%, var(--off-white) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    -webkit-text-fill-color: var(--white);
    opacity: 0.7;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--white);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.new-chat-btn:hover {
    background: var(--light-gray);
    border-color: var(--white);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.history-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: var(--light-gray);
    border-color: var(--white);
    transform: translateX(5px);
}

.history-item.active {
    background: var(--light-gray);
    border-color: var(--white);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.memory-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--dark-gray);
    border-radius: 25px;
    font-size: 12px;
}

.memory-dot {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--black);
}

.main-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--white);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: var(--light-gray);
    border-color: var(--white);
    transform: scale(1.05);
}

.header-title h1 {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--white);
    opacity: 0.7;
}

.header-actions {
    margin-left: auto;
}

.research-btn {
    padding: 10px 20px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--white);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.research-btn:hover {
    background: var(--light-gray);
    border-color: var(--white);
}

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.messages-container {
    max-width: 800px;
    margin: 0 auto;
}

.message {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.message.user .avatar {
    background: var(--light-gray);
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    border-top-left-radius: 5px;
    line-height: 1.6;
}

.message.user .message-content {
    background: var(--light-gray);
    border-top-left-radius: 30px;
    border-top-right-radius: 5px;
}

.message-content p {
    margin-bottom: 10px;
}

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

.welcome-message .message-content {
    background: var(--dark-gray);
}

.suggestion {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 10px;
}

/* Input Area */
.input-area {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 10px;
}

.upload-buttons {
    display: flex;
    gap: 5px;
}

.upload-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: var(--light-gray);
    border-color: var(--white);
    transform: scale(1.05);
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--white);
    font-size: 14px;
    padding: 10px;
    resize: none;
    max-height: 150px;
    outline: none;
    font-family: inherit;
}

.message-input::placeholder {
    color: var(--white);
    opacity: 0.3;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    color: var(--black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    background: var(--off-white);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--black);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--light-gray);
    border-color: var(--white);
}

.modal-body {
    padding: 30px;
}

.research-input {
    width: 100%;
    padding: 15px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--white);
    font-size: 14px;
    resize: vertical;
    min-height: 120px;
    margin-bottom: 20px;
    outline: none;
    font-family: inherit;
}

.research-input:focus {
    border-color: var(--white);
}

.research-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.research-option {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    font-size: 14px;
    cursor: pointer;
}

.research-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--white);
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.cancel {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--white);
}

.modal-btn.cancel:hover {
    background: var(--light-gray);
    border-color: var(--white);
}

.modal-btn.confirm {
    background: var(--white);
    border: 1px solid var(--white);
    color: var(--black);
}

.modal-btn.confirm:hover {
    background: var(--off-white);
}

/* Syntax Highlighting */
code[class*="language-"],
pre[class*="language-"] {
    color: #f8f8f2;
    background: none;
    text-shadow: 0 1px rgba(0, 0, 0, 0.3);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

pre[class*="language-"] {
    padding: 1em;
    margin: 0.5em 0;
    overflow: auto;
    border-radius: 0.8em;
    background: #1a1a1a;
    border: 1px solid #333;
}

:not(pre) > code[class*="language-"] {
    padding: 0.2em 0.4em;
    border-radius: 0.3em;
    background: #1a1a1a;
    white-space: normal;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #8292a2;
}

.token.punctuation {
    color: #f8f8f2;
}

.token.namespace {
    opacity: 0.7;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
    color: #f92672;
}

.token.boolean,
.token.number {
    color: #ae81ff;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #a6e22e;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
    color: #f8f8f2;
}

.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
    color: #e6db74;
}

.token.keyword {
    color: #66d9ef;
}

.token.regex,
.token.important {
    color: #fd971f;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

.message-content code:not([class*="language-"]) {
    background: #1a1a1a;
    padding: 0.2em 0.4em;
    border-radius: 0.3em;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    color: #ff9d00;
    border: 1px solid #333;
}

.message-content pre {
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
}

.message-content pre code {
    display: block;
    padding: 15px;
    overflow-x: auto;
    background: #1a1a1a;
    border-radius: 12px;
    border: 1px solid #333;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #222;
    border: 1px solid #333;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    font-size: 12px;
    color: #888;
}

.copy-code-btn {
    background: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-code-btn:hover {
    background: #444;
    border-color: #666;
}

/* File Attachment */
.file-attachment {
    background: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 10px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.file-attachment svg {
    flex-shrink: 0;
}

.file-attachment .file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-attachment .file-size {
    opacity: 0.7;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    border-top-left-radius: 5px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
    opacity: 0.5;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--black);
}

::-webkit-scrollbar-thumb {
    background: var(--light-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 100;
        height: 100vh;
        transform: translateX(-280px);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .header-title h1 {
        display: none;
    }
    
    .research-options {
        flex-direction: column;
        gap: 10px;
    }
}
/* Markdown Styling */
.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    word-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 { font-size: 2em; border-bottom: 1px solid #333; padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid #333; padding-bottom: 0.3em; }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: #888; }

.markdown-body p {
    margin-top: 0;
    margin-bottom: 1em;
}

.markdown-body strong {
    font-weight: 600;
    color: #fff;
}

.markdown-body em {
    font-style: italic;
}

.markdown-body ul,
.markdown-body ol {
    margin-top: 0;
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-body ul {
    list-style-type: disc;
}

.markdown-body ol {
    list-style-type: decimal;
}

.markdown-body li {
    margin-bottom: 0.25em;
}

.markdown-body li + li {
    margin-top: 0.25em;
}

.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: #1a1a1a;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    color: #ff9d00;
    border: 1px solid #333;
}

.markdown-body pre {
    margin: 1em 0;
    padding: 0;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #333;
}

.markdown-body pre code {
    padding: 1em;
    background-color: transparent;
    border: none;
    border-radius: 0;
    font-size: 100%;
    color: #f8f8f2;
    display: block;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
}

.markdown-body a {
    color: #58a6ff;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body blockquote {
    padding: 0 1em;
    color: #888;
    border-left: 0.25em solid #333;
    margin: 1em 0;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #333;
}

.markdown-body table tr {
    background-color: #111;
    border-top: 1px solid #333;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #1a1a1a;
}

.markdown-body img {
    max-width: 100%;
    box-sizing: content-box;
    border-radius: 8px;
}

.markdown-body hr {
    height: 2px;
    padding: 0;
    margin: 1.5em 0;
    background-color: #333;
    border: 0;
}

/* Syntax highlighting colors */
.markdown-body pre code .token.comment,
.markdown-body pre code .token.prolog,
.markdown-body pre code .token.doctype,
.markdown-body pre code .token.cdata {
    color: #6a9955;
}

.markdown-body pre code .token.punctuation {
    color: #d4d4d4;
}

.markdown-body pre code .token.property,
.markdown-body pre code .token.tag,
.markdown-body pre code .token.boolean,
.markdown-body pre code .token.number,
.markdown-body pre code .token.constant,
.markdown-body pre code .token.symbol,
.markdown-body pre code .token.deleted {
    color: #b5cea8;
}

.markdown-body pre code .token.selector,
.markdown-body pre code .token.attr-name,
.markdown-body pre code .token.string,
.markdown-body pre code .token.char,
.markdown-body pre code .token.builtin,
.markdown-body pre code .token.inserted {
    color: #ce9178;
}

.markdown-body pre code .token.operator,
.markdown-body pre code .token.entity,
.markdown-body pre code .token.url,
.markdown-body pre code .language-css .token.string,
.markdown-body pre code .style .token.string {
    color: #d4d4d4;
}

.markdown-body pre code .token.atrule,
.markdown-body pre code .token.attr-value,
.markdown-body pre code .token.keyword {
    color: #c586c0;
}

.markdown-body pre code .token.function,
.markdown-body pre code .token.class-name {
    color: #dcdcaa;
}

.markdown-body pre code .token.regex,
.markdown-body pre code .token.important,
.markdown-body pre code .token.variable {
    color: #d16969;
}