@charset "UTF-8";
/* ==========================================================================
   美车汇 AI 智能客服 · QQ 风格主题 (qq-theme.css)
   --------------------------------------------------------------------------
   设计说明：
     - 在 theme.css 之后加载，靠更高的选择器优先级覆盖，不改动插件原文件
     - 头部用 QQ 蓝渐变；对方气泡白色、自己气泡 QQ 蓝，带小三角（QQ 聊天窗特征）
     - 自己的头像在 DOM 里是空的 .pc-service-left，用 CSS 伪元素补一个"我"
       （这样无需修改 aihelper.js）
     - 覆盖 theme.css 中 .pc-service-left{position:absolute} 的定位，改为 flex 布局
   QQ 主色: #12B7F5
   ========================================================================== */

:root {
    --qq-blue: #12B7F5;
    --qq-blue-dark: #0A9AE0;
    --qq-blue-deep: #0090D8;
    --qq-bg: #F2F3F5;
    --qq-bubble-other: #FFFFFF;
    --qq-bubble-self: #12B7F5;
    --qq-text: #1A1A1A;
    --qq-text-sub: #8C8C8C;
    --qq-radius: 8px;
}

/* ---------- 聊天窗口整体 ---------- */
.ai-chat-box {
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .16);
    background: var(--qq-bg);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

