/* ============================================================
   在线聊天组件 - 番番风格
   ============================================================ */
#yhChatBtn{position:fixed;right:20px;bottom:20px;width:58px;height:58px;border-radius:50%;background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 18px rgba(27,94,58,.45);z-index:9998;transition:transform .3s,box-shadow .3s;border:none;}
#yhChatBtn:hover{transform:scale(1.08);box-shadow:0 6px 24px rgba(27,94,58,.55);}
#yhChatBtn svg{width:28px;height:28px;}
#yhChatBtn .badge{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;border-radius:10px;background:#e53e3e;color:#fff;font-size:11px;font-weight:700;display:none;align-items:center;justify-content:center;padding:0 5px;border:2px solid #fff;}
#yhChatBtn .badge.show{display:flex;}
#yhChatBtn .pulse{position:absolute;inset:0;border-radius:50%;background:#2D7A50;animation:yhPulse 2.5s infinite;z-index:-1;}
@keyframes yhPulse{0%{transform:scale(1);opacity:.5;}70%{transform:scale(1.5);opacity:0;}100%{transform:scale(1);opacity:0;}}

#yhChatWindow{position:fixed;right:20px;bottom:92px;width:380px;max-width:calc(100vw - 24px);height:580px;max-height:calc(100vh - 120px);background:#fff;border-radius:16px;box-shadow:0 12px 48px rgba(0,0,0,.2);z-index:9999;display:none;flex-direction:column;overflow:hidden;animation:yhSlideUp .25s ease;}
#yhChatWindow.open{display:flex;}
@keyframes yhSlideUp{from{opacity:0;transform:translateY(20px);}to{opacity:1;transform:translateY(0);}}

