/* 在线咨询（前台访客端）
   入口挂在右侧悬浮导航里，聊天窗固定在右下角。
   没有 WebSocket 扩展，走短轮询，UI 上不体现差异。 */

/* 图标用 nav05.png，与业务咨询、服务热线同规格（白色图形 + 高 26px） */

/* 该入口不做其他两项的「悬停展开 180px」效果：
   它的内容是聊天窗，悬停直接开窗，无需再弹出一个信息条。
   这两条要写在 zll_mobile.css 的桌面媒体查询之后才生效，
   所以用 !important 覆盖。 */
.right-navigation li.chat-entry:hover {
    width: 60px !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, .25) !important;
}

.right-navigation li.chat-entry:hover .con {
    opacity: 1 !important;
}

.right-navigation .chat-entry .con {
    position: relative;
}

/* 未读红点 */
.chat-entry-dot {
    display: none;
    position: absolute;
    top: 2px;
    right: 8px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e64545;
    color: #fff;
    font-size: 11px;
    font-style: normal;
    text-align: center;
}

.chat-entry-dot.show { display: block; }

/* ===== 聊天窗 ===== */
.chat-box {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 360px;
    height: 480px;
    z-index: 30;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    overflow: hidden;
    flex-direction: column;
}

.chat-box.is-open {
    display: flex;
}

.chat-head {
    position: relative;
    flex: 0 0 auto;
    padding: 14px 44px 14px 18px;
    background: linear-gradient(135deg, #4c74c5, #3a5fa8);
    color: #fff;
}

.chat-title {
    font-size: 15px;
    font-weight: 500;
}

.chat-status {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: rgba(255, 255, 255, .72);
}

.chat-close {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .22s;
}

.chat-close:hover { background: rgba(255, 255, 255, .18); }

/* 用两条斜线画叉 */
.chat-close:before,
.chat-close:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1.5px;
    background: #fff;
}

.chat-close:before { transform: translate(-50%, -50%) rotate(45deg); }
.chat-close:after { transform: translate(-50%, -50%) rotate(-45deg); }

.chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f5f6f8;
}

.chat-tip {
    margin: 0 auto 14px;
    padding: 6px 12px;
    max-width: 90%;
    border-radius: 12px;
    background: rgba(0, 0, 0, .05);
    font-size: 12px;
    line-height: 1.7;
    color: #888;
    text-align: center;
}

/* 消息气泡 */
.chat-msg {
    display: flex;
    margin-bottom: 14px;
}

.chat-msg-text {
    max-width: 76%;
    padding: 9px 13px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-msg-time {
    align-self: flex-end;
    margin: 0 6px;
    font-size: 11px;
    color: #bbb;
    flex: 0 0 auto;
}

/* 访客自己的消息靠右 */
.chat-msg.is-me {
    justify-content: flex-end;
}

.chat-msg.is-me .chat-msg-text {
    background: #4c74c5;
    color: #fff;
    border-bottom-right-radius: 2px;
}

/* 客服消息靠左 */
.chat-msg.is-admin .chat-msg-text {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.chat-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

.chat-input {
    flex: 1 1 auto;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
}

.chat-input:focus { border-color: #4c74c5; }

.chat-send {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: #4c74c5;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .22s;
}

.chat-send:hover { background: #3a5fa8; }
.chat-send:disabled { background: #b8c6dc; cursor: not-allowed; }

/* 窄屏铺满，避免小屏上被挤出视口 */
@media screen and (max-width: 560px) {
    .chat-box {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 78vh;
        border-radius: 10px 10px 0 0;
    }
}
