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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --user-message: #6366f1;
    --assistant-message: #334155;
    --tool-call: #10b981;
    --error: #ef4444;
    --success: #10b981;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

header {
    background: var(--surface);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--surface-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    font-size: 0.75rem;
    color: var(--success);
    animation: pulse 2s infinite;
}

.status-indicator.disconnected {
    color: var(--error);
}

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

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

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--surface);
}

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

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.welcome-message {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--surface-light);
    max-width: 800px;
    margin: 0 auto;
}

.welcome-message h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-message ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.welcome-message li {
    margin: 0.5rem 0;
}

.example-queries {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.example-btn {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--surface-light);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

.message {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    animation: slideIn 0.3s ease-out;
    max-width: 85%;
    word-wrap: break-word;
}

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

.message.user {
    align-self: flex-end;
    background: var(--user-message);
    color: white;
    margin-left: auto;
}

.message.assistant {
    align-self: flex-start;
    background: var(--assistant-message);
    color: var(--text-primary);
    border: 1px solid var(--surface-light);
}

.message.tool-call {
    align-self: flex-start;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--tool-call);
    color: var(--tool-call);
    font-size: 0.875rem;
    max-width: 100%;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.message-text {
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-text code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-text pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.loading {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

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

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

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.input-container {
    background: var(--surface);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--surface-light);
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

textarea {
    flex: 1;
    background: var(--surface-light);
    border: 1px solid var(--surface-light);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    min-height: 50px;
    max-height: 200px;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.btn-primary, .btn-secondary {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.input-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

kbd {
    background: var(--surface-light);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    border: 1px solid var(--surface);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

/* Responsive design */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .chat-container {
        padding: 1rem;
    }

    .message {
        max-width: 95%;
    }

    .input-container {
        padding: 1rem;
    }

    .input-wrapper {
        flex-direction: column;
    }

    textarea {
        width: 100%;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

