/* 聊天界面样式 */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.chat-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    max-height: calc(100vh - 300px);
    min-height: 400px;
}

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

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

.user-avatar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.ai-avatar {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.message-content {
    flex: 1;
    max-width: calc(100% - 48px);
}

.message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
}

.ai-message .message-text {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
}

.message-time {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 4px;
    text-align: right;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.welcome-message {
    margin-bottom: 24px;
}

.welcome-message .message-text {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    font-weight: 500;
}

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

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}

#chatInput {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 22px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    background: #f7fafc;
}

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

#chatInput::placeholder {
    color: #a0aec0;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: translateY(0);
}

.chat-suggestions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.suggestion-btn {
    padding: 8px 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

/* 打字指示器动画 */
.typing-indicator .message-text {
    padding: 16px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typingDot 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 typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

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

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        max-height: calc(100vh - 80px);
    }
    
    .chat-messages {
        max-height: calc(100vh - 240px);
        min-height: 300px;
        padding: 12px;
    }
    
    .message {
        margin-bottom: 12px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
        margin-right: 8px;
    }
    
    .message-text {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .chat-input-container {
        padding: 12px 16px;
    }
    
    .chat-suggestions {
        gap: 6px;
    }
    
    .suggestion-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .chat-container {
        background: #1a202c;
    }
    
    .chat-messages {
        background: #2d3748;
    }
    
    .ai-message .message-text {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .chat-input-container {
        background: #1a202c;
        border-top-color: #4a5568;
    }
    
    #chatInput {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #chatInput:focus {
        background: #4a5568;
        border-color: #667eea;
    }
    
    .suggestion-btn {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
}
