/**
 * 功能面板模块
 */

function toggleActionPanel(event) {
    event.stopPropagation();
    const panel = document.getElementById('actionPanel');
    const overlay = document.getElementById('panelOverlay');
    
    if (panel.style.display === 'block') {
        closeActionPanel();
        return;
    }
    
    testCloseEmoji();
    panel.style.display = 'block';
    overlay.classList.add('show');
    
    document.addEventListener('click', closeActionPanelOnOutside);
}

function closeActionPanel() {
    const panel = document.getElementById('actionPanel');
    const overlay = document.getElementById('panelOverlay');
    
    panel.style.display = 'none';
    overlay.classList.remove('show');
    document.removeEventListener('click', closeActionPanelOnOutside);
}

function closeActionPanelOnOutside(event) {
    const panel = document.getElementById('actionPanel');
    const plusBtn = document.querySelector('.input-action-btn:last-child');
    if (!panel.contains(event.target) && !plusBtn.contains(event.target)) {
        closeActionPanel();
    }
}

// 位置功能
function showLocationPanel() {
    closeActionPanel();
    showToast('位置功能开发中');
}

// 红包功能
function showRedPacketPanel() {
    closeActionPanel();
    showToast('红包功能开发中');
}

// 礼物功能
function showGiftPanel() {
    closeActionPanel();
    showToast('礼物功能开发中');
}

// 转账功能
function showTransferPanel() {
    closeActionPanel();
    showToast('转账功能开发中');
}

// 语音输入功能
function showVoiceInputPanel() {
    closeActionPanel();
    showToast('语音输入功能开发中');
}

// 更多选项
function showMoreOptions() {
    closeActionPanel();
    showToast('更多功能开发中');
}