/* 在线客服聊天组件 */
#chatWidget { position: fixed; bottom: 65px; right: 12px; z-index: 1000; font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }

/* 悬浮按钮 */
.chat-fab {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #ff8901, #ff6b01);
    box-shadow: 0 4px 14px rgba(255,137,1,0.4);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform .2s, box-shadow .2s;
    position: relative;
}
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(255,137,1,0.5); }
.chat-fab:active { transform: scale(0.95); }
.chat-fab-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; line-height: 18px;
    background: #ff3b30; color: #fff; font-size: 11px;
    border-radius: 9px; text-align: center; padding: 0 5px;
    font-weight: 600;
}

/* 聊天窗口 */
.chat-window {
    position: absolute; bottom: 60px; right: 0;
    width: 320px; max-width: calc(100vw - 24px);
    height: 440px; max-height: calc(100vh - 200px);
    background: #fff; border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: chatSlideIn .25s ease-out;
}
@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 头部 */
.chat-header {
    height: 44px; padding: 0 14px;
    background: linear-gradient(135deg, #ff8901, #ff6b01);
    color: #fff; display: flex; align-items: center;
    font-size: 15px; font-weight: 600; flex-shrink: 0;
}
.chat-header-status { font-size: 11px; margin-left: 8px; opacity: 0.9; font-weight: 400; }
.chat-close { margin-left: auto; font-size: 18px; cursor: pointer; opacity: 0.8; padding: 0 4px; }
.chat-close:hover { opacity: 1; }

/* 快捷提问 */
.chat-quick-questions {
    padding: 10px 12px; background: #fffbe6;
    border-bottom: 1px solid #ffe8a1; flex-shrink: 0;
}
.chat-quick-title { font-size: 11px; color: #999; margin-bottom: 6px; }
.chat-quick-btn {
    display: inline-block; padding: 4px 10px;
    background: #fff; border: 1px solid #ffd06b;
    border-radius: 14px; font-size: 12px; color: #ff8901;
    cursor: pointer; margin: 2px 4px 2px 0;
    transition: all .15s;
}
.chat-quick-btn:hover, .chat-quick-btn:active { background: #fff3dc; border-color: #ff8901; }

/* 消息区 */
.chat-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    background: #f5f5f5;
}
/* 每条消息整行 */
.chat-msg { margin-bottom: 14px; }
.chat-msg.user { text-align: right; }
.chat-msg.admin { text-align: left; }
.chat-msg.system { text-align: center; }
/* 发送者名称 */
.chat-msg-sender { font-size: 11px; color: #999; margin-bottom: 3px; padding: 0 4px; }
/* 头像+气泡行 */
.chat-msg-row { display: inline-flex; align-items: flex-end; gap: 8px; max-width: 85%; }
.chat-msg.user .chat-msg-row { flex-direction: row-reverse; }
/* 头像 */
.chat-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #fff; font-weight: 600; line-height: 1;
}
.chat-msg.user .chat-avatar { background: #ff8901; }
.chat-msg.admin .chat-avatar { background: #1890ff; }
/* 气泡 */
.chat-bubble {
    padding: 9px 13px; border-radius: 14px; font-size: 14px;
    line-height: 1.55; word-break: break-word;
    display: inline-block; text-align: left;
}
.chat-msg.user .chat-bubble {
    background: #ff8901; color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.admin .chat-bubble {
    background: #fff; color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.chat-msg.system .chat-bubble {
    background: transparent; color: #999; font-size: 11px;
    padding: 4px 0;
}
/* 时间 */
.chat-msg-time { font-size: 10px; color: #bbb; margin-top: 3px; padding: 0 4px; }

/* 输入栏 */
.chat-input-bar {
    display: flex; padding: 8px 10px;
    border-top: 1px solid #eee; background: #fff; flex-shrink: 0;
}
.chat-input-bar input {
    flex: 1; height: 36px; padding: 0 12px;
    border: 1px solid #ddd; border-radius: 18px;
    font-size: 13px; outline: none;
    transition: border-color .2s;
}
.chat-input-bar input:focus { border-color: #ff8901; }
.chat-send-btn {
    width: 56px; height: 36px; margin-left: 8px;
    background: #ff8901; color: #fff; border: none;
    border-radius: 18px; font-size: 13px; cursor: pointer;
    transition: background .2s;
}
.chat-send-btn:hover { background: #ff7700; }
.chat-send-btn:active { background: #e66f00; }

/* 移动端适配 */
@media (max-width: 640px) {
    #chatWidget { bottom: 60px; right: 8px; }
    .chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 180px);
        max-height: none;
        right: -4px;
    }
}
