/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 32px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #95a5a6;
    animation: pulse 2s infinite;
}

.status-indicator.online {
    background: #2ecc71;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 聊天区域 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 15px;
    animation: slideIn 0.3s ease-out;
}

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

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

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

.message.user .message-avatar {
    background: #667eea;
    color: white;
}

.message.assistant .message-avatar {
    background: #764ba2;
    color: white;
}

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

.message-text {
    background: white;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    line-height: 1.6;
    color: #2c3e50;
}

.message.user .message-text {
    background: #667eea;
    color: white;
}

.message-text ul {
    margin: 10px 0 0 20px;
}

.message-text li {
    margin: 8px 0;
}

/* 附件卡片 */
.attachment-card {
    margin-top: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.attachment-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.attachment-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.attachment-meta {
    font-size: 12px;
    color: #7f8c8d;
}

.attachment-download {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.attachment-download:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    animation: slideIn 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #95a5a6;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

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

.loading-text {
    color: #7f8c8d;
    font-size: 14px;
}

/* 输入区域 */
.input-container {
    background: white;
    padding: 20px 30px;
    border-top: 1px solid #ecf0f1;
}

.input-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
}

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

#messageInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-button {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.send-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.input-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #95a5a6;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 错误提示 */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #e74c3c;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideInRight 0.3s ease-out;
    z-index: 1000;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.error-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
}

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

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

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        height: 100vh;
        border-radius: 0;
    }

    .header {
        padding: 15px 20px;
    }

    .logo h1 {
        font-size: 18px;
    }

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

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

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

    .attachment-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .attachment-download {
        width: 100%;
        text-align: center;
    }
}