/* ---------- 头部：QQ 蓝渐变 ---------- */
.ai-chat-box .chat-header {
    background: linear-gradient(135deg, var(--qq-blue) 0%, var(--qq-blue-dark) 100%);
    padding: 11px 14px;
    border-radius: 10px 10px 0 0;
    min-height: 56px;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.ai-chat-box .chat-header .chat-title {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .3px;
}

/* 头部头像（由 show.htm 插入 .qq-head-avatar） */
.qq-head-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    margin-right: 9px;
    flex: 0 0 34px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.qq-head-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qq-head-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.qq-head-name {
    font-size: 15px;
    font-weight: 600;
}
.qq-head-sub {
    font-size: 11px;
    opacity: .88;
    font-weight: 400;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.qq-head-sub .service-status {
    width: 6px;
    height: 6px;
    margin: 0;
}

.ai-chat-box .chat-transfer {
    font-size: 12px;
    padding: 3px 10px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 11px;
    margin-right: 8px;
    line-height: 1.5;
    transition: background .2s;
}
.ai-chat-box .chat-transfer:hover {
    background: rgba(255, 255, 255, .18);
    opacity: 1;
}
.ai-chat-box .chat-close {
    font-size: 20px;
    line-height: 1;
    padding: 2px 3px;
    border-radius: 4px;
    transition: background .2s;
}
.ai-chat-box .chat-close:hover {
    background: rgba(255, 255, 255, .18);
    opacity: 1;
}

/* ---------- 消息区 ---------- */
.ai-chat-box .chat-body {
    background: var(--qq-bg);
    padding: 12px 12px 4px;
}

.chat-message {
    position: relative;
    margin-bottom: 14px;
}
.chat-message .message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}
.chat-message.user .message-wrapper {
    flex-direction: row-reverse;
}

/* 头像：把 theme.css 的 absolute 定位改成 flex 项 */
.chat-message .pc-service-left {
    position: static !important;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: block;
    margin: 0;
    left: auto;
    top: auto;
}
.chat-message .pc-service-left > img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
/* 自己那条消息 DOM 里没有头像，用 CSS 补一个"我" */
.chat-message.user .pc-service-left {
    background: linear-gradient(135deg, #6FD3FB 0%, var(--qq-blue) 100%);
    border-radius: 50%;
    position: relative !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.chat-message.user .pc-service-left::after {
    content: "我";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.chat-message .pc-service-right {
    padding: 0;
    max-width: calc(100% - 42px);
    display: flex;
    flex-direction: column;
}
.chat-message.user .pc-service-right {
    align-items: flex-end;
}
.chat-message.ai .pc-service-right {
    align-items: flex-start;
}

/* 昵称 + 时间 */
.chat-message .pc-service-right .message-info {
    padding: 0;
    height: auto;
    line-height: 1.3;
    margin-bottom: 5px;
    font-size: 11px;
    color: var(--qq-text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-message.user .pc-service-right .message-info {
    flex-direction: row-reverse;
}
.chat-message .pc-service-right .message-info span {
    max-width: 150px;
}
.chat-message.ai .pc-service-right .message-info {
    padding-left: 0;
}
.chat-message.ai .pc-service-right .typing-indicator {
    margin-left: 0;
}

/* ---------- 气泡 ---------- */
.chat-message .message-content {
    position: relative;
    display: inline-block;
    max-width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    line-height: 1.65;
    border-radius: var(--qq-radius);
    word-break: break-word;
    word-wrap: break-word;
    text-align: left;
}
/* 对方：白底 + 左侧小三角 */
.chat-message.ai .message-content {
    background: var(--qq-bubble-other);
    color: var(--qq-text);
    border: 1px solid #E7E9EC;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.chat-message.ai .message-content::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 6px 5px 0;
    border-color: transparent #E7E9EC transparent transparent;
}
.chat-message.ai .message-content::after {
    content: "";
    position: absolute;
    left: -4px;
    top: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 6px 5px 0;
    border-color: transparent var(--qq-bubble-other) transparent transparent;
}
/* 自己：QQ 蓝底 + 右侧小三角 */
.chat-message.user .message-content {
    background: var(--qq-bubble-self);
    color: #fff;
    box-shadow: 0 1px 2px rgba(18, 183, 245, .25);
}
.chat-message.user .message-content::before {
    content: "";
    position: absolute;
    right: -5px;
    top: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 6px;
    border-color: transparent transparent transparent var(--qq-blue);
}
.chat-message.user .message-content a {
    color: #EAF8FF;
    text-decoration: underline;
}

/* 气泡内排版 */
.message-content p { margin: 0 0 6px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content code {
    background: rgba(0, 0, 0, .06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
}
.chat-message.user .message-content code {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}
.message-content img { max-width: 100%; width: auto; border-radius: 6px; }

.ai-list li { padding-left: 22px; }
.chat-message.user .ai-li-num { background: rgba(255, 255, 255, .35); }

/* ---------- 欢迎语 / 常见问题 ---------- */
.common-wel-title {
    text-align: center;
    font-size: 12px;
    color: var(--qq-text-sub);
    line-height: 1.7;
    padding: 4px 10px 10px;
}
.common-wel-line {
    border-bottom: 1px solid #E4E6EA;
    padding: 0;
    margin-bottom: 12px;
}
.common-qustion-title {
    font-size: 12px;
    line-height: 22px;
    color: var(--qq-text-sub);
    padding: 0 2px 2px;
}
.faq-bubble { margin-top: 10px; border-top: 1px solid #E4E6EA; padding-top: 12px; }
.faq-bubble-item { margin-bottom: 8px; }
.faq-bubble-item a {
    display: block;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #E7E9EC;
    border-radius: var(--qq-radius);
    color: #1A73E8;
    font-size: 13px;
    transition: all .18s;
}
.faq-bubble-item a:hover {
    background: #F0FAFF;
    border-color: var(--qq-blue);
    color: var(--qq-blue-deep);
}
.sub-item { border-radius: 6px; }

/* ---------- 输入区 ---------- */
.ai-chat-box .chat-footer {
    background: #fff;
    border-top: 1px solid #E7E9EC;
    padding: 10px 12px;
    border-radius: 0 0 10px 10px;
    gap: 8px;
    align-items: center;
}
#chatInput {
    border: 1px solid #E0E3E7;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 14px;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
#chatInput:focus {
    border-color: var(--qq-blue);
    box-shadow: 0 0 0 2px rgba(18, 183, 245, .12);
}
.ai-chat-box .chat-send {
    background: var(--qq-blue);
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    transition: background .2s;
    white-space: nowrap;
}
.ai-chat-box .chat-send:hover { background: var(--qq-blue-dark); }
/* QQ 风格的输入区提示 */
.qq-input-hint {
    font-size: 11px;
    color: #B9BEC5;
    padding: 0 2px 6px;
    text-align: right;
}

/* ---------- 悬浮入口按钮 ---------- */
.chat-button {
    background: linear-gradient(135deg, var(--qq-blue) 0%, var(--qq-blue-dark) 100%);
    box-shadow: 0 4px 14px rgba(18, 183, 245, .42);
}
.chat-button:hover {
    box-shadow: 0 7px 20px rgba(18, 183, 245, .5);
}
/* 悬浮按钮上加一个 QQ 头像，更像 QQ 而不是通用图标 */
.chat-button::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 13px;
    height: 13px;
    background: #4CD964;
    border: 2px solid #fff;
    border-radius: 50%;
}

/* ---------- 转接提示 / 分隔线 ---------- */
.transfer-content {
    background: rgba(0, 0, 0, .05);
    border-radius: 12px;
    padding: 4px 10px;
}
.transfer-text { color: var(--qq-text-sub); font-size: 12px; }
.chat-divider { color: #A8ADB4; font-size: 11px; margin: 12px auto; }
.chat-divider-line { background: #DFE2E6; width: 40px; }

/* ---------- 来源 / 反馈 / 留言 ---------- */
.ai-sources { border-top: 1px dashed #E0E3E7; }
.ai-source-link { color: #1A73E8; }
.ai-feedback-btn { background: #EFF1F4; }
.ai-msg-submit { background: var(--qq-blue); border-radius: 12px; }
.ai-msg-form .ai-msg-q:focus,
.ai-msg-form .ai-msg-c:focus { border-color: var(--qq-blue); }

/* ---------- 打字动画 ---------- */
.typing-indicator { padding: 4px 2px; }
.typing-indicator span { background: #B9BEC5; height: 6px; width: 6px; }

/* ---------- 滚动条 ---------- */
.chat-body { scrollbar-color: #D3D7DD transparent; }
.chat-body::-webkit-scrollbar { width: 5px; }
.chat-body::-webkit-scrollbar-thumb { background: #D3D7DD; border-radius: 3px; }
.chat-body::-webkit-scrollbar-thumb:hover { background: #B9BEC5; }

/* ==========================================================================
   移动端：QQ 手机版观感 —— 头部略矮、气泡更宽、输入框防 iOS 缩放
   ========================================================================== */
@media (max-width: 768px) {
    .ai-chat-box { border-radius: 8px; }
    .ai-chat-box .chat-header {
        padding: 9px 12px;
        min-height: 50px;
        border-radius: 8px 8px 0 0;
    }
    .qq-head-avatar { width: 30px; height: 30px; flex-basis: 30px; margin-right: 8px; }
    .qq-head-name { font-size: 14px; }
    .qq-head-sub { font-size: 10px; }

    .chat-message .pc-service-left,
    .chat-message .pc-service-left > img { flex-basis: 30px; width: 30px; height: 30px; }
    .chat-message .pc-service-right { max-width: calc(100% - 38px); }
    .chat-message .message-content { font-size: 13.5px; padding: 8px 11px; }
    .chat-message .pc-service-right .message-info span { max-width: 110px; }

    #chatInput { font-size: 16px; }  /* 防止 iOS 聚焦时自动放大 */
    .ai-chat-box .chat-send { padding: 9px 14px; }
    .ai-chat-box .chat-footer { padding: 9px 10px; }
    .qq-input-hint { display: none; }
}

@media (max-width: 480px) {
    .ai-chat-box .chat-header { padding: 8px 10px; min-height: 46px; }
    .qq-head-avatar { width: 28px; height: 28px; flex-basis: 28px; }
    .qq-head-name { font-size: 13.5px; }
    .chat-message .message-content { font-size: 13px; padding: 7px 10px; }
    .ai-chat-box .chat-transfer { font-size: 11px; padding: 2px 8px; }
    .ai-chat-box .chat-close { font-size: 18px; }
}
