* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    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.92);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(to right, #6e8efb, #a777e3);
    color: white;
    padding: 20px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.chat-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.chat-header p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

.chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 15px;
    border-radius: 18px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: #6e8efb;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.ai-message {
    background: #f0f4ff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.ai-reasoning {
    background: #f8f9fa;
    color: #495057;
    padding: 15px;
    border-radius: 8px 8px 0 0;
    border-left: 4px solid #6e8efb;
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.reasoning-title {
    font-size: 0.85rem;
    color: #6e8efb;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.reasoning-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

.ai-reasoning h1, .ai-reasoning h2, .ai-reasoning h3, .ai-reasoning h4, .ai-reasoning h5, .ai-reasoning h6 {
    color: #495057;
    margin-top: 0;
    margin-bottom: 10px;
}

.ai-reasoning p {
    margin-bottom: 10px;
}

.ai-reasoning ul, .ai-reasoning ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.ai-reasoning code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.ai-reasoning pre {
    background: #e9ecef;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 10px;
}

.ai-reasoning blockquote {
    border-left: 3px solid #6e8efb;
    padding-left: 10px;
    margin-left: 0;
    color: #6c757d;
    font-style: italic;
}

.ai-content {
    background: #f0f4ff;
    color: #333;
    padding: 15px;
    border-radius: 0 0 8px 8px;
    line-height: 1.6;
}

.ai-content h1, .ai-content h2, .ai-content h3, .ai-content h4, .ai-content h5, .ai-content h6 {
    color: #333;
    margin-top: 0;
    margin-bottom: 10px;
}

.ai-content p {
    margin-bottom: 10px;
}

.ai-content ul, .ai-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.ai-content code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.ai-content pre {
    background: #e9ecef;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 10px;
}

.ai-content blockquote {
    border-left: 3px solid #6e8efb;
    padding-left: 10px;
    margin-left: 0;
    color: #6c757d;
    font-style: italic;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
}

.user-message .message-header {
    justify-content: flex-end;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 14px;
}

.user-avatar {
    background: #4a6cf7;
}

.ai-avatar {
    background: #a777e3;
}

.input-area {
    padding: 15px;
    background: white;
    display: flex;
    border-top: 1px solid #eee;
}

#user-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e0e4ff;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    border-color: #6e8efb;
}

button, .logout-button {
    background: linear-gradient(to right, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 14px 25px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(107, 142, 251, 0.4);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* Specific styles for send button */
.input-area button {
    margin-left: 10px;
}

/* Styles for logout button */
.logout-button {
    font-size: 14px;
    padding: 10px 20px;
}

button:hover, .logout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 142, 251, 0.6);
}

button:active, .logout-button:active {
    transform: translateY(0);
}

.typing-indicator {
    display: flex;
    align-items: center;
    align-self: flex-start;
    background: #f0f4ff;
    color: #666;
    padding: 15px;
    border-radius: 18px;
    font-style: italic;
    max-width: 80%;
}

.loading-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.loading-circle .circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6e8efb;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-circle .circle:nth-child(2) {
    animation-delay: 0.3s;
    margin: 0 5px;
}

.loading-circle .circle:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.typing-indicator .typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.typing-indicator .typing-dots i {
    font-size: 8px;
    animation: typingPulse 1.4s ease-in-out infinite both;
}

.typing-indicator .typing-dots i:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .typing-dots i:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.timestamp {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

/* 滚动条样式 */
.chat-box::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: #a777e3;
}

@media (max-width: 600px) {
    .chat-container {
        height: 95vh;
        border-radius: 15px;
    }

    .message {
        max-width: 90%;
    }

    button {
        padding: 14px 20px;
    }
}
