/* ==========================================================
   PreciseLaser 智能小助手（仅首页）
   卡通人物：每5秒换动作；停留5秒后从左下屏幕外滑入；多语言气泡问答
   ========================================================== */

/* ---------- 容器：固定在左下角 ---------- */
.pl-mascot {
    position: fixed !important;
    left: 18px !important;
    bottom: 18px !important;
    z-index: 10060 !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 10px !important;
    font-family: Arial, Helvetica, sans-serif !important;
    pointer-events: none !important;   /* 容器透传，气泡/人物各自开启 */
    /* 初始在屏幕外 */
    transform: translateX(calc(-100% - 220px)) !important;
    opacity: 0 !important;
    transition: transform .85s cubic-bezier(.22, .9, .3, 1.12), opacity .6s ease !important;
}
.pl-mascot.is-in {
    transform: translateX(0) !important;
    opacity: 1 !important;
}

/* ---------- 卡通人物 ---------- */
.pl-mascot-figure {
    position: relative !important;
    width: 182px !important;
    height: 182px !important;
    flex: 0 0 182px !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    /* 白色描边 + 柔和投影：无论深/浅背景都立体清晰，不用背后光晕 */
    filter:
        drop-shadow(0 0 1.5px rgba(255, 255, 255, .95))
        drop-shadow(0 0 3px rgba(255, 255, 255, .55))
        drop-shadow(0 6px 10px rgba(10, 22, 42, .28)) !important;
    animation: plMascotBob 2.8s ease-in-out infinite !important;
}
/* 入场：人物先弹跳落定，随后接呼吸浮动（绑定 is-in，避免加载时提前播放） */
.pl-mascot.is-in .pl-mascot-figure {
    animation: plFigureEnter .62s cubic-bezier(.2, .85, .3, 1.22) both,
               plMascotBob 2.8s ease-in-out .66s infinite !important;
}
@keyframes plFigureEnter {
    0%   { opacity: 0; transform: translateY(30px) scale(.8); }
    55%  { opacity: 1; transform: translateY(-7px) scale(1.04); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.pl-mascot-figure img {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 182px !important;
    height: 182px !important;
    object-fit: contain !important;
    opacity: 0 !important;
    transition: opacity .28s ease !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}
.pl-mascot-figure img.is-show { opacity: 1 !important; }

@keyframes plMascotBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}

/* 脚下极淡的贴地投影：只留一点站立感，不显脏 */
.pl-mascot-figure::after {
    content: '' !important;
    position: absolute !important;
    left: 34px !important;
    bottom: 2px !important;
    width: 114px !important;
    height: 10px !important;
    border-radius: 50% !important;
    background: radial-gradient(ellipse, rgba(20, 35, 60, .16), rgba(20, 35, 60, 0) 72%) !important;
    z-index: -1 !important;
}

/* ---------- 对话气泡 ---------- */
.pl-mascot-bubble {
    position: relative !important;
    width: 300px !important;
    max-width: calc(100vw - 220px) !important;
    background: #ffffff !important;
    border-radius: 18px !important;
    box-shadow: 0 18px 46px rgba(10, 25, 50, .22), 0 2px 8px rgba(10, 25, 50, .06) !important;
    border: 1px solid #e6eef8 !important;
    pointer-events: auto !important;
    overflow: visible !important;              /* 让指向人物的尖角显示出来 */
    transform-origin: right center !important; /* 从靠近人物的一侧展开 */
    /* 初始态交给动画的 fill-mode:backwards 控制，切勿在此用 !important，
       否则会盖住关键帧导致气泡永远透明 */
    opacity: 0;
    transform: scale(.7) translateX(24px);
}
/* 出场前（未 is-in）保持隐藏，避免闪烁 */
.pl-mascot:not(.is-in) .pl-mascot-bubble { opacity: 0 !important; transform: scale(.7) translateX(24px) !important; }
/* 气泡延迟于人物弹出，带轻微回弹 */
.pl-mascot.is-in .pl-mascot-bubble {
    animation: plBubblePop .62s cubic-bezier(.2, .9, .28, 1.25) .5s both !important;
}
@keyframes plBubblePop {
    0%   { opacity: 0; transform: scale(.7) translateX(24px); }
    60%  { opacity: 1; transform: scale(1.04) translateX(-3px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}
/* 气泡指向右侧人物的小尖角 */
.pl-mascot-bubble::before {
    content: '' !important;
    position: absolute !important;
    right: -7px !important;
    bottom: 24px !important;
    width: 14px !important;
    height: 14px !important;
    background: #ffffff !important;
    border-right: 1px solid #e6eef8 !important;
    border-top: 1px solid #e6eef8 !important;
    transform: rotate(45deg) !important;
    z-index: 2 !important;
}
/* 尖角内的高光，遮住接缝更自然 */
.pl-mascot-bubble::after {
    content: '' !important;
    position: absolute !important;
    right: -4px !important;
    bottom: 26px !important;
    width: 12px !important;
    height: 12px !important;
    background: #ffffff !important;
    transform: rotate(45deg) !important;
    z-index: 3 !important;
}

/* 顶部标题条 */
.pl-mascot-head {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    padding: 11px 13px !important;
    background: linear-gradient(120deg, #1358c4 0%, #1f7ae8 55%, #38a0ff 100%) !important;
    color: #fff !important;
    border-radius: 17px 17px 0 0 !important;
    position: relative !important;
    overflow: hidden !important;
}
/* 标题条上的柔光装饰 */
.pl-mascot-head::after {
    content: '' !important;
    position: absolute !important;
    top: -40px !important; right: -20px !important;
    width: 130px !important; height: 130px !important;
    border-radius: 50% !important;
    background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,0) 70%) !important;
    pointer-events: none !important;
}
.pl-mascot-head .pl-mascot-dot {
    width: 9px !important; height: 9px !important; border-radius: 50% !important;
    background: #6cf0a0 !important;
    box-shadow: 0 0 0 3px rgba(108, 240, 160, .22) !important;
    flex: 0 0 9px !important;
    position: relative !important;
    animation: plDotPulse 2s ease-in-out infinite !important;
}
@keyframes plDotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(108, 240, 160, .22); }
    50%      { box-shadow: 0 0 0 6px rgba(108, 240, 160, 0); }
}
.pl-mascot-head .pl-mascot-title {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    flex: 1 !important;
    letter-spacing: .02em !important;
    text-shadow: 0 1px 1px rgba(0,0,0,.12) !important;
    position: relative !important;
    z-index: 1 !important;
}
.pl-mascot-hide {
    border: 0 !important;
    background: rgba(255,255,255,.16) !important;
    color: #fff !important;
    font-size: 15px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 22px !important; height: 22px !important;
    border-radius: 50% !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    position: relative !important; z-index: 1 !important;
    transition: background .2s ease !important;
}
.pl-mascot-hide:hover { background: rgba(255,255,255,.3) !important; }

