/***浮动客服窗口样式（仅作用于客服组件，避免覆盖全站字体与布局）*/
.float-customer-wrap,
.float-customer-wrap * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 右侧悬浮客服容器：固定在视口右侧偏下居中 */
.float-customer-wrap {
    position: fixed !important;
    right: 24px !important;
    top: 58% !important;
    bottom: auto !important;
    left: auto !important;
    transform: translateY(-50%);
    z-index: 9999 !important;
    width: 60px;
    height: 60px;
    margin: 0;
    overflow: visible !important;
    pointer-events: none;
}
.float-customer-wrap .float-kefu-btn,
.float-customer-wrap .chat-popup-box {
    pointer-events: auto;
}

/* 悬浮客服按钮 */
.float-kefu-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1677FF, #4096ff);
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(22, 119, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: none;
    padding: 0;
    outline: none;
}
.float-kefu-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(22, 119, 255, 0.45);
}
.float-kefu-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}
.float-kefu-btn .kefu-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(22, 119, 255, 0.45);
    animation: kefuPulse 2s ease-out infinite;
    pointer-events: none;
}
@keyframes kefuPulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.55); opacity: 0; }
}
.float-kefu-tip {
    position: absolute;
    right: 72px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: #fff;
    color: #1D2129;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
}
.float-kefu-tip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #fff;
}
.float-customer-wrap:not(.is-open) .float-kefu-btn:hover .float-kefu-tip {
    opacity: 1;
    visibility: visible;
}

/* 仅展示 chatService 本体，去掉官网外层标题栏，避免双窗体感 */
.chat-popup-box {
    width: 400px;
    height: min(720px, calc(100vh - 40px));
    max-height: calc(100vh - 40px);
    background: transparent;
    border-radius: 16px;
    box-shadow: none;
    position: absolute;
    right: 72px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    overflow: hidden;
    display: none;
    flex-direction: column;
    border: none;
}
.float-customer-wrap.is-open .chat-popup-box {
    display: flex;
}
.float-customer-wrap.is-open .float-kefu-btn {
    background: linear-gradient(135deg, #0f5ed9, #3478e8);
}
.float-customer-wrap.is-open .float-kefu-tip {
    opacity: 1;
    visibility: visible;
}
.float-customer-wrap.is-open .float-kefu-tip::before {
    content: none;
}
.float-customer-wrap.is-open .kefu-pulse {
    display: none;
}

/* iframe 聊天区域铺满弹层 */
.chat-iframe-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #fff;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.18);
}
.chat-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}
.chat-iframe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f7f8fa;
    color: #4E5969;
    font-size: 13px;
    z-index: 1;
}
.chat-iframe-loading.is-hidden {
    display: none;
}
.chat-iframe-loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #d6e4ff;
    border-top-color: #1677FF;
    border-radius: 50%;
    animation: kefuSpin 0.8s linear infinite;
}
@keyframes kefuSpin {
    to { transform: rotate(360deg); }
}

/* 移动端适配 */
@media screen and (max-width: 480px) {
    .float-customer-wrap {
        right: 14px !important;
        top: 58% !important;
        bottom: auto !important;
        width: 52px;
        height: 52px;
    }
    .chat-popup-box {
        width: calc(100vw - 28px);
        height: min(80vh, calc(100vh - 40px));
        max-height: calc(100vh - 40px);
        right: 62px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }
    .float-kefu-btn {
        width: 52px;
        height: 52px;
    }
    .float-kefu-tip {
        display: none;
    }
}
