﻿:root {
    --primary-color: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-dark: #5649c0;
    --ai-bubble: #f1f3ff;
    --ai-bubble-error: #e8afc8;
    --user-bubble: #f3f3f3;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --bg-color: #f9f9ff;
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.chat-app {
    width: 100%;
    max-width: 420px;
    height: 90vh;
    max-height: 800px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), #1a153f);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-info {
    flex: 1;
}

.header-info h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.header-info p {
    font-size: 12px;
    opacity: 0.8;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #00b894;
    border-radius: 50%;
    margin-left: auto;
    position: relative;
}

.status-dot::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: rgba(0, 184, 148, 0.3);
    border-radius: 50%;
    top: -4px;
    left: -4px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 1; }
    70% { transform: scale(1.3); opacity: 0; }
    100% { opacity: 0; }
}

.chat-container {
    flex: 1;
    padding: 20px 16px 0;
    overflow-y: auto;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2MDAiIGhlaWdodD0iNjAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii4wNSIgbnVtT2N0YXZlcz0iNSIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjxmZUNvbG9yTWF0cml4IHZhbHVlcz0iMSAwIDAgMCAwIDAgMSAwIDAgMCAwIDAgMSAwIDAgMCAwIDAgLjA1IDAiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iNjAwIiBoZWlnaHQ9IjYwMCIgZmlsdGVyPSJ1cmwoI2EpIiBvcGFjaXR5PSIuMDMiLz48L3N2Zz4=');
}

.message {
    display: flex;
    margin-bottom: 16px;
    position: relative;
}

.message-ai {
    justify-content: flex-start;
}

.message-user {
    justify-content: flex-end;
}

.bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 15px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow-wrap: anywhere;
}

.bubble-ai {
    background: var(--ai-bubble);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.bubble-ai-error {
    background: var(--ai-bubble-error);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.bubble-user {
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 6px;
    text-align: right;
}

.typing-indicator {
    display: flex;
    padding: 12px 16px;
    background: var(--ai-bubble);
    border-radius: 18px;
    margin-bottom: 16px;
    width: fit-content;
    border-bottom-left-radius: 4px;
    align-items: center;
    gap: 4px;
}

.typing-text {
    font-size: 13px;
    color: var(--text-light);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.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); }
    30% { transform: translateY(-4px); }
}

.input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    outline: none;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f8f8;
}

.input-field:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #2b2366);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.send-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.send-button:active {
    transform: translateY(0);
}

.welcome-message {
    text-align: center;
    margin-bottom: 24px;
    animation: fadeIn 0.6s ease-out;
}

.welcome-message h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.welcome-message p {
    font-size: 14px;
    color: var(--text-light);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-enter {
    animation: fadeIn 0.4s ease-out;
}

/* 滚动条样式 */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .chat-app {
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .bubble {
        max-width: 85%;
    }
}