:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --primary-color: #6366f1; /* Indigo */
    --accent-color: #818cf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --bot-msg-bg: #334155;
    --user-msg-bg: #4f46e5;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top right, #1e1b4b 0%, transparent 40%),
                radial-gradient(circle at bottom left, #1e1b4b 0%, transparent 40%);
    position: relative;
}

/* Header */
header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

/* Chat Area */
#chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.bot-message .avatar {
    background: linear-gradient(135deg, #4f46e5, #ec4899);
    color: white;
}

.user-message .avatar {
    background: var(--surface-color);
    color: var(--text-secondary);
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
}

.bot-message .message-content {
    background-color: var(--bot-msg-bg);
    border-top-left-radius: 0;
}

.user-message .message-content {
    background-color: var(--user-msg-bg);
    color: white;
    border-top-right-radius: 0;
}

.message-content ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

/* Citations inside bot message */
.citation {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.citation-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-color);
    text-decoration: none;
    margin-right: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.citation-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Input Area */
footer {
    padding: 1.5rem 2rem;
    background: var(--bg-color); /* Matches bg to hide scroll behind */
}

.input-container {
    background: var(--surface-color);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
}

.input-container:focus-within {
    border-color: var(--primary-color);
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    padding: 0.5rem 0;
}

#send-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, background 0.2s;
}

#send-btn:hover {
    background: #4338ca;
}

#send-btn:active {
    transform: scale(0.95);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}
