/* AI客服聊天组件样式 */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 480px;
    height: 600px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-widget.minimized {
    height: 60px;
}

.chat-widget.minimized .chat-body {
    display: none;
}

/* 聊天头部 */
.chat-header {
    background:#f8931d;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px;
}

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

.chat-minimize,
.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.chat-minimize:hover,
.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 聊天主体 */
.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 76px);
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* 消息样式 */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
    flex-shrink: 0;
}

.message-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e9ecef;
    padding: 2px;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.ai-message .message-text {
    background: #ffffff;
    color: #333;
    border: 1px solid #e9ecef;
    border-radius: 18px 18px 18px 4px;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-left: 16px;
}

.user-message .message-time {
    text-align: right;
    margin-left: 0;
    margin-right: 16px;
}

/* 输入区域 */
.chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.login-prompt {
    text-align: center;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #856404;
}

.login-prompt a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.login-prompt a:hover {
    text-decoration: underline;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: #667eea;
}

.chat-input::placeholder {
    color: #6c757d;
}

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

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

.send-button:active {
    transform: scale(0.95);
}

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

/* 加载动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 18px 18px 18px 4px;
    margin-bottom: 8px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

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

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 40px);
        bottom: 10px;
        right: 10px;
        left: 10px;
        border-radius: 12px;
    }
    
    .chat-widget.minimized {
        width: 200px;
        left: auto;
    }
}

/* 右侧固定按钮样式增强 */
.fix-side .chat-service {
    background: #f8931d;
 
    text-align: center;
    transition: all 0.3s ease;
}

.fix-side .chat-service:hover {

    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fix-side .chat-service .show {
    color: white;
    cursor: pointer;
}

.fix-side .chat-service .show p {
    
}
/* AI提示语 */
  .chat-bubble { 
        position: fixed;
    right: 120px;
    bottom: 200px;

    height: 100px;
    display: flex;
    text-align: justify;
    align-items:center;
    justify-content: center;
    z-index: 2000;
    color: #333;
    background:rgba(255,255,255,.7);
            padding: 12px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            max-width: 220px;
            opacity: 0;
            transform: translatex(10px);
            transition: all 0.3s ease;
  }
  .chat-bubble::after {
            content: '';
            position: absolute;
            bottom: 40px;
            right: -10px;
            width: 0;
            height: 0;
            border-top: 10px solid transparent;
            border-bottom: 10px solid transparent;
            border-left: 10px solid rgba(255,255,255,.7);
        }
      .chat-bubble.show {
            opacity: 1;
            transform: translateY(0);
        }
/* 消息流式输出动画 */
.message-streaming {
    position: relative;
}

.message-streaming::after {
    content: '▋';
    animation: blink 1s infinite;
    color: #667eea;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Markdown 内容样式 */
.message-text pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.message-text code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #e83e8c;
}

.message-text pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #333;
}

.message-text strong {
    font-weight: 600;
    color: #2c3e50;
}

.message-text em {
    font-style: italic;
    color: #6c757d;
}

.message-text a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.message-text a:hover {
    border-bottom-color: #007bff;
}

.user-message .message-text strong,
.user-message .message-text em {
    color: rgba(255, 255, 255, 0.9);
}

.user-message .message-text a {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.user-message .message-text a:hover {
    border-bottom-color: rgba(255, 255, 255, 0.9);
}

/* 标题样式 */
.message-text h1, .message-text h2, .message-text h3,
.message-text h4, .message-text h5, .message-text h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
    color: #2c3e50;
}

.message-text h1 { font-size: 1.8em; }
.message-text h2 { font-size: 1.6em; }
.message-text h3 { font-size: 1.4em; }
.message-text h4 { font-size: 1.2em; }
.message-text h5 { font-size: 1.1em; }
.message-text h6 { font-size: 1em; }

/* 列表样式 */
.message-text ul, .message-text ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-text ul li {
    list-style-type: disc;
}

.message-text ol li {
    list-style-type: decimal;
}

/* 引用块样式 */
.message-text blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 4px solid #007bff;
    background: #f8f9fa;
    font-style: italic;
    color: #6c757d;
}

/* 分割线样式 */
.message-text hr {
    margin: 16px 0;
    border: none;
    border-top: 2px solid #e9ecef;
    background: transparent;
}

/* 删除线样式 */
.message-text del {
    text-decoration: line-through;
    color: #6c757d;
    opacity: 0.7;
}

/* 用户消息中的样式调整 */
.user-message .message-text h1,
.user-message .message-text h2,
.user-message .message-text h3,
.user-message .message-text h4,
.user-message .message-text h5,
.user-message .message-text h6 {
    color: rgba(255, 255, 255, 0.95);
}

.user-message .message-text blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.user-message .message-text hr {
    border-top-color: rgba(255, 255, 255, 0.3);
}

.user-message .message-text del {
    color: rgba(255, 255, 255, 0.6);
}