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

:root {
    --sidebar-width: 260px;
    --primary: #10a37f;
    --primary-hover: #0d8c6f;
    --border: #e5e5e5;
    --text: #202123;
    --text-secondary: #6e6e80;
    --bg-white: #ffffff;
    --bg-gray: #f7f7f8;
    --bg-hover: #ececf1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-white);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

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

.sidebar-header {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    height: 24px;
    width: auto;
    margin-bottom: 0.75rem;
    filter: brightness(0) invert(1);
}

.new-chat-btn {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-section {
    margin-bottom: 1rem;
}

.history-title {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    text-transform: uppercase;
}

.history-item {
    padding: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
}

/* Welcome Screen */
.welcome-screen {
    max-width: 48rem;
    margin: 0 auto;
    text-align: center;
    padding: 4rem 1rem;
}

.welcome-screen h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 3rem;
    color: var(--text);
}

.sample-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    max-width: 56rem;
    margin: 0 auto;
}

.sample-prompt {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.sample-prompt:hover {
    background: var(--bg-gray);
}

.prompt-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.prompt-text {
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.5;
}

/* Messages */
.message {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}

.message.user {
    background: var(--bg-white);
}

.message.ai {
    background: var(--bg-gray);
}

.message-content {
    max-width: 48rem;
    margin: 0 auto;
}

.message-text {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text);
}

.message.user .message-text {
    font-weight: 500;
}

/* Code blocks */
.message-text pre {
    background: #000;
    color: #fff;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.message-text code {
    font-family: 'Monaco', 'Courier New', monospace;
}

/* Tables */
.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.message-text th,
.message-text td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.message-text th {
    background: var(--bg-gray);
    font-weight: 600;
}

/* Loading */
.loading {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
}

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

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.input-area {
    border-top: 1px solid var(--border);
    padding: 1rem;
    background: var(--bg-white);
}

.input-wrapper {
    max-width: 48rem;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 0 0 1px transparent;
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--text);
    box-shadow: 0 0 0 1px var(--text);
}

#userInput {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    background: transparent;
    color: var(--text);
}

#userInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    background: var(--text);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

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

.send-btn:disabled {
    background: var(--bg-hover);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Scrollbar */
.chat-container::-webkit-scrollbar,
.chat-history::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

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

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

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

    .sample-prompts {
        grid-template-columns: 1fr;
    }
}