/* ========================================
   右侧客服 / 回到顶部 - kf.css
   对应 Public/kf.html 中的客服工具栏样式
   ======================================== */
.kf-toolbar {
    position: fixed;
    right: 20px;
    bottom: 28px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}
.kf-toolbar > * {
    pointer-events: auto;
}
.kf-widget {
    position: relative;
}
.kf-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    width: 280px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .14), 0 4px 12px rgba(0, 0, 0, .06);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
    pointer-events: none;
}
.kf-widget.is-open .kf-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.kf-panel-banner {
    position: relative;
    padding: 18px 16px 16px;
    color: #fff;
    overflow: hidden;
}
.kf-panel-banner-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-1);
}
.kf-panel-banner-bg::before,
.kf-panel-banner-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.kf-panel-banner-bg::before {
    width: 120px;
    height: 120px;
    top: -40px;
    right: -20px;
}
.kf-panel-banner-bg::after {
    width: 80px;
    height: 80px;
    bottom: -30px;
    left: 20px;
}
.kf-panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    transition: var(--transition);
    pointer-events: auto;
}
.kf-panel-close:hover {
    background: rgba(255, 255, 255, .28);
}
.kf-panel-greet {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 34px;
}
.kf-panel-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    border: 2px solid rgba(255, 255, 255, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}
.kf-panel-status {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34d399;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, .35);
}
.kf-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}
.kf-panel-desc {
    margin: 3px 0 0;
    font-size: 0.8125rem;
    opacity: .88;
    line-height: 1.4;
}
.kf-panel-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kf-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}
.kf-channel:hover {
    background: #fff;
    border-color: var(--gray-200);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.kf-channel-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(145deg, #2aabee 0%, #229ed9 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}
.kf-channel-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kf-channel-text strong {
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}
.kf-channel-text small {
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.3;
}
.kf-channel-go {
    font-size: 0.8125rem;
    color: var(--gray-400);
    transition: var(--transition);
}
.kf-channel:hover .kf-channel-go {
    color: var(--primary);
    transform: translateX(3px);
}
.kf-panel-foot {
    padding: 10px 16px 14px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--gray-500);
    border-top: 1px solid var(--gray-200);
}
.kf-fab {
    position: relative;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: var(--gradient-1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), box-shadow var(--transition);
}
.kf-fab:hover {
    transform: scale(1.06);
    box-shadow: var(--shadow-lg);
}
.kf-fab-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, .45);
    animation: kf-pulse 2.4s ease-out infinite;
    pointer-events: none;
}
.kf-widget.is-open .kf-fab-pulse {
    animation: none;
    opacity: 0;
}
@keyframes kf-pulse {
    0% {
        transform: scale(1);
        opacity: .7;
    }
    70% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}
.kf-fab-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: opacity .18s ease, transform .18s ease;
}
.kf-fab-icon--chat {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}
.kf-fab-icon--close {
    opacity: 0;
    transform: scale(.6) rotate(-90deg);
}
.kf-widget.is-open .kf-fab-icon--chat {
    opacity: 0;
    transform: scale(.6) rotate(90deg);
}
.kf-widget.is-open .kf-fab-icon--close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}
.kf-top {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-900);
    cursor: pointer;
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease, background var(--transition), box-shadow var(--transition);
    text-decoration: none;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
}
.kf-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.kf-top i {
    font-size: .875rem;
    line-height: 1;
}
.kf-top:hover {
    background: var(--gray-900);
    border-color: var(--gray-900);
    color: #fff;
    box-shadow: var(--shadow-md);
}
