/* 
 * AI客服插件样式 - 现代紫色渐变风格
 * 版本: 1.0.2
 * 字体: 微软雅黑
 */

/* 基础样式 */
.ai-service-window {
    position: fixed;
    z-index: 99999;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* 位置样式 */
.ai-position-bottom-right {
    right: 20px;
    bottom: 20px;
}

.ai-position-bottom-left {
    left: 20px;
    bottom: 20px;
}

.ai-position-top-right {
    right: 20px;
    top: 20px;
}

.ai-position-top-left {
    left: 20px;
    top: 20px;
}

/* 客服按钮 */
.ai-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 28px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.ai-btn:active {
    transform: translateY(0);
}

/* 客服窗口 */
.ai-box {
    width: 380px;
    height: 580px;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: fixed;
    display: none;
    flex-direction: column;
    animation: ai-box-fade-in 0.3s ease-out;
}

@keyframes ai-box-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 根据父容器位置设置窗口位置 */
.ai-position-bottom-right .ai-box {
    right: 20px;
    bottom: 90px;
}

.ai-position-bottom-left .ai-box {
    left: 20px;
    bottom: 90px;
}

.ai-position-top-right .ai-box {
    right: 20px;
    top: 90px;
}

.ai-position-top-left .ai-box {
    left: 20px;
    top: 90px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .ai-box {
        width: calc(100vw - 40px) !important;
        height: 70vh !important;
        max-height: 580px !important;
    }
    
    .ai-position-bottom-right .ai-box,
    .ai-position-bottom-left .ai-box {
        right: 20px !important;
        left: 20px !important;
        bottom: 90px !important;
        top: auto !important;
    }
    
    .ai-position-top-right .ai-box,
    .ai-position-top-left .ai-box {
        right: 20px !important;
        left: 20px !important;
        top: 90px !important;
        bottom: auto !important;
    }
}

/* 窗口头部 */
.ai-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.ai-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.ai-title::before {
    content: '💬';
    font-size: 22px;
}

.ai-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    font-weight: 300;
}

.ai-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 聊天区域 */
.ai-chat-area {
    flex: 1;
    background: #f7f8fc;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
.ai-chat-area::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-area::-webkit-scrollbar-thumb {
    background: #d1d5e8;
    border-radius: 10px;
}

.ai-chat-area::-webkit-scrollbar-thumb:hover {
    background: #b8bdd8;
}

/* 消息样式 */
.ai-message {
    max-width: 75%;
    word-wrap: break-word;
    animation: ai-message-fade-in 0.3s ease-out;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

@keyframes ai-message-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-bot-message {
    background: #ffffff;
    color: #2d3748;
    padding: 14px 18px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    align-self: flex-start;
    position: relative;
}

.ai-bot-message .ai-message-content {
    font-size: 14px;
    line-height: 1.6;
    color: #2d3748;
}

.ai-user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 14px 18px;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    align-self: flex-end;
    position: relative;
}

.ai-user-message .ai-message-content {
    font-size: 14px;
    line-height: 1.6;
    color: #ffffff;
}

.ai-welcome-message {
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    color: #5b21b6;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

/* 输入区域 */
.ai-input-area {
    display: flex;
    border-top: 1px solid #e8eaf6;
    background: #ffffff;
    padding: 16px 20px;
    gap: 12px;
    align-items: center;
}

.ai-input {
    flex: 1;
    border: 1px solid #e8eaf6;
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #f7f8fc;
    color: #2d3748;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.ai-input:focus {
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-input::placeholder {
    color: #a0aec0;
}

.ai-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.ai-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.ai-send:active {
    transform: translateY(0);
}

.ai-send:disabled {
    background: #cbd5e0;
    color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 错误消息 */
.ai-error-message {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* 时间戳 */
.ai-timestamp {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 6px;
    opacity: 0.8;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
.ai-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 18px;
    background: #ffffff;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    align-self: flex-start;
}

.ai-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    opacity: 0.6;
    animation: ai-typing 1.4s infinite ease-in-out;
}

.ai-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes ai-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* 错误消息 */
.ai-error-message {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* 时间戳 */
.ai-timestamp {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 6px;
    opacity: 0.8;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