.yh-chat-header{background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px;flex-shrink:0;}
.yh-chat-avatar{width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;}
.yh-chat-avatar svg{width:22px;height:22px;}
.yh-chat-title{flex:1;min-width:0;}
.yh-chat-title .name{font-size:15px;font-weight:600;line-height:1.3;}
.yh-chat-title .status{font-size:12px;opacity:.85;display:flex;align-items:center;gap:5px;margin-top:2px;}
.yh-chat-title .status::before{content:"";width:7px;height:7px;border-radius:50%;background:#68d391;display:inline-block;box-shadow:0 0 4px #68d391;}
.yh-chat-close{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background .2s;flex-shrink:0;}
.yh-chat-close:hover{background:rgba(255,255,255,.18);}
.yh-chat-close svg{width:18px;height:18px;}

/* 快捷问题 */
.yh-quick-bar{padding:10px 12px 0;background:#f5f7f6;display:flex;gap:6px;flex-wrap:wrap;flex-shrink:0;}
.yh-quick-btn{font-size:12px;padding:5px 12px;border-radius:14px;background:#fff;border:1px solid #d0ddd5;color:#1B5E3A;cursor:pointer;transition:all .2s;white-space:nowrap;}
.yh-quick-btn:hover{background:#1B5E3A;color:#fff;border-color:#1B5E3A;}

.yh-chat-body{flex:1;overflow-y:auto;padding:14px 12px;background:#f5f7f6;display:flex;flex-direction:column;gap:10px;}
.yh-chat-body::-webkit-scrollbar{width:5px;}
.yh-chat-body::-webkit-scrollbar-thumb{background:#c5d1ca;border-radius:3px;}

.yh-msg{display:flex;gap:8px;max-width:82%;animation:yhFadeIn .25s ease;}
@keyframes yhFadeIn{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:translateY(0);}}
.yh-msg.guest{align-self:flex-end;flex-direction:row-reverse;}
.yh-msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:12px;font-weight:600;color:#fff;}
.yh-msg.admin .yh-msg-avatar{background:linear-gradient(135deg,#1B5E3A,#2D7A50);}
.yh-msg.guest .yh-msg-avatar{background:#718096;}
.yh-msg-content{display:flex;flex-direction:column;min-width:0;}
.yh-msg.guest .yh-msg-content{align-items:flex-end;}
.yh-msg-bubble{padding:10px 14px;border-radius:14px;font-size:14px;line-height:1.6;word-break:break-word;position:relative;}
.yh-msg.admin .yh-msg-bubble{background:#fff;color:#333;border-top-left-radius:4px;box-shadow:0 1px 4px rgba(0,0,0,.07);}
.yh-msg.guest .yh-msg-bubble{background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;border-top-right-radius:4px;}
.yh-msg-time{font-size:10px;color:#a0aab0;margin-top:4px;padding:0 4px;}

/* 正在输入提示 */
.yh-typing{display:none;align-items:center;gap:4px;padding:12px 14px;background:#fff;border-radius:14px;border-top-left-radius:4px;box-shadow:0 1px 4px rgba(0,0,0,.07);width:fit-content;}
.yh-typing.show{display:flex;}
.yh-typing span{width:7px;height:7px;border-radius:50%;background:#a0aab0;animation:yhTyping 1.2s infinite;}
.yh-typing span:nth-child(2){animation-delay:.2s;}
.yh-typing span:nth-child(3){animation-delay:.4s;}
@keyframes yhTyping{0%,60%,100%{transform:translateY(0);opacity:.5;}30%{transform:translateY(-5px);opacity:1;}}

.yh-chat-footer{padding:10px 12px 12px;border-top:1px solid #edf0ee;background:#fff;flex-shrink:0;}
.yh-chat-input-row{display:flex;gap:8px;align-items:flex-end;}
.yh-chat-input{flex:1;border:1.5px solid #e2e8e4;border-radius:20px;padding:9px 16px;font-size:14px;resize:none;max-height:80px;outline:none;transition:border-color .2s;font-family:inherit;line-height:1.4;background:#fafbfa;}
.yh-chat-input:focus{border-color:#2D7A50;background:#fff;}
.yh-chat-send{width:40px;height:40px;border-radius:50%;background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .2s;}
.yh-chat-send:hover{transform:scale(1.05);}
.yh-chat-send:disabled{background:#cbd5d0;cursor:not-allowed;transform:none;}
.yh-chat-send svg{width:18px;height:18px;}
.yh-chat-tip{text-align:center;font-size:11px;color:#a0aab0;padding:6px 0 0;}

/* 信息收集遮罩 */
.yh-nick-mask{position:absolute;inset:0;background:linear-gradient(160deg,#f5f7f6,#fff);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:30px;z-index:2;}
.yh-nick-icon{width:60px;height:60px;border-radius:50%;background:linear-gradient(135deg,#1B5E3A,#2D7A50);display:flex;align-items:center;justify-content:center;margin-bottom:4px;}
.yh-nick-icon svg{width:30px;height:30px;color:#fff;}
.yh-nick-mask h3{font-size:17px;color:#2d3748;margin:0;font-weight:600;}
.yh-nick-mask p{font-size:13px;color:#718096;margin:0;text-align:center;line-height:1.5;}
.yh-nick-mask input{width:100%;max-width:280px;padding:11px 16px;border:1.5px solid #e2e8e4;border-radius:10px;font-size:14px;outline:none;text-align:center;background:#fafbfa;transition:border-color .2s;}
.yh-nick-mask input:focus{border-color:#2D7A50;background:#fff;}
.yh-nick-mask button{width:100%;max-width:280px;padding:11px;background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;border:none;border-radius:10px;font-size:14px;cursor:pointer;font-weight:500;transition:opacity .2s;}
.yh-nick-mask button:hover{opacity:.9;}

@media (max-width:640px){
    #yhChatWindow{right:8px;bottom:76px;width:calc(100vw - 16px);height:calc(100vh - 96px);max-height:calc(100vh - 96px);border-radius:14px;}
    #yhChatBtn{right:14px;bottom:14px;width:52px;height:52px;}
    #yhChatWindow.offline-mode{bottom:16px;height:auto;max-height:85vh;}
}

/* 离线状态 */
#yhChatBtn.offline{background:linear-gradient(135deg,#718096,#a0aec0);box-shadow:0 4px 18px rgba(113,128,150,.4);}
#yhChatBtn.offline .pulse{background:#a0aec0;animation:none;opacity:.3;}
.yh-chat-header.offline{background:linear-gradient(135deg,#4a5568,#718096);}
.yh-chat-title .status.offline::before{background:#fc8181;box-shadow:0 0 4px #fc8181;}

/* 离线时窗口下移，隐藏头部和输入框 */
#yhChatWindow.offline-mode{bottom:20px;height:auto;max-height:80vh;}
#yhChatWindow.offline-mode .yh-chat-header{display:none;}
#yhChatWindow.offline-mode .yh-quick-bar{display:none!important;}
#yhChatWindow.offline-mode .yh-chat-body{display:none;}
#yhChatWindow.offline-mode .yh-chat-footer{display:none!important;}
#yhChatWindow.offline-mode .yh-leave-mask{position:relative;}

/* 留言表单 */
.yh-leave-mask{position:absolute;inset:0;background:#fff;display:none;flex-direction:column;z-index:10;}
.yh-leave-mask.show{display:flex;}
.yh-leave-header{background:linear-gradient(135deg,#4a5568,#718096);color:#fff;padding:18px 20px;text-align:center;}
.yh-leave-header h3{margin:0 0 4px;font-size:16px;}
.yh-leave-header p{margin:0;font-size:12px;opacity:.85;}
.yh-leave-body{flex:1;padding:20px;display:flex;flex-direction:column;gap:12px;overflow-y:auto;}
.yh-leave-body label{font-size:13px;color:#4a5568;font-weight:500;display:block;width:100%;white-space:normal;}
.yh-leave-body input,.yh-leave-body textarea{width:100%;padding:10px 14px;border:1.5px solid #e2e8e4;border-radius:8px;font-size:14px;outline:none;font-family:inherit;box-sizing:border-box;}
.yh-leave-body input:focus,.yh-leave-body textarea:focus{border-color:#718096;}
.yh-leave-body textarea{resize:none;height:100px;}
.yh-leave-body button{padding:12px;background:linear-gradient(135deg,#4a5568,#718096);color:#fff;border:none;border-radius:8px;font-size:14px;cursor:pointer;font-weight:500;margin-top:auto;}
.yh-leave-body button:hover{opacity:.9;}
.yh-leave-success{text-align:center;padding:40px 20px;display:none;flex-direction:column;align-items:center;gap:12px;flex:1;justify-content:center;}
.yh-leave-success.show{display:flex;}
.yh-leave-success .icon{width:60px;height:60px;border-radius:50%;background:#c6f6d5;display:flex;align-items:center;justify-content:center;}
.yh-leave-success .icon svg{width:30px;height:30px;color:#276749;}
.yh-leave-success p{font-size:14px;color:#4a5568;margin:0;line-height:1.6;}
.yh-leave-back{background:none;border:none;color:#718096;font-size:13px;cursor:pointer;text-decoration:underline;padding:8px;}

/* 邀请弹窗 */
#yhInvite{position:fixed;right:20px;bottom:92px;width:300px;background:#fff;border-radius:14px;box-shadow:0 8px 32px rgba(0,0,0,.18);z-index:9997;display:none;overflow:hidden;animation:yhSlideUp .3s ease;}
#yhInvite.show{display:block;}
#yhInvite .invite-header{background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px;}
#yhInvite .invite-avatar{width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;}
#yhInvite .invite-avatar svg{width:22px;height:22px;}
#yhInvite .invite-close{margin-left:auto;width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;}
#yhInvite .invite-close:hover{background:rgba(255,255,255,.15);}
#yhInvite .invite-body{padding:16px;}
#yhInvite .invite-body p{margin:0 0 12px;font-size:14px;color:#4a5568;line-height:1.5;}
#yhInvite .invite-btn{display:block;width:100%;padding:10px;background:linear-gradient(135deg,#1B5E3A,#2D7A50);color:#fff;border:none;border-radius:8px;font-size:14px;cursor:pointer;font-weight:500;text-align:center;}
#yhInvite .invite-btn:hover{opacity:.9;}
@media (max-width:640px){
    #yhInvite{right:10px;bottom:80px;width:calc(100vw - 20px);}
}
