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

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --user-bg: #667eea;
    --assistant-bg: #f8f9fa;
    --border: #e0e0e0;
    --text: #333;
    --text-light: #666;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gradient);
    height: 100vh;
    overflow: hidden;
}

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

/* Header */
.header {
    background: white;
    padding: 20px 30px;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header h1 {
    color: var(--text);
    font-size: 28px;
}

.header-badges {
    display: flex;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-gradient);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

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

.model-select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    flex: 1;
}

.model-select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-secondary {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #fafbfc;
}

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

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

.chat-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

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

/* Welcome Message */
.welcome-message {
    text-align: center;
    max-width: 600px;
    margin: 80px auto;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.welcome-message h2 {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 28px;
}

.welcome-message p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 30px;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.feature {
    padding: 12px 20px;
    background: white;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Message */
.message {
    display: flex;
    gap: 15px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease-out;
}

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

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

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

.assistant-message .message-avatar {
    background: #e8eaf6;
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message-header {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 14px;
}

.message-text {
    padding: 16px 20px;
    border-radius: var(--radius);
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

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

.assistant-message .message-text {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.message-text code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.input-container {
    background: white;
    border-top: 2px solid var(--border);
    padding: 20px 30px;
}

.chat-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    line-height: 1.5;
}

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

.btn-send {
    padding: 14px 28px;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-send:active {
    transform: translateY(0);
}

.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

kbd {
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 11px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error Message */
.error-message {
    background: #fee;
    color: #c33;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-controls {
        width: 100%;
        flex-direction: column;
    }

    .chat-container {
        padding: 20px;
    }

    .message-content {
        max-width: 85%;
    }

    .welcome-message {
        margin: 40px auto;
    }

    .input-container {
        padding: 15px 20px;
    }
}
