/* ==========================================================================
   客服悬浮条 kefu.css
   北美津桥国际教育 - 在线客服 + QQ客服(10个)
   独立文件、独立前缀 kefu- ，不污染既有 style.css / app.css
   ========================================================================== */

.kefu-wrap {
    position: fixed;
    right: 0;
    /*
     * 桌面端定位在视口右上方（top:60px），上浮在 Knocket 聊天窗正上方。
     *
     * 布局约定（聊天窗贴右下角 bottom:20px，高 min(560px, 100vh-340px)）：
     *   聊天窗顶 Y ≥ 340（= 视口高 - 20 - 聊天窗高，公式保证）
     *   悬浮条 60~224
     * 因此无论视口多高多矮（实测 500~900px），两者永不重叠。
     *
     * 用 top 而非 bottom：聊天窗高度随视口变化，只有固定 top 才能保证稳定避让。
     */
    top: 60px;
    bottom: auto;
    z-index: 9990;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    line-height: 1;
    transition: top .3s ease;
}

/* ---------- 收起状态：右侧竖排按钮 ---------- */
.kefu-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.kefu-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 1px;
    background: #fff;
    color: #444;
    cursor: pointer;
    transition: all .25s ease;
    overflow: hidden;
}

.kefu-btn:hover {
    background: #da251d;
    color: #fff;
}

.kefu-btn .kefu-ico {
    width: 26px;
    height: 26px;
    display: block;
}

.kefu-btn .kefu-txt {
    display: none;
    white-space: nowrap;
    font-size: 13px;
    margin-left: 5px;
}

/* 悬停时横向展开显示文字 */
.kefu-btn:hover {
    width: 118px;
    justify-content: flex-start;
    padding-left: 13px;
}

.kefu-btn:hover .kefu-txt {
    display: inline;
}

/* 顶部主按钮（QQ客服）常驻文字 */
.kefu-btn-main {
    background: #da251d;
    color: #fff;
}

.kefu-btn-main:hover {
    background: #b81c15;
}

/* 留言咨询按钮：次要强调，与主按钮拉开层级 */
.kefu-btn-msg {
    background: #f5f5f5;
}

.kefu-btn-msg:hover {
    background: #da251d;
    color: #fff;
}

/* 微信客服按钮（跳企业微信） */
.kefu-btn-wxkf:hover {
    background: #07c160;
}

/* ---------- 展开面板 ---------- */
.kefu-panel {
    position: fixed;
    /*
     * 紧邻「QQ客服」按钮：横向 right:118px（按钮宽54+悬停展开118），
     * 纵向 top 与悬浮条按钮对齐（悬浮条定位 top:60px，首个按钮即QQ客服）。
     * 不再用 top:50% 居中 —— 面板应从按钮位置向右展开，符合用户直觉。
     */
    top: 60px;
    right: 118px;
    /* 加宽至340px：容纳「QQ号码 + 业务姓名 + 复制/咨询」按钮 */
    width: 340px;
    /* 上方留 60、下方留 20，面板再高也不会超出视口 */
    max-height: calc(100vh - 80px);
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .13);
    opacity: 0;
    visibility: hidden;
    /* 横向滑入动画：仅 X轴偏移，Y 保持 0 以紧贴按钮顶部 */
    transform: translateX(14px);
    transition: opacity .28s ease, visibility .28s ease, transform .28s ease;
}

