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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.chat-container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 9px;
    text-align: center;
}

.chat-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.chat-header p {
    font-size: 14px;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}

.message {
    margin-bottom: 20px;
}

.user-message {
    text-align: right;
}

.user-message .message-content {
    background-color: #e1f5fe;
    border-radius: 18px 18px 4px 18px;
    display: inline-block;
    padding: 12px 16px;
    max-width: 80%;
    text-align: left;
}

.ai-message .message-content {
    background-color: #f5f5f5;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    max-width: 80%;
    border: 1px solid #e0e0e0;
}

.system-message {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 20px 0;
}
.message-content hr {
    margin-top:10px;margin-bottom:10px;
}
.message-content ul {
   padding-left:5px;
}
.message-content li {
margin-left:25px;
}

.message-content pre {
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

.message-content code {
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: #f8f8f8;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.message-content th, .message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.message-content th {
    background-color: #f2f2f2;
}

.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid var(--border, #e0e0e0);
    background-color: #fff;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

#userInput {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    resize: none;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 10px;
    transition: border-color 0.25s;
    min-height: 80px;
}
#userInput:focus {
    outline: none;
    border-color: var(--primary, #667eea);
    box-shadow: 0 0 0 3px var(--soft, rgba(102,126,234,0.12));
}

.input-actions {
    
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.input-buttons {
    margin-left: auto;
    display: flex;
    gap: 10px;
    float:right;
}
.model-select {
    max-width: 200px;
    overflow: hidden;
    float: left;
    gap: 10px;
    padding: 8px 10px;
    background: #f7f9ff;
    border: 1px solid #dce3f0;
    border-radius: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
    margin-top:-5px;
}
.model-select label {
    margin-right: 6px;
    color: #3b4960;
    font-size: 14px;
    font-weight: 200;
    letter-spacing: 0.2px;
}
#modelSelect {
    padding: 8px 28px 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    min-width: 150px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 20 20" fill="%23667eea"><path d="M5 7l5 5 5-5"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
}
#modelSelect:hover {
    border-color: var(--primary, #667eea);
    background-color: #fbfcff;
}
#modelSelect:focus {
    border-color: var(--primary, #667eea);
    box-shadow: 0 0 0 3px var(--soft, rgba(102,126,234,0.12));
    outline: none;
}

.btn-primary, .btn-secondary {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.btn-primary {
    background-color: var(--primary, #667eea);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark, #5a67d8);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.btn-primary:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}
.btn-secondary {
    background-color: #e9eef6;
    color: #3b4960;
}
.btn-secondary:hover {
    background-color: #d9e1ec;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.typing-indicator {
    display: inline-block;
    padding: 12px 16px;
    background-color: #f5f7fa;
    border-radius: 18px 18px 18px 4px;
    max-width: 85%;
    border: 1px dashed #d7dbe3;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }
    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .input-buttons {
        margin-left: 0;
        justify-content: flex-end;
    }
    .user-message .message-content,
    .ai-message .message-content {
        max-width: 92%;
    }
}