:root {
    --bg-main: #0b0f19;
    --bg-sidebar: rgba(17, 24, 39, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --user-bubble: linear-gradient(135deg, #3b82f6, #6366f1);
    --agent-bubble: rgba(30, 41, 59, 0.7);
    --glass-bg: rgba(15, 23, 42, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at top right, #1e293b, var(--bg-main));
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

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

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    z-index: 20;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.6));
}

.ingest-section h3, .current-repo-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}

.ingest-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
    background-color: rgba(0,0,0,0.4);
}

button {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent-color), #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled {
    background: #334155;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.status-box {
    margin-top: 20px;
    padding: 14px;
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    backdrop-filter: blur(8px);
    animation: slideDown 0.3s ease-out;
}

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

.status-box.hidden {
    display: none;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
}

.status-indicator.success { background-color: #34d399; box-shadow: 0 0 8px #34d399; }
.status-indicator.error { background-color: #f87171; box-shadow: 0 0 8px #f87171; }
.status-indicator.pulsing {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

.repo-badge {
    padding: 10px 14px;
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    display: inline-block;
}

/* Chat Main Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: transparent;
}

.chat-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--glass-bg);
    backdrop-filter: blur(16px);
    z-index: 10;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.chat-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    width: 100%;
    animation: messagePopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

@keyframes messagePopIn {
    from { opacity: 0; transform: translateY(15px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message-content {
    max-width: 85%;
    padding: 18px 24px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

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

.user-message .message-content {
    background: var(--user-bubble);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.agent-message {
    justify-content: flex-start;
}

.agent-message .message-content {
    background-color: var(--agent-bubble);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(8px);
}

.system-message {
    justify-content: center;
}

.system-message .message-content {
    background-color: transparent;
    color: var(--text-secondary);
    font-style: italic;
    border: none;
    text-align: center;
    box-shadow: none;
}

.chat-input-area {
    padding: 24px 32px;
    border-top: 1px solid var(--border-color);
    background-color: var(--glass-bg);
    backdrop-filter: blur(16px);
    z-index: 10;
}

#chat-form {
    display: flex;
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

#chat-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1rem;
    border-radius: 12px;
    background-color: rgba(0,0,0,0.3);
}

#chat-input:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

#send-btn {
    border-radius: 12px;
    padding: 0 28px;
}

/* Markdown styling inside Agent messages */
.agent-message .message-content p { margin-bottom: 14px; }
.agent-message .message-content p:last-child { margin-bottom: 0; }
.agent-message .message-content h1, 
.agent-message .message-content h2, 
.agent-message .message-content h3 { 
    margin-top: 20px; 
    margin-bottom: 12px; 
    color: #fff;
}
.agent-message .message-content code {
    font-family: 'Fira Code', monospace;
    background-color: rgba(0,0,0,0.4);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #93c5fd;
}
.agent-message .message-content pre {
    background-color: #0f172a;
    padding: 16px 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}
.agent-message .message-content pre code {
    background-color: transparent;
    padding: 0;
    color: #e2e8f0;
}
.agent-message .message-content ul, 
.agent-message .message-content ol {
    margin-left: 24px;
    margin-bottom: 14px;
}
.agent-message .message-content li {
    margin-bottom: 6px;
}
