<?php
/**
 * HuSNS - 一款免费开源的社交平台
 * 
 * @author  HYR
 * @QQ      281900864
 * @website https://huyourui.com
 * @license MIT
 * @声明    严禁用于违法违规用途
 */
// 检查登录状态
$userId = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null;
if (!$userId) {
    // 使用弹窗登录，不跳转页面
    $this->assign('showLoginModal', true);
}

$currentPage = 'favorites';
$pageType = 'favorites';
$bodyClass = 'favorites-page';
$headerTitle = '我的收藏';
$userId = $_SESSION['user_id'];

// 页面特定CSS和JS文件
$pageCssFiles = [$this->themeUrl() . '/app/css/favorites.css'];
$pageJsFiles = [$this->themeUrl() . '/app/js/favorites.js'];

$this->assign('pageCssFiles', $pageCssFiles);
$this->assign('pageJsFiles', $pageJsFiles);

$this->setLayout('app');
?>

<!-- 收藏页面 -->
<div class="favorites-wrapper">
    <!-- 页面头部 -->
    <div class="favorites-header">
        <a href="javascript:history.back();" class="favorites-back">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <polyline points="15 18 9 12 15 6"></polyline>
            </svg>
        </a>
        <h1 class="favorites-title">我的收藏</h1>
        <div class="favorites-actions">
            <button class="favorites-action-btn" id="editFavoritesBtn" onclick="toggleEditMode()">
                <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
                    <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
                </svg>
            </button>
        </div>
    </div>

    <!-- 收藏统计 -->
    <div class="favorites-stats">
        <span class="favorites-count" id="favoritesCount">0</span> 条收藏
    </div>
    
    <!-- 收藏列表 -->
    <div class="favorites-list" id="favoritesList">
        <div class="empty-state">
            <div class="empty-icon">⏳</div>
            <div class="empty-text">加载中...</div>
        </div>
    </div>
    
    <!-- 加载更多 -->
    <div class="load-more" id="loadMoreContainer" style="display:none;">
        <button class="load-more-btn" id="loadMoreBtn">加载更多</button>
    </div>
    
    <!-- 批量操作栏（编辑模式下显示） -->
    <div class="batch-actions" id="batchActions" style="display:none;">
        <button class="batch-btn select-all" onclick="selectAllFavorites()">全选</button>
        <button class="batch-btn delete-batch" onclick="deleteSelectedFavorites()">删除</button>
    </div>
</div>