:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-primary: #ffffff;
    --bg-secondary: #f1f5f9;
    --border-color: #e2e8f0;
    --user-bubble: #6366f1;
    --bot-bubble: #f1f5f9;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --border-color: #334155;
    --user-bubble: #6366f1;
    --bot-bubble: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.app-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-primary);
    box-shadow: var(--shadow);
}

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

.sidebar-header {
    text-align: center;
    margin-bottom: 32px;
}

.bot-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: white;
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.sidebar-features {
    margin-bottom: 32px;
}

.sidebar-features h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.sidebar-features ul {
    list-style: none;
}

.sidebar-features li {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.sidebar-features li:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.sidebar-features li i {
    width: 16px;
}

.conversation-stats {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.stat {
    text-align: center;
    margin-bottom: 16px;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.clear-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.header-info h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    max-width: 80%;
}

.welcome-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.welcome-text h3 {
    margin-bottom: 8px;
    font-size: 18px;
}

.welcome-text p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-btn {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: messageAppear 0.3s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: var(--user-bubble);
    color: white;
}

.bot-message .message-avatar {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.message-content {
    padding: 16px 20px;
    border-radius: 20px;
    line-height: 1.5;
    box-shadow: var(--shadow);
}

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

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

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    opacity: 0.7;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    gap: 12px;
    max-width: 80%;
    padding: 0 32px 24px;
}

.typing-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.typing-content {
    padding: 16px 20px;
    background: var(--bot-bubble);
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input */
.chat-input-container {
    padding: 24px 32px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.chat-form {
    margin-bottom: 12px;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    padding: 8px;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#user-message {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    resize: none;
    max-height: 120px;
}

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

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

.input-suggestions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.suggestion-btn {
    padding: 4px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar-features ul {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .sidebar-features li {
        flex: 1;
        min-width: 140px;
        text-align: center;
    }
    
    .welcome-message,
    .message {
        max-width: 95%;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-box {
        padding: 16px 20px;
    }
    
    .chat-input-container {
        padding: 16px 20px;
    }
}

/* Code blocks in messages */
.message-content pre {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

.user-message .message-content pre {
    background: rgba(255, 255, 255, 0.2);
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

.user-message .message-content code {
    background: rgba(255, 255, 255, 0.2);
}