/**
 * 万讯互动 AI 客服 - 样式
 * 所有类名 aichat- 前缀，避免与站点样式冲突
 * 主题色与站点一致：#d90000
 */

.aichat-wrap { display: none; }
.aichat-wrap.aichat-open { display: block; }

/* ---------- 遮罩 ---------- */
.aichat-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity .2s;
}
.aichat-wrap.aichat-open .aichat-mask { display: block; opacity: 1; }

/* ---------- 面板 ---------- */
.aichat-panel {
    position: fixed;
    right: 70px;
    bottom: 40px;
    z-index: 99991;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 60px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .2s, transform .2s;
    font-family: 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
}
.aichat-wrap.aichat-open .aichat-panel { opacity: 1; transform: translateY(0); }

/* ---------- 头部 ---------- */
.aichat-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #d90000, #a80000);
    color: #fff;
}
.aichat-header-info { display: flex; align-items: center; flex: 1; min-width: 0; }
.aichat-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; margin-right: 10px;
    background: rgba(255, 255, 255, .15);
    border-radius: 50%;
}
.aichat-title { font-size: 16px; font-weight: 700; }
.aichat-sub { margin-left: 10px; font-size: 12px; opacity: .85; }
.aichat-clear, .aichat-close {
    color: #fff; text-decoration: none; font-size: 20px;
    padding: 4px 8px; opacity: .85; line-height: 1;
}
.aichat-clear { font-size: 16px; }
.aichat-clear:hover, .aichat-close:hover { opacity: 1; }

/* ---------- 消息区 ---------- */
.aichat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f5f6f8;
    -webkit-overflow-scrolling: touch;
}
.aichat-msg { display: flex; margin-bottom: 14px; }
.aichat-msg.aichat-user { justify-content: flex-end; }
.aichat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    border-radius: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}
.aichat-ai .aichat-bubble { background: #fff; color: #333; border-top-left-radius: 2px; }
.aichat-user .aichat-bubble { background: #d90000; color: #fff; border-top-right-radius: 2px; }

/* "输入中"动画 */
.aichat-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.aichat-typing i {
    width: 6px; height: 6px; border-radius: 50%;
    background: #bbb;
    animation: aichatBlink 1.2s infinite ease-in-out;
}
.aichat-typing i:nth-child(2) { animation-delay: .2s; }
.aichat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes aichatBlink {
    0%, 60%, 100% { opacity: .3; transform: scale(.9); }
    30% { opacity: 1; transform: scale(1.1); }
}

/* ---------- 底部 ---------- */
.aichat-footer { flex-shrink: 0; background: #fff; }
.aichat-toolbar { padding: 6px 12px 0; }
.aichat-tel {
    display: inline-block;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    padding: 3px 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
}
.aichat-tel:hover { color: #d90000; border-color: #d90000; }
.aichat-inputbar {
    display: flex;
    align-items: flex-end;
    padding: 8px 12px 12px;
}
.aichat-input {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.5;
    height: 36px;
    outline: none;
    font-family: inherit;
    background: #f5f6f8;
}
.aichat-input:focus { border-color: #d90000; background: #fff; }
.aichat-send {
    flex-shrink: 0;
    margin-left: 8px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: #d90000;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.aichat-send:hover { background: #b50000; }
.aichat-send.aichat-sending { background: #999; cursor: not-allowed; }

/* ---------- 移动端：全屏 ---------- */
@media (max-width: 767px) {
    .aichat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    .aichat-mask { background: rgba(0, 0, 0, .5); }
}

/* ---------- 右侧浮动条"业务咨询"入口（AI 客服耳机图标） ---------- */
.sidebar a.qq.aichat-trigger {
    background-image: url(/Public/home/webimages/sideaichat.png);
    background-position: center 16px;
    background-size: 26px 26px;
}