.kefu-panel.on {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.kefu-ph {
    padding: 13px 15px;
    background: #da251d;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kefu-ph .kefu-close {
    cursor: pointer;
    font-size: 19px;
    font-weight: normal;
    opacity: .85;
    padding: 0 3px;
}

.kefu-ph .kefu-close:hover {
    opacity: 1;
}

.kefu-pb {
    padding: 6px 0;
    /* QQ 客服可能配到 10 条，限定高度并允许滚动，避免面板超出屏幕 */
    max-height: 400px;
    overflow-y: auto;
}

/* ---------- QQ 列表 ---------- */
.kefu-qq {
    display: flex;
    align-items: center;
    padding: 11px 15px;
    border-bottom: 1px dashed #eee;
    transition: background .2s;
}

.kefu-qq:last-child {
    border-bottom: none;
}

.kefu-qq:hover {
    background: #faf5f5;
}

.kefu-qq-ico {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    margin-right: 11px;
    background: #da251d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kefu-qq-ico svg {
    width: 19px;
    height: 19px;
    fill: #fff;
}

.kefu-qq-info {
    flex: 1;
    min-width: 0;
}

.kefu-qq-num {
    font-size: 14px;
    color: #333;
    font-weight: bold;
    letter-spacing: .3px;
}

.kefu-qq-act {
    font-size: 12px;
    color: #999;
    margin-top: 3px;
    /* 名称可能较长（如「美国高端规划刘校长」），允许完整显示不截断 */
    white-space: normal;
    word-break: break-all;
    line-height: 1.35;
}

.kefu-qq-op {
    flex: 0 0 auto;
    display: flex;
    gap: 5px;
}

.kefu-mini {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #da251d;
    color: #da251d;
    background: #fff;
    cursor: pointer;
    border-radius: 2px;
    transition: all .2s;
    white-space: nowrap;
}

.kefu-mini:hover {
    background: #da251d;
    color: #fff;
}

.kefu-mini-gray {
    border-color: #ccc;
    color: #666;
}

.kefu-mini-gray:hover {
    background: #999;
    border-color: #999;
    color: #fff;
}

/* 空状态 */
.kefu-empty {
    padding: 26px 15px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ---------- 微信二维码弹层 ---------- */
.kefu-qr {
    position: absolute;
    right: 118px;
    bottom: 0;
    width: 200px;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .13);
    padding: 14px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all .28s ease;
}

.kefu-qr.on {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kefu-qr img {
    width: 172px;
    height: 172px;
    display: block;
    margin: 0 auto;
}

.kefu-qr p {
    margin: 9px 0 0;
    font-size: 12px;
    color: #666;
}

/* ---------- 提示气泡 ---------- */
.kefu-tip {
    position: fixed;
    left: 50%;
    bottom: 22%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .78);
    color: #fff;
    font-size: 13px;
    padding: 9px 17px;
    border-radius: 3px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all .25s;
    pointer-events: none;
}

.kefu-tip.on {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   移动端端：底部通栏
   ========================================================================== */
@media screen and (max-width: 767px) {
    .kefu-wrap {
        right: 0;
        left: 0;
        /*
         * 移动端：底部通栏贴底，聊天窗占满宽度居顶（78vh），两者天然不冲突。
         */
        top: auto;
        bottom: 0;
    }

    .kefu-bar {
        flex-direction: row;
        align-items: stretch;
    }

    .kefu-btn {
        flex: 1;
        width: auto;
        height: 52px;
        margin: 0;
        flex-direction: column;
        background: #fff;
        border-top: 1px solid #eee;
    }

    .kefu-btn:hover {
        width: auto;
        padding-left: 0;
        justify-content: center;
        background: #fff;
        color: #444;
    }

    .kefu-btn-main,
    .kefu-btn-main:hover {
        background: #da251d;
        color: #fff;
    }

    /* 移动端 hover 状态要显式还原，否则桌面端配色会"粘"在移动端 */
    .kefu-btn-msg,
    .kefu-btn-msg:hover {
        background: #fff;
        color: #444;
    }

    .kefu-btn-wxkf,
    .kefu-btn-wxkf:hover {
        background: #fff;
        color: #444;
    }

    .kefu-btn .kefu-txt,
    .kefu-btn:hover .kefu-txt {
        display: block;
        font-size: 11px;
        margin: 3px 0 0;
        white-space: nowrap;
        transform: scale(.92);
    }

    .kefu-btn .kefu-ico {
        width: 20px;
        height: 20px;
    }

    /* 极窄屏（iPhone SE / 老安卓，320px）保护：进一步压缩文字 */
    @media screen and (max-width: 359px) {
        .kefu-btn .kefu-txt,
        .kefu-btn:hover .kefu-txt {
            font-size: 10px;
            transform: scale(.88);
        }

        .kefu-btn .kefu-ico {
            width: 18px;
            height: 18px;
        }
    }

    .kefu-panel,
    .kefu-qr {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 52px;
        top: auto;
        width: auto;
        transform: translateY(16px);
        border-left: none;
        border-right: none;
    }

    .kefu-panel.on,
    .kefu-qr.on {
        transform: translateY(0);
    }

    .kefu-qr {
        width: auto;
        padding: 18px;
    }

    .kefu-qr img {
        width: 200px;
        height: 200px;
        max-width: 72vw;
        max-height: 72vw;
    }
}