/* 彻底重构的前台悬浮客服组件 */

.ff-chat-bubble {

    position: fixed; right: 20px; bottom: 80px; width: 55px; height: 55px;

    background: #1B2A4A; border-radius: 50%; color: #fff; display: flex;

    align-items: center; justify-content: center; font-size: 28px;

    cursor: pointer; box-shadow: 0 4px 15px rgba(27, 42, 74, 0.4);

    z-index: 9999; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

}

.ff-chat-bubble:hover { transform: scale(1.05); }

.ff-chat-bubble {

    /* 核心修复：防止裁剪，并确保定位基准 */

    overflow: visible !important; 

}



.ff-chat-bubble .badge {

    position: absolute !important;

    top: -6px !important;

    right: -8px !important;

    background: #EF4444 !important;

    color: #FFFFFF !important;

    font-size: 12px !important;

    font-weight: bold !important;

    line-height: 1 !important;

    min-width: 20px !important;

    height: 20px !important;

    padding: 0 6px !important;

    border-radius: 10px !important;

    display: flex;

    align-items: center !important;

    justify-content: center !important;

    box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(239, 68, 68, 0.4) !important;

    z-index: 10000 !important;

    box-sizing: border-box !important;

}

.ff-chat-window {

    position: fixed; right: 20px; bottom: 150px; width: 360px; height: 550px;

    background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,0.15);

    display: none; flex-direction: column; z-index: 9998; overflow: hidden;

    border: 1px solid #E5E7EB;

}

.ff-chat-window.show { display: flex; animation: ffSlideUp 0.3s ease-out; }

@keyframes ffSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }



.ff-chat-header {

    background: #1B2A4A; color: #fff; padding: 16px 20px; font-weight: bold; font-size: 16px;

    display: flex; justify-content: space-between; align-items: center;

    box-shadow: 0 2px 10px rgba(0,0,0,0.1); z-index: 2;

}

.ff-chat-header .close { cursor: pointer; font-size: 24px; opacity: 0.7; line-height: 1; transition: opacity 0.2s; }

.ff-chat-header .close:hover { opacity: 1; }



.ff-chat-messages {

    flex: 1; padding: 20px; overflow-y: auto; background: #F3F4F6;

    display: flex; flex-direction: column; gap: 16px;

}

.ff-chat-messages::-webkit-scrollbar { width: 6px; }

.ff-chat-messages::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }



/* 空状态 */

.ff-chat-empty {

    display: flex; flex-direction: column; align-items: center; justify-content: center;

    height: 100%; color: #6B7280; font-size: 15px;

}

.ff-chat-empty .avatar {

    width: 70px; height: 70px; background: #E5E7EB; border-radius: 50%;

    display: flex; align-items: center; justify-content: center;

    font-size: 35px; margin-bottom: 15px; color: #9CA3AF;

}



/* 消息气泡结构 */

.ff-msg-wrap { display: flex; gap: 12px; width: 100%; align-items: flex-start; }

.ff-msg-wrap.user { flex-direction: row-reverse; }



.ff-msg-avatar {

    width: 40px; height: 40px; border-radius: 50%; background: #fff;

    display: flex; align-items: center; justify-content: center;

    font-size: 20px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1);

}

.ff-msg-wrap.bot .ff-msg-avatar { background: #1B2A4A; color: #fff; }



.ff-msg-content-box { display: flex; flex-direction: column; max-width: 72%; }

.ff-msg-wrap.user .ff-msg-content-box { align-items: flex-end; }



/* 气泡 */

.ff-msg-bubble {

    padding: 12px 16px; border-radius: 16px; font-size: 14.5px; line-height: 1.5;

    word-break: break-all; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative;

}

.ff-msg-wrap.bot .ff-msg-bubble {

    background: #fff; color: #1F2937; border-top-left-radius: 4px; border: 1px solid #F3F4F6;

}

.ff-msg-wrap.user .ff-msg-bubble {

    background: #F59E0B; color: #fff; border-top-right-radius: 4px;

}



.ff-msg-time { font-size: 12px; color: #9CA3AF; margin-top: 6px; display: flex; align-items: center; gap: 8px; }

.ff-msg-revoke { color: #EF4444; cursor: pointer; }

.ff-msg-revoke:hover { text-decoration: underline; }



/* 输入区 */

.ff-chat-input-area { padding: 12px 16px 16px; background: #fff; border-top: 1px solid #E5E7EB; }

.ff-chat-tools { display: flex; gap: 15px; margin-bottom: 12px; padding: 0 4px; }

.ff-chat-tools button {

    background: none; border: none; font-size: 24px; cursor: pointer; color: #6B7280; transition: color 0.2s;

}

.ff-chat-tools button:hover { color: #F59E0B; }



.ff-chat-input-row { display: flex; gap: 12px; align-items: center; }

.ff-chat-input-row input {

    flex: 1; border: 1px solid #E5E7EB; border-radius: 24px; padding: 12px 18px;

    font-size: 14.5px; outline: none; background: #F9FAFB; transition: all 0.2s;

}

.ff-chat-input-row input:focus { border-color: #F59E0B; background: #fff; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1); }

.ff-chat-input-row button {

    background: #F59E0B; color: #fff; border: none; border-radius: 24px;

    padding: 0 24px; height: 44px; font-weight: bold; font-size: 15px; cursor: pointer;

    transition: background 0.2s, transform 0.1s; box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);

}

.ff-chat-input-row button:hover { background: #D97706; transform: translateY(-1px); }

.ff-chat-input-row button:active { transform: translateY(1px); }



@media (max-width: 480px) {

    .ff-chat-window { width: 100%; height: 100%; bottom: 0; right: 0; border-radius: 0; z-index: 10000; }

}



.ff-chat-messages { background-color: #F8FAFC !important; }

.ff-chat-empty { display: flex; }



/* 适配 textarea 的样式 */

.ff-chat-input-row textarea {

    flex: 1; border: 1px solid #E5E7EB; border-radius: 20px; padding: 10px 18px;

    font-size: 14.5px; outline: none; background: #F9FAFB; transition: all 0.2s;

    line-height: 1.4; min-height: 44px;

}

.ff-chat-input-row textarea:focus {

    border-color: #F59E0B; background: #fff; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);

}

