:root {
    /* Light Mode Variables (Default) */
    --bg-color: #f3f4f6; 
    --container-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    
    --user-bubble: #2563eb; 
    --user-text: #ffffff;
    --ai-bubble: #f3f4f6;
    --ai-text: #1f2937;
}

/* Dark Mode Variables Override */
body.dark-mode {
    --bg-color: #111827; /* Dark slate */
    --container-bg: #1f2937; /* Slightly lighter gray for the container */
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    
    --user-bubble: #3b82f6; /* Slightly brighter blue for contrast */
    --user-text: #ffffff;
    --ai-bubble: #374151;
    --ai-text: #f3f4f6;
}

* { 
    box-sizing: border-box; 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
}

/* Added transition for smooth theme switching */
body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background: var(--container-bg);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--container-bg);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.version {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    font-size: 0.875rem;
    color: #10b981; 
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.status-indicator::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
}

/* Theme Toggle Button */
.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    width: auto;
    height: auto;
}

.theme-btn:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

/* Chat Area */
.chat-interface {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--container-bg);
}

.message {
    display: flex;
    width: 100%;
}

.user-msg { justify-content: flex-end; }
.ai-msg { justify-content: flex-start; }

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

.ai-msg .message-content {
    background-color: var(--ai-bubble);
    color: var(--ai-text);
    border-bottom-left-radius: 4px;
}

/* Input Area */
.input-area {
    display: flex;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--container-bg);
    gap: 12px;
    align-items: center;
}

input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus {
    background: var(--container-bg);
    border-color: var(--user-bubble);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.send-btn {
    background: var(--user-bubble);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.send-btn:hover { background: #1d4ed8; }
.send-btn:active { transform: scale(0.95); }
