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

:root {
    --bg-primary: #212121;
    --bg-secondary: #171717;
    --bg-tertiary: #2f2f2f;
    --bg-hover: #3a3a3a;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --text-muted: #8e8e8e;
    --border-color: #3a3a3a;
    --accent: #10a37f;
    --accent-hover: #0d8a6a;
    --user-bubble: #2f2f2f;
    --assistant-bubble: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    height: 100vh;
}

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

.sidebar-header {
    padding: 12px;
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: var(--bg-hover);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.history-section {
    margin-bottom: 20px;
}

.history-label {
    display: block;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.history-item:hover {
    background: var(--bg-tertiary);
}

.history-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.history-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-info:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
}

.logo-container {
    margin-bottom: 20px;
}

.logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.logo-fallback {
    width: 72px;
    height: 72px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.welcome-screen h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-screen .subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 40px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 600px;
    width: 100%;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}

.suggestion-card:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.suggestion-icon {
    font-size: 20px;
}

.suggestion-card span {
    font-size: 14px;
    color: var(--text-primary);
}

/* Messages */
.message {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    animation: fadeIn 0.3s ease;
}

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

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

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

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.message.assistant .message-avatar img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.message-content {
    flex: 1;
    line-height: 1.6;
    font-size: 15px;
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.message-content code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

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

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

/* Input Area */
.input-container {
    padding: 20px 0 30px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 16px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--text-muted);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    background: var(--text-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}

.send-btn:hover {
    background: var(--text-secondary);
}

.send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.send-btn svg {
    stroke: var(--bg-primary);
}

.disclaimer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .chat-container {
        padding: 0 12px;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    .message {
        gap: 12px;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}
