/* 在线客服 widget 样式（统一配色版 2026-10-04）
   主色：#4d8dff  用户气泡蓝 / 机器人灰 / 人工绿
*/
:root{
  --cw-accent:#4d8dff;
  --cw-accent2:#3ee6c2;
  --cw-bg:#f5f6fa;
  --cw-bot:#f0f2f7;
  --cw-agent:#e2f7ee;
  --cw-ink:#22303f;
  --cw-sub:#8b96a8;
}

/* 圆形悬浮按钮 */
.cw-launcher{
  position:fixed;right:18px;bottom:24px;width:56px;height:56px;border-radius:50%;
  background:linear-gradient(135deg,var(--cw-accent),var(--cw-accent2));
  color:#fff;border:none;cursor:pointer;z-index:9999;
  box-shadow:0 6px 18px rgba(77,141,255,.35);font-size:24px;
  display:flex;align-items:center;justify-content:center;transition:transform .2s;
}
.cw-launcher:hover{transform:scale(1.08);}
.cw-launcher .badge{
  position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 5px;
  background:#ff5757;color:#fff;font-size:11px;border-radius:9px;
  display:flex;align-items:center;justify-content:center;font-family:sans-serif;
}

/* 聊天窗 */
.cw-panel{
  position:fixed;right:18px;bottom:92px;width:352px;height:500px;max-height:calc(100vh - 160px);
  background:#fff;border-radius:16px;box-shadow:0 12px 36px rgba(20,40,80,.22);
  z-index:9998;display:none;flex-direction:column;overflow:hidden;
  font-family:"PingFang SC","Microsoft YaHei",sans-serif;
}
.cw-panel.cw-open{display:flex;}

/* 头部 */
.cw-header{
  background:linear-gradient(120deg,var(--cw-accent),#6aa1ff);
  color:#fff;padding:13px 16px;display:flex;align-items:center;justify-content:space-between;
}
.cw-header .title{font-size:14.5px;font-weight:700;}
.cw-header .close{cursor:pointer;opacity:.85;font-size:20px;line-height:1;padding:0 4px;}
.cw-header .close:hover{opacity:1;}

/* 消息流 */
.cw-body{flex:1;overflow-y:auto;padding:14px 12px 6px;background:var(--cw-bg);}
.cw-msg{margin-bottom:12px;display:flex;}
.cw-msg .bubble{
  max-width:76%;padding:9px 13px;border-radius:14px;font-size:13.5px;line-height:1.55;
  word-break:break-word;white-space:pre-wrap;
}
.cw-msg.cw-bot{justify-content:flex-start;}
.cw-msg.cw-bot .bubble{background:#fff;color:var(--cw-ink);border-bottom-left-radius:5px;box-shadow:0 1px 3px rgba(20,40,80,.06);}
.cw-msg.cw-agent{justify-content:flex-start;}
.cw-msg.cw-agent .bubble{background:var(--cw-agent);color:#0a6b48;border:1px solid #b6e8d4;border-bottom-left-radius:5px;}
.cw-msg.cw-user{justify-content:flex-end;}
.cw-msg.cw-user .bubble{background:var(--cw-accent);color:#fff;border-bottom-right-radius:5px;}
.cw-msg .ts{font-size:10px;color:var(--cw-sub);margin-top:4px;padding:0 4px;}
.cw-typing{color:var(--cw-sub);font-size:12px;padding:4px 6px;}
.cw-typing span{animation:cw-blink 1.2s infinite;}
.cw-typing span:nth-child(2){animation-delay:.2s;}
.cw-typing span:nth-child(3){animation-delay:.4s;}
@keyframes cw-blink{0%,100%{opacity:.2;}50%{opacity:1;}}

/* 图片预览条 */
.cw-preview{
  padding:8px 12px;border-top:1px solid #eceef4;background:#fafbfe;
  display:none;align-items:center;gap:8px;font-size:12px;color:var(--cw-sub);
}
.cw-preview img{width:46px;height:46px;border-radius:8px;object-fit:cover;}
.cw-preview .x{cursor:pointer;color:#ff5757;font-size:16px;margin-left:auto;}

/* 表情面板 */
.cw-emoji-panel{
  padding:8px 10px;border-top:1px solid #eceef4;background:#fafbfe;
  display:none;flex-wrap:wrap;gap:6px;
}
.cw-emoji-panel button{
  background:#fff;border:1px solid #eceef4;font-size:20px;cursor:pointer;
  padding:3px 6px;border-radius:8px;line-height:1;
}
.cw-emoji-panel button:hover{background:#eef4ff;border-color:#d6e4ff;}

/* 快捷问题 chips */
.cw-quick{padding:2px 12px 10px;background:var(--cw-bg);display:flex;flex-wrap:wrap;gap:8px;}
.cw-quick button{
  background:#eef4ff;border:1px solid #cfe0ff;color:#2f6fe0;border-radius:999px;
  padding:7px 14px;font-size:12.5px;cursor:pointer;font-family:inherit;font-weight:600;
}
.cw-quick button:hover{background:#dfeaff;}

/* 输入区 */
.cw-input{padding:10px 12px;border-top:1px solid #eceef4;background:#fff;display:flex;gap:8px;align-items:center;}
.cw-input .cw-img-btn{
  background:#f2f4f9;color:#5b6796;border:none;border-radius:10px;
  width:38px;height:38px;font-size:18px;cursor:pointer;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
}
.cw-input .cw-img-btn:hover{background:#e6ecf8;}
.cw-input textarea{
  flex:1;border:1px solid #e0e4ee;border-radius:10px;padding:9px 12px;font-size:13.5px;
  resize:none;height:38px;font-family:inherit;outline:none;box-sizing:border-box;line-height:20px;
}
.cw-input textarea:focus{border-color:var(--cw-accent);}
.cw-input #cwSendBtn{
  background:var(--cw-accent);color:#fff;border:none;border-radius:10px;
  padding:0 16px;height:38px;font-size:13.5px;cursor:pointer;font-family:inherit;
}
.cw-input #cwSendBtn:hover{background:#3d7bef;}
.cw-input #cwSendBtn:disabled{background:#c4cad9;cursor:not-allowed;}

/* 消息内图片 */
.cw-msg .bubble img{max-width:180px;max-height:180px;border-radius:8px;display:block;cursor:pointer;}

/* H5：悬浮卡片式（不盖满屏，留出上下空间） */
@media (max-width:480px){
  .cw-panel{
    left:8px;right:8px;bottom:74px;top:auto;
    width:auto;height:calc(100vh - 150px);max-height:620px;
    border-radius:16px;
  }
  .cw-launcher{bottom:16px;right:14px;width:52px;height:52px;font-size:22px;}
}

/* 图片消息：不套气泡底色，图片直接圆角展示 */
.cw-msg.cw-img .bubble{background:transparent!important;padding:0;box-shadow:none;border:none;}
.cw-msg.cw-img .bubble img{max-width:200px;max-height:200px;border-radius:12px;display:block;}

/* "有新消息" 提示（点击才跳到底部） */
.cw-newmsg{
  position:absolute;left:50%;transform:translateX(-50%);bottom:66px;
  background:var(--cw-accent);color:#fff;border:none;border-radius:999px;
  padding:6px 16px;font-size:12px;cursor:pointer;z-index:6;
  box-shadow:0 4px 12px rgba(77,141,255,.45);display:none;font-family:inherit;
}
