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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.chat-header {
    background: linear-gradient(135deg, #8B5CF6 0%, #A855F7 100%);
    color: white;
    padding: 25px;
    text-align: center;
    position: relative;
}

.header-content h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

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

.header-icon {
    font-size: 32px;
    margin-bottom: 10px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

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

.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease-out;
}

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

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

.bot-message .message-avatar {
    background: linear-gradient(135deg, #8B5CF6, #A855F7);
    color: white;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    margin-right: 0;
    margin-left: 12px;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: white;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#messageInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

#messageInput:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.send-button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6, #A855F7);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.char-count {
    font-size: 12px;
    color: #64748b;
}

.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.quick-btn:hover {
    background: #8B5CF6;
    color: white;
    border-color: #8B5CF6;
    transform: translateY(-2px);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.loading-spinner i {
    font-size: 32px;
    color: #8B5CF6;
    margin-bottom: 15px;
}

.loading-spinner p {
    color: #64748b;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .chat-container {
        height: 95vh;
        border-radius: 15px;
    }
    
    .chat-header {
        padding: 20px;
    }
    
    .header-content h1 {
        font-size: 20px;
    }
    
    .message-content {
        max-width: 85%;
        padding: 12px 16px;
    }
    
    .quick-actions {
        justify-content: center;
    }
    
    .input-footer {
        flex-direction: column;
        align-items: center;
    }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Markdown 样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.25;
}

.message-content h1 { font-size: 1.5em; color: #8B5CF6; }
.message-content h2 { font-size: 1.3em; color: #8B5CF6; }
.message-content h3 { font-size: 1.1em; color: #64748b; }

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-content strong {
    font-weight: 600;
    color: #374151;
}

.message-content em {
    font-style: italic;
    color: #6b7280;
}

.message-content code {
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d97706;
}

.message-content pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
}

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

.message-content blockquote {
    border-left: 4px solid #8B5CF6;
    margin: 8px 0;
    padding: 8px 16px;
    background: #faf5ff;
    font-style: italic;
}

.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content a {
    color: #8B5CF6;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}