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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --danger-color: #ef4444;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-light: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    display: none;
}

.header-content h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Container */
.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    padding: 1rem;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100vh;
}

.sidebar-section {
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.sidebar-section h3 {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.input-group input {
    padding: 0.75rem;
    background: var(--bg-darker);
    border: none;
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.input-group input:focus {
    outline: none;
}

.divider {
    display: none;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn {
    padding: 0.65rem 0.85rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

.btn-primary:hover {
    background: #4f46e5;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: #ff6b35;
    color: #ffffff;
    font-weight: 700;
}

.btn-warning:hover {
    background: #e85a2a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.memory-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 0.5rem;
    min-height: 0;
    padding-right: 0.25rem;
    scroll-behavior: smooth;
}

.memory-item {
    padding: 0.5rem;
    background: var(--bg-darker);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary-color);
    line-height: 1.4;
}

.tip {
    margin-top: auto;
    padding: 1rem;
    background: var(--bg-darker);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-darker);
    position: relative;
}

/* Chat Header */
.chat-header {
    padding: 2rem;
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-content {
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.chat-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.robot-emoji {
    font-size: 2rem;
    animation: bounce 2s infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.robot-emoji:hover {
    transform: scale(1.2) rotate(10deg);
}

.chat-title h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.5px;
    transition: all 0.3s ease;
    cursor: default;
}

.chat-title h1:hover {
    letter-spacing: 0px;
    transform: scale(1.02);
}

.chat-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.chat-subtitle:hover {
    opacity: 1;
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.welcome-message {
    text-align: center;
    margin: auto;
    color: var(--text-secondary);
}

.welcome-message h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

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

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

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

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

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

.message.assistant .message-avatar {
    background: var(--secondary-color);
}

.message-content {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 1rem;
    flex: 1;
    line-height: 1.6;
}

.message.user .message-content {
    background: var(--primary-color);
}

.message.assistant .message-content {
    background: var(--bg-light);
}

/* Markdown Styling */
.message-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-content em {
    font-style: italic;
    color: var(--text-primary);
}

.message-content code {
    background: var(--bg-darker);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #f472b6;
    border: 1px solid var(--border-color);
}

.message-content pre {
    background: var(--bg-darker);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.5rem 0;
    border: 1px solid var(--border-color);
}

.message-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text-primary);
}

.message-content h1, 
.message-content h2, 
.message-content h3, 
.message-content h4, 
.message-content h5, 
.message-content h6 {
    color: var(--text-primary);
    margin: 0.75rem 0 0.5rem 0;
    font-weight: 600;
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.15em; }
.message-content h4 { font-size: 1.05em; }

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.25rem 0;
    line-height: 1.5;
}

.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.message-content br {
    display: block;
    content: "";
    margin: 0.25rem 0;
}

/* Response Time */
.response-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
}

/* Input Area */
.input-area {
    padding: 1rem 2rem 1.5rem 2rem;
    background: var(--bg-darker);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.input-area textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: none;
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    line-height: 1.5;
    font-family: inherit;
}

.input-area textarea:focus {
    outline: none;
}

.send-button {
    padding: 0.75rem 1.5rem;
    background: #1e3a5f;
    color: #e0e7ff;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    min-width: 80px;
    height: 44px;
    flex-shrink: 0;
}

.send-button:hover {
    background: #2563eb;
    color: #ffffff;
}

.send-button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* Thinking indicator in chat */
.thinking-indicator {
    display: flex;
    gap: 1rem;
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

.thinking-indicator .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: var(--secondary-color);
}

.thinking-indicator .thinking-content {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.thinking-dots {
    display: flex;
    gap: 0.25rem;
}

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

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

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -300px;
        z-index: 100;
        transition: left 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .message {
        max-width: 95%;
    }
}

