/* 在线客服聊天（仿微信布局） */

/* ---------- 右下角悬浮入口（带文字，比圆形图标更显眼） ---------- */
.chat-fab{position:fixed;right:26px;bottom:26px;z-index:9998;
  display:inline-flex;align-items:center;gap:8px;height:56px;padding:0 22px;border-radius:999px;
  background:linear-gradient(135deg,#0BC46A,#06A34F);color:#fff;border:none;
  font-family:inherit;font-size:17px;font-weight:800;letter-spacing:.3px;
  box-shadow:0 12px 30px rgba(7,193,96,.44);cursor:pointer;transition:.2s}
.chat-fab:hover{transform:translateY(-2px);box-shadow:0 16px 38px rgba(7,193,96,.56)}
.chat-fab .fab-txt{line-height:1}
body.chat-open .chat-fab{display:none}

/* ---------- 聊天窗 ---------- */
.chat-panel{position:fixed;right:14px;bottom:14px;z-index:9999;
  width:380px;max-width:calc(100vw - 28px);height:560px;max-height:calc(100vh - 28px);
  background:#EDEDED;border-radius:14px;box-shadow:0 12px 48px rgba(0,0,0,.25);
  display:none;flex-direction:column;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif}
.chat-panel.open{display:flex;animation:chatPanelIn .18s ease-out}
@keyframes chatPanelIn{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.chat-head{background:#07C160;color:#fff;padding:12px 16px;display:flex;align-items:center;justify-content:space-between}
.chat-head-title{font-size:16px;font-weight:700}
.chat-head-close{cursor:pointer;font-size:20px;opacity:.9;padding:0 4px;background:none;border:none;color:#fff}
.chat-msgs{flex:1;overflow-y:auto;padding:14px 12px;display:flex;flex-direction:column;gap:10px}
.chat-msg{display:flex;max-width:82%;gap:6px;align-items:flex-end}
.chat-msg.me{align-self:flex-end;flex-direction:row-reverse}
.chat-avatar{width:32px;height:32px;border-radius:6px;flex:none;display:flex;align-items:center;justify-content:center;font-size:16px;color:#fff}
.chat-msg.them .chat-avatar{background:#07C160}
.chat-msg.me .chat-avatar{background:#4A90D9}
.chat-bubble{padding:9px 12px;border-radius:8px;font-size:14.5px;line-height:1.5;word-break:break-word;white-space:pre-wrap;position:relative}
.chat-msg.them .chat-bubble{background:#fff;color:#111}
.chat-msg.me .chat-bubble{background:#95EC69;color:#111}
.chat-bubble img{max-width:160px;max-height:160px;border-radius:6px;display:block;cursor:pointer}
.chat-time{align-self:center;font-size:11px;color:#999;margin:4px 0}
.chat-input{display:flex;align-items:center;gap:6px;padding:10px;border-top:1px solid #ddd;background:#F7F7F7}
.chat-input textarea{flex:1;resize:none;border:1px solid #ddd;border-radius:6px;padding:8px;font-size:14px;height:40px;max-height:100px;font-family:inherit}
.chat-send{background:#07C160;color:#fff;border:none;border-radius:6px;padding:0 16px;height:40px;font-size:14px;font-weight:700;cursor:pointer}
.chat-img-btn{background:#07C160;color:#fff;border:none;border-radius:6px;height:40px;padding:0 14px;cursor:pointer;font-size:14px;font-weight:700;}
.chat-empty{align-self:center;color:#999;font-size:13px;margin-top:40%}
/* 放大图片 */
.chat-lightbox{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:10000;display:none;align-items:center;justify-content:center;cursor:zoom-out}
.chat-lightbox.open{display:flex}
.chat-lightbox img{max-width:94vw;max-height:94vh;border-radius:6px}
/* 留言表单（30秒无回复） */
.chat-lead{position:absolute;inset:0;background:#fff;display:none;flex-direction:column;padding:24px 20px;overflow-y:auto}
.chat-lead.open{display:flex}
.chat-lead h3{font-size:18px;color:#0F3D6E;margin:0 0 6px}
.chat-lead p{font-size:13.5px;color:#66738A;margin:0 0 16px;line-height:1.55}
.chat-lead label{font-size:13px;color:#2B3648;font-weight:700;display:block;margin:10px 0 4px}
.chat-lead input{width:100%;padding:10px;border:1px solid #D9DEE6;border-radius:8px;font-size:14px;box-sizing:border-box}
.chat-lead button{margin-top:16px;background:#07C160;color:#fff;border:none;border-radius:8px;padding:12px;font-size:15px;font-weight:700;cursor:pointer}
.chat-lead .ok{color:#07C160;font-size:15px;text-align:center;margin-top:24px;line-height:1.6}

/* ---------- 手机端底部通栏入口（滚动时始终可见） ---------- */
.chat-bar{position:fixed;left:0;right:0;bottom:0;z-index:9990;display:none;gap:8px;
  padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  background:rgba(255,255,255,.97);backdrop-filter:blur(10px);
  border-top:1px solid #E2E8F0;box-shadow:0 -8px 24px rgba(15,61,110,.12)}
.chat-bar-btn{position:relative;flex:1;display:flex;align-items:center;gap:10px;text-align:left;
  background:linear-gradient(135deg,#0BC46A,#06A34F);color:#fff;border:none;border-radius:13px;
  padding:9px 14px;font-family:inherit;cursor:pointer;box-shadow:0 8px 20px rgba(7,193,96,.35)}
.chat-bar-btn .bar-ico{font-size:23px;line-height:1}
.chat-bar-btn .bar-tx{display:flex;flex-direction:column;line-height:1.25}
.chat-bar-btn .bar-tx b{font-size:17px;font-weight:800}
.chat-bar-btn .bar-tx small{font-size:11px;font-weight:600;opacity:.92;margin-top:1px}
.chat-bar-tel{width:58px;flex:0 0 auto;display:flex;align-items:center;justify-content:center;
  background:#fff;color:#0F3D6E;border:1px solid #E2E8F0;border-radius:13px;font-size:22px;text-decoration:none}
body.chat-open .chat-bar{display:none}

@media (max-width:760px){
  .chat-bar{display:flex}
  body{padding-bottom:86px}
  .chat-fab{display:none}
}
@media (max-width:480px){
  .chat-panel{right:0;left:0;bottom:0;width:100%;height:100dvh;max-width:100%;max-height:100dvh;border-radius:0;position:fixed;top:0}
  .chat-msgs{padding:10px 8px}
  .chat-bubble{font-size:14px;padding:8px 10px}
  .chat-input{padding:8px;gap:4px}
  .chat-input textarea{font-size:16px;height:38px}
}
