:root {
    --bg-dark: #0f1117;
    --bg-panel: #1e212b;
    --bg-chat: #161920;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #2d3748;
    --input-bg: #2d313c;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

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

.brand h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.highlight {
    color: var(--primary);
}

.upload-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.02);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.drop-zone .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.drop-zone p {
    font-weight: 500;
    font-size: 0.9rem;
}

.drop-zone .sub-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.status-item {
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    background: var(--input-bg);
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.info-panel {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* Chat Area */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat);
}

.chat-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-panel);
}

.connection-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border);
}

.connection-status.connected {
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.messages-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

.message.human {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.human .avatar {
    background: var(--primary);
    color: white;
}

.message .content {
    background: var(--bg-panel);
    padding: 1rem;
    border-radius: 0.75rem;
    line-height: 1.6;
    font-size: 0.95rem;
    border: 1px solid var(--border);
}

.message.human .content {
    background: var(--primary); /* Optional: distinct bubble for user */
    border-color: var(--primary);
    /* For better readability on primary color if needed, but keeping panel style is cleaner */
    background: rgba(99, 102, 241, 0.15); 
    border-color: rgba(99, 102, 241, 0.3);
}

.message.system .content {
    white-space: pre-wrap; /* Preserve formatting for code */
}

/* Markdown/Code styling within messages */
.message .content code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0,0,0,0.3);
    padding: 0.2em 0.4em;
    border-radius: 0.25em;
    font-size: 0.85em;
}

.message .content pre {
    background: #0d0e12;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.input-area {
    padding: 2rem;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 3.5rem 1rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 200px;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--primary);
}

#send-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: var(--primary);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#send-btn:hover {
    background: var(--primary-hover);
}

#send-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

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