<!-- 发布弹窗 -->
<div class="modal-overlay publish-modal" id="publishModal">
    <div class="modal-container">
        <div class="modal-header">
            <button class="modal-close" onclick="closeModal('publishModal')">×</button>
            <h3 class="modal-title">发布动态</h3>
            <button class="publish-submit-btn" id="publishSubmitBtn" onclick="handlePublishSubmit()">发布</button>
        </div>
        <form class="publish-form" id="publishForm" onsubmit="return false;" autocomplete="off">
            <textarea class="publish-textarea" id="publishContent" placeholder="分享你的新鲜事..." maxlength="500"></textarea>
            <div class="publish-images" id="publishImages"></div>
            <input type="file" id="publishImageInput" accept="image/*,video/*" multiple style="display:none;">
            <input type="hidden" id="publishCircleId" name="circle_id" value="0">
            <input type="hidden" id="publishCircleName" name="circle_name" value="">
            <div class="publish-toolbar">
                <div class="publish-tools">
                    <button type="button" class="publish-tool-btn" onclick="document.getElementById('publishMediaInput').click()">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
                        </svg>
                        <span class="tool-label">图片/视频</span>
                    </button>
                    <input type="file" id="publishMediaInput" accept="image/*,video/*" multiple style="display:none;">
                    <?php if ((int)Setting::get('circles_enabled', 1) === 1): ?>
                    <button type="button" class="publish-tool-btn" id="circleToolbarBtn" onclick="toggleCircleSelect()">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
                        </svg>
                        <span class="tool-label" id="circleToolbarLabel">圈子</span>
                    </button>
                    <?php endif; ?>
                    <button type="button" class="publish-tool-btn" onclick="toggleEmojiPicker()">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/>
                        </svg>
                        <span class="tool-label">表情</span>
                    </button>
                    <button type="button" class="publish-tool-btn" onclick="insertTopic()">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"/>
                        </svg>
                        <span class="tool-label">话题</span>
                    </button>
                    <button type="button" class="publish-tool-btn" id="locationToolbarBtn" onclick="toggleLocation(this)">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
                        </svg>
                        <span class="tool-label">位置</span>
                    </button>
                    <button type="button" class="publish-tool-btn" onclick="insertAt()">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/>
                        </svg>
                        <span class="tool-label">@</span>
                    </button>
                    <button type="button" class="publish-tool-btn" onclick="toggleAnonymous()">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/>
                        </svg>
                        <span class="tool-label">隐私</span>
                    </button>
                </div>
                <div class="publish-char-count">
                    <span id="publishCharCount">0</span>/500
                </div>
            </div>
            <!-- 表情选择器 -->
            <div class="emoji-picker" id="emojiPicker" style="display:none;">
                <div class="emoji-category">
                    <button type="button" class="emoji-tab active" data-category="default"><span class="iconify" data-icon="mdi:emoticon-outline"></span></button>
                    <button type="button" class="emoji-tab" data-category="hot"><span class="iconify" data-icon="mdi:fire"></span></button>
                    <button type="button" class="emoji-tab" data-category="emoji"><span class="iconify" data-icon="mdi:emoticon-happy-outline"></span></button>
                </div>
                <div class="emoji-grid" id="emojiGrid">
                    <!-- 表情会动态加载 -->
                </div>
            </div>
        </form>
    </div>
</div>
