/**
 * 通用AI客服对话框样式
 * 可在所有页面使用
 */

/* AI客服对话框样式 */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 500px;
    height: 700px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    transition: all 0.3s ease;
}
.chat-window.show {
    display: flex;
}
.chat-window.minimized {
    height: 60px;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}
.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-header-title .avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-header-actions {
    display: flex;
    gap: 10px;
}
.chat-header-actions button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}
.chat-header-actions button:hover {
    background: rgba(255,255,255,0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.message.user {
    flex-direction: row-reverse;
}
.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.message.bot .message-avatar {
    background: #e9ecef;
    color: #667eea;
}
.message-content {
    max-width: 70%;
    padding: 12px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}
.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
    text-align: right;
}
.message.user .message-time {
    text-align: left;
}

.message-documents {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}
.document-item {
    background: #f8f9fa;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: 8px;
    border-left: 3px solid #0dcaf0;
    font-size: 0.85rem;
}
.document-title {
    font-weight: bold;
    color: #0d6efd;
    margin-bottom: 5px;
}
.document-content {
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 5px;
}
.document-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #999;
}

.chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 16px;
    resize: none;
    font-size: 15px;
    line-height: 1.6;
    min-height: 80px;
    max-height: 200px;
    transition: all 0.2s;
    font-family: inherit;
}
.chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.chat-input-wrapper-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.chat-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}
.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: none;
    padding: 10px 15px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}
.typing-indicator.show {
    display: block;
}
.typing-dots {
    display: flex;
    gap: 4px;
}
.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingDot 1.4s infinite;
}
.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}
.welcome-message-icon {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 15px;
}
.welcome-message h5 {
    color: #333;
    margin-bottom: 10px;
}
.welcome-message p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        bottom: 80px;
    }
}