/* 消息显示区 */
.pl-mascot-msg {
    padding: 14px 13px 10px !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    color: #1b2b42 !important;
    max-height: 168px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
}
.pl-mascot-msg .pl-mascot-line { margin: 0 !important; max-width: 92% !important; }
.pl-mascot-msg .pl-mascot-line.me {
    align-self: flex-end !important;
    color: #fff !important;
    font-weight: 500 !important;
    background: linear-gradient(120deg, #1f7ae8, #1667d6) !important;
    border-radius: 12px 12px 3px 12px !important;
    padding: 8px 11px !important;
    box-shadow: 0 2px 6px rgba(22, 103, 214, .2) !important;
}
.pl-mascot-msg .pl-mascot-line.bot {
    align-self: flex-start !important;
    background: #f1f6fd !important;
    border: 1px solid #e5eef9 !important;
    border-radius: 3px 12px 12px 12px !important;
    padding: 9px 11px !important;
    color: #24374f !important;
}
/* 消息淡入（backwards 保证动画结束后停在正常的 opacity:1，不会因中断而消失） */
.pl-mascot-line.bot { animation: plMsgIn .4s ease backwards !important; }
@keyframes plMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pl-mascot-msg a { color: #1667d6 !important; font-weight: 700 !important; text-decoration: none !important; }
.pl-mascot-msg a:hover { text-decoration: underline !important; }

/* 打字中动画 */
.pl-mascot-typing { display: inline-flex !important; gap: 4px !important; align-items: center !important; height: 18px !important; }
.pl-mascot-typing i {
    width: 6px !important; height: 6px !important; border-radius: 50% !important;
    background: #8aa7cc !important;
    animation: plTyping 1s infinite ease-in-out !important;
}
.pl-mascot-typing i:nth-child(2){ animation-delay: .15s !important; }
.pl-mascot-typing i:nth-child(3){ animation-delay: .3s !important; }
@keyframes plTyping { 0%,60%,100%{ transform: translateY(0); opacity:.5 } 30%{ transform: translateY(-5px); opacity:1 } }

/* 快捷问题按钮 */
.pl-mascot-quick {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 0 12px 10px !important;
}
.pl-mascot-quick button {
    border: 1px solid #d6e6fb !important;
    background: linear-gradient(180deg, #fff, #f4f9ff) !important;
    color: #1667d6 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 6px 11px !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(22,103,214,.08) !important;
    transition: all .2s ease !important;
}
.pl-mascot-quick button:hover {
    background: linear-gradient(120deg, #1f7ae8, #1667d6) !important;
    color: #fff !important;
    border-color: #1667d6 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 8px rgba(22,103,214,.25) !important;
}

/* 输入区 */
.pl-mascot-inputrow {
    display: flex !important;
    gap: 7px !important;
    padding: 10px 11px 11px !important;
    border-top: 1px solid #eef2f8 !important;
    background: #fafcff !important;
    border-radius: 0 0 17px 17px !important;
}
.pl-mascot-inputrow input {
    flex: 1 !important;
    min-width: 0 !important;
    border: 1px solid #dbe4f0 !important;
    border-radius: 20px !important;
    padding: 9px 13px !important;
    font: 12px Arial, Helvetica, sans-serif !important;
    color: #1b2b42 !important;
    outline: none !important;
    background: #fff !important;
    transition: border-color .2s ease, box-shadow .2s ease !important;
}
.pl-mascot-inputrow input::placeholder { color: #9aabc0 !important; }
.pl-mascot-inputrow input:focus { border-color: #1f7ae8 !important; box-shadow: 0 0 0 3px rgba(31,122,232,.12) !important; }
.pl-mascot-inputrow button {
    flex: 0 0 auto !important;
    border: 0 !important;
    background: linear-gradient(120deg, #1f7ae8, #1667d6) !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 0 15px !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    box-shadow: 0 2px 6px rgba(22,103,214,.22) !important;
    transition: transform .18s ease, box-shadow .18s ease !important;
}
.pl-mascot-inputrow button:hover { transform: translateY(-1px) !important; box-shadow: 0 4px 10px rgba(22,103,214,.32) !important; }
.pl-mascot-inputrow button:active { transform: translateY(0) !important; }

/* 悬浮时人物轻微放大、投影加深 */
.pl-mascot-figure:hover {
    filter:
        drop-shadow(0 0 1.5px rgba(255,255,255,.95))
        drop-shadow(0 0 4px rgba(255,255,255,.6))
        drop-shadow(0 10px 18px rgba(8,20,40,.34)) !important;
}

/* 手机端样式统一在文件末尾的“对称布局”媒体查询中定义 */

/* 尊重减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .pl-mascot-figure { animation: none !important; }
    .pl-mascot-bubble { animation: none !important; }
}

/* 全站智能层：RFQ 规划师入口与摘要 */
.pl-mascot-quick button.pl-mascot-rfq {
    background: #0f6e56 !important;
    border-color: #0f6e56 !important;
    color: #fff !important;
}
.pl-mascot-quick button.pl-mascot-rfq:hover {
    background: #085041 !important;
    border-color: #085041 !important;
}
.pl-mascot-page { display: block; color: #475569; }
.pl-mascot-page b { color: #1667d6; }
.pl-mascot-rfq-summary { line-height: 1.55; }
.pl-mascot-rfq-summary b { color: #0f6e56; }
.pl-mascot-rfq-summary a { color: #1667d6; text-decoration: underline; }

/* ---------- 手机端对称布局：对话框在上、人物在下、居中对齐、尖角朝下对应人物 ---------- */
@media screen and (max-width: 640px) {
  .pl-mascot.pl-mascot {
    left: 8px !important; bottom: 8px !important;
    flex-direction: column !important; align-items: center !important; gap: 7px !important;
    transform: scale(.92) !important; transform-origin: left bottom !important;
  }
  /* 入场动画改为纵向滑入（原横向 translateX 在 column 下会显得错位） */
  .pl-mascot.pl-mascot { transform: translateY(20px) scale(.92) !important; }
  .pl-mascot.is-in.pl-mascot { transform: translateY(0) scale(.92) !important; }
  /* 人物：居中，略大于旧版，作为对话框的视觉落点 */
  .pl-mascot .pl-mascot-figure, .pl-mascot .pl-mascot-figure img { width: 74px !important; height: 74px !important; }
  .pl-mascot .pl-mascot-figure { flex-basis: 74px !important; order: 2 !important; }
  .pl-mascot .pl-mascot-figure::after { left: 12px !important; width: 50px !important; height: 8px !important; }
  /* 对话框：在上，宽度与人物形成协调比例 */
  .pl-mascot .pl-mascot-bubble { width: 200px !important; max-width: calc(100vw - 72px) !important; border-radius: 15px !important; order: 1 !important; }
  /* 尖角从右侧改到底部中央，朝下指向人物 */
  .pl-mascot .pl-mascot-bubble::before {
    right: auto !important; left: 50% !important; bottom: -7px !important;
    border-right: 0 !important; border-top: 0 !important;
    border-left: 1px solid #e6eef8 !important; border-bottom: 1px solid #e6eef8 !important;
    transform: translateX(-50%) rotate(45deg) !important;
  }
  .pl-mascot .pl-mascot-bubble::after {
    right: auto !important; left: 50% !important; bottom: -4px !important;
    transform: translateX(-50%) rotate(45deg) !important;
  }
  /* 气泡内部：适度字号，保证清晰又不过大 */
  .pl-mascot .pl-mascot-head { padding: 8px 10px !important; border-radius: 14px 14px 0 0 !important; gap: 7px !important; }
  .pl-mascot .pl-mascot-head .pl-mascot-title { font-size: 11px !important; }
  .pl-mascot .pl-mascot-head .pl-mascot-dot { width: 7px !important; height: 7px !important; flex-basis: 7px !important; }
  .pl-mascot .pl-mascot-hide { width: 18px !important; height: 18px !important; font-size: 12px !important; }
  .pl-mascot .pl-mascot-msg { max-height: 82px !important; font-size: 10.5px !important; line-height: 1.5 !important; padding: 9px 10px 6px !important; gap: 5px !important; }
  .pl-mascot .pl-mascot-msg .pl-mascot-line.me { padding: 6px 8px !important; border-radius: 10px 10px 3px 10px !important; }
  .pl-mascot .pl-mascot-msg .pl-mascot-line.bot { padding: 7px 9px !important; border-radius: 3px 10px 10px 10px !important; }
  .pl-mascot .pl-mascot-quick { gap: 4px !important; padding: 0 9px 8px !important; }
  .pl-mascot .pl-mascot-quick button { font-size: 9.5px !important; padding: 5px 8px !important; }
  .pl-mascot .pl-mascot-inputrow { gap: 5px !important; padding: 7px 8px 8px !important; border-radius: 0 0 14px 14px !important; }
  .pl-mascot .pl-mascot-inputrow input { font-size: 10px !important; padding: 6px 9px !important; }
  .pl-mascot .pl-mascot-inputrow button { font-size: 10px !important; padding: 0 10px !important; }
}
