/* AI客服悬浮聊天窗 - widget.css */
#kf-fab {
    position: fixed;
    right: 20px;
    top: 70px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #FE7E00;
    box-shadow: 0 4px 16px rgba(254,126,0,0.35), 0 0 0 4px rgba(254,126,0,0.08);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: kf-float 3s ease-in-out infinite;
    transition: transform 0.2s;
}
#kf-fab:hover {
    transform: scale(1.08);
    animation-play-state: paused;
}
#kf-fab img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border: none;
    border-radius: 0;
}
.kf-avatar-default {
    color: #FE7E00;
    font-size: 24px;
    font-weight: bold;
}
@keyframes kf-float {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-8px); }
}

/* 对话框 */
#kf-box {
    position: fixed;
    right: 20px;
    top: 140px;
    width: 340px;
    height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
#kf-box.kf-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 头部 */
.kf-header {
    height: 48px;
    padding: 0 16px;
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
}
.kf-close {
    font-size: 22px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
.kf-close:hover { background: rgba(255,255,255,0.2); }

/* 消息区 */
.kf-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
}
.kf-msg {
    display: flex;
    margin-bottom: 10px;
}
.kf-user { justify-content: flex-end; }
.kf-bot  { justify-content: flex-start; }
.kf-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}
.kf-user .kf-bubble {
    background: #ff6b35;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.kf-bot .kf-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}
.kf-bot .kf-bubble b { color: #ff6b35; }
.kf-bot .kf-bubble a { color: #ff6b35; text-decoration: underline; }

/* 打字中动画 */
.kf-typing .kf-bubble {
    padding: 12px 16px;
}
.kf-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    margin: 0 2px;
    animation: kf-bounce 1.2s infinite ease-in-out;
}
.kf-typing span:nth-child(2) { animation-delay: 0.2s; }
.kf-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes kf-bounce {
    0%,80%,100% { transform: scale(0.6); opacity: 0.5; }
    40%         { transform: scale(1);   opacity: 1; }
}

/* 输入区 */
.kf-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
    gap: 8px;
}
.kf-input input {
    flex: 1;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.kf-input input:focus { border-color: #ff6b35; }
.kf-input button {
    height: 36px;
    padding: 0 18px;
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: #fff;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s;
}
.kf-input button:hover { transform: scale(1.03); }
.kf-input button:active { transform: scale(0.97); }

/* 移动端适配 */
@media (max-width: 480px) {
    #kf-fab { right: 14px; top: 70px; width: 50px; height: 50px; }
    #kf-box { right: 10px; left: 10px; top: 120px; width: auto; height: 420px; }
}
