<!-- 评论弹窗 - 楼中楼 -->
<div class="modal-overlay comment-modal" id="commentModal">
    <div class="modal-container" style="max-height: 85vh;">
        <div class="modal-header">
            <h3 class="modal-title">评论 <span id="commentCount" class="count-badge">0</span></h3>
            <button class="modal-close" onclick="closeModal('commentModal')">×</button>
        </div>
        <div class="comment-post-preview" id="commentPostPreview"></div>
        <div class="modal-body comment-body" id="commentListContainer">
            <div class="comment-loading" id="commentLoading">
                <div class="loading-dots"><span></span><span></span><span></span></div>
            </div>
        </div>
        <div class="comment-input-area" id="commentInputArea">
            <div class="comment-reply-tip" id="commentReplyTip" style="display:none;">
                <span>回复 @<span id="replyToUsername"></span></span>
                <button onclick="cancelReply()">×</button>
            </div>
            <div class="comment-input-row">
                <div class="comment-user-avatar" id="commentUserAvatar">
                    <img src="<?php echo !empty($currentUserAvatar) ? $currentUserAvatar : $this->themeUrl() . '/images/avatar_default.png'; ?>" alt="">
                </div>
                <div class="comment-input-wrapper">
                    <textarea class="comment-textarea" id="modalCommentInput" placeholder="写评论..." rows="1"></textarea>
                    <button class="comment-emoji-btn" id="commentEmojiBtn" onclick="toggleCommentEmoji()">
                        <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                            <circle cx="12" cy="12" r="10"></circle>
                            <path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
                            <line x1="9" y1="9" x2="9.01" y2="9"></line>
                            <line x1="15" y1="9" x2="15.01" y2="9"></line>
                        </svg>
                    </button>
                </div>
                <button class="comment-submit-btn" id="modalCommentSubmit" onclick="submitModalComment()">
                    <span>发送</span>
                </button>
            </div>
            <div class="comment-emoji-picker" id="commentEmojiPicker" style="display:none;">
                <div class="emoji-tabs">
                    <button class="emoji-tab active" data-category="default"><span class="iconify" data-icon="mdi:emoticon-outline"></span></button>
                </div>
                <div class="emoji-grid" id="commentEmojiGrid"></div>
            </div>
        </div>
    </div>
</div>
