<?php
ob_start();
require_once __DIR__ . '/../../config.php';
$site_name = getSiteConfig('site_name') ?? '麟泓授权';
$site_logo = getSiteConfig('site_logo') ?? '/assets/uploads/logo.png';

// APP 版本信息（可从数据库获取）
$app_version = '3.1.7';
$app_update_date = '2026-04-20';
$android_download_url = '/assets/app/lhauth-v3.1.7.apk';
?>
<?php include 'header.php'; ?>
<?php
// 获取更新日志
$changelog = $db->fetchAll("SELECT * FROM changelog ORDER BY id DESC LIMIT 3");?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>APP下载 - <?php echo htmlspecialchars($site_name); ?></title>
    <link rel="stylesheet" href="/assets/css/style.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
            min-height: 100vh;
        }
        
        .app-container {
            display: flex;
            max-width: 1400px;
            margin: 0 auto;
            padding: 24px;
            gap: 24px;
        }
        
        /* ========== 左侧目录树 ========== */
        .app-sidebar {
            width: 280px;
            flex-shrink: 0;
            background: white;
            border-radius: 24px;
            padding: 24px 0;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
            border: 1px solid rgba(0,0,0,0.04);
            position: sticky;
            top: 24px;
            height: fit-content;
            max-height: calc(100vh - 48px);
            overflow-y: auto;
        }
        
        .sidebar-header {
            padding: 0 20px 20px;
            border-bottom: 1px solid #f0f0f0;
            margin-bottom: 16px;
        }
        
        .sidebar-header h3 {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 18px;
            font-weight: 700;
            color: #1a1a1a;
        }
        
        .tree-menu {
            padding: 0 12px;
        }
        
        .tree-item {
            list-style: none;
        }
        
        .tree-link {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            color: #64748b;
            text-decoration: none;
            border-radius: 12px;
            transition: all 0.2s;
            font-size: 14px;
            font-weight: 500;
        }
        
        .tree-link:hover {
            background: #f8fafc;
            color: #3b82f6;
        }
        
        .tree-link.active {
            background: linear-gradient(135deg, #3b82f610, #3b82f605);
            color: #3b82f6;
            border-left: 3px solid #3b82f6;
        }
        
        .tree-link .icon {
            width: 22px;
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .tree-divider {
            height: 1px;
            background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
            margin: 16px 20px;
        }
        
        .tree-badge {
            margin-left: auto;
            background: #3b82f6;
            color: white;
            padding: 2px 8px;
            border-radius: 20px;
            font-size: 10px;
            font-weight: 600;
        }
        
        /* ========== 右侧内容区 ========== */
        .app-content {
            flex: 1;
            min-width: 0;
        }
        
        .content-card {
            background: white;
            border-radius: 24px;
            padding: 32px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
            border: 1px solid rgba(0,0,0,0.04);
            margin-bottom: 24px;
        }
        
        .page-header {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 28px;
            padding-bottom: 24px;
            border-bottom: 1px solid #f0f0f0;
        }
        
        .page-icon {
            width: 56px;
            height: 56px;
            background: linear-gradient(135deg, #3b82f6, #2563eb);
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
        }
        
        .page-title h1 {
            font-size: 28px;
            font-weight: 700;
            color: #1a1a1a;
            margin-bottom: 6px;
        }
        
        .page-title p {
            color: #94a3b8;
            font-size: 14px;
        }
        
        /* ========== APP 介绍区域 ========== */
        .app-showcase {
            display: flex;
            align-items: center;
            gap: 40px;
            padding: 20px 0;
            flex-wrap: wrap;
        }
        
        .app-icon-large {
            width: 120px;
            height: 120px;
            background: linear-gradient(135deg, #3b82f6, #2563eb);
            border-radius: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 12px 30px rgba(59, 130, 246, 0.3);
        }
        
        .app-info {
            flex: 1;
        }
        
        .app-name {
            font-size: 32px;
            font-weight: 700;
            color: #1a1a1a;
            margin-bottom: 8px;
        }
        
        .app-version {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #f0fdf4;
            color: #10b981;
            padding: 4px 14px;
            border-radius: 30px;
            font-size: 13px;
            font-weight: 500;
            margin-bottom: 16px;
        }
        
        .app-desc {
            color: #64748b;
            line-height: 1.7;
            margin-bottom: 20px;
        }
        
        /* ========== 下载按钮 ========== */
        .download-buttons {
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
        }
        
        .download-btn {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px 28px;
            border-radius: 60px;
            text-decoration: none;
            font-weight: 600;
            transition: all 0.3s;
            border: none;
            cursor: pointer;
        }
        
        .download-btn.android {
            background: linear-gradient(135deg, #3b82f6, #2563eb);
            color: white;
            box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
        }
        
        .download-btn.android:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 28px rgba(59, 130, 246, 0.4);
        }
        
        .download-btn.ios {
            background: linear-gradient(135deg, #1e293b, #0f172a);
            color: white;
            box-shadow: 0 8px 20px rgba(30, 41, 59, 0.3);
        }
        
        .download-btn.ios:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 28px rgba(30, 41, 59, 0.4);
        }
        
        .download-btn img {
            filter: brightness(0) invert(1);
        }
        
        .btn-text {
            display: flex;
            flex-direction: column;
        }
        
        .btn-label {
            font-size: 12px;
            opacity: 0.8;
        }
        
        .btn-platform {
            font-size: 16px;
        }
        
        /* ========== 二维码下载 ========== */
        .qrcode-section {
            display: flex;
            align-items: center;
            gap: 24px;
            padding: 24px;
            background: #f8fafc;
            border-radius: 20px;
            margin-top: 24px;
            flex-wrap: wrap;
        }
        
        .qrcode-box {
            width: 140px;
            height: 140px;
            background: white;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }
        
        .qrcode-box img {
            width: 120px;
            height: 120px;
        }
        
        .qrcode-tip {
            flex: 1;
        }
        
        .qrcode-tip h4 {
            font-size: 16px;
            color: #1a1a1a;
            margin-bottom: 8px;
        }
        
        .qrcode-tip p {
            color: #94a3b8;
            font-size: 14px;
            line-height: 1.6;
        }
        
        /* ========== 功能特性 ========== */
        .feature-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin: 24px 0;
        }
        
        .feature-card {
            text-align: center;
            padding: 24px 16px;
            background: #fafbfc;
            border-radius: 20px;
            transition: all 0.3s;
        }
        
        .feature-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 24px rgba(0,0,0,0.06);
            background: white;
        }
        
        .feature-icon {
            width: 64px;
            height: 64px;
            margin: 0 auto 16px;
            background: white;
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(0,0,0,0.04);
        }
        
        .feature-title {
            font-weight: 700;
            font-size: 16px;
            margin-bottom: 8px;
            color: #1a1a1a;
        }
        
        .feature-desc {
            font-size: 13px;
            color: #94a3b8;
            line-height: 1.5;
        }
        
        /* 更新日志时间轴 */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline-item {
    position: relative;
    padding-bottom: 32px;
    padding-left: 24px;
    border-left: 2px solid #e2e8f0;
}

.timeline-item:last-child {
    border-left-color: transparent;
}

.timeline-item.latest {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    margin: -16px -16px 0 -16px;
    padding: 24px 24px 32px 48px;
    border-radius: 16px;
    border-left: 3px solid #06b6d4;
}

.latest-badge {
    position: absolute;
    top: 8px;
    right: 16px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-badge {
    position: absolute;
    left: -16px;
    top: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 4px 8px rgba(6, 182, 212, 0.2);
}

.timeline-item.latest .timeline-badge {
    left: -18px;
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.timeline-content {
    padding-top: 4px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline-version {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 16px;
    color: #06b6d4;
}

.featured-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.timeline-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
}

.timeline-body {
    margin-top: 12px;
}

.timeline-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

.timeline-line img {
    flex-shrink: 0;
    margin-top: 2px;
}

@media (max-width: 768px) {
    .timeline-item {
        padding-left: 16px;
    }
    
    .timeline-item.latest {
        padding: 20px 16px 24px 36px;
    }
    
    .latest-badge {
        position: relative;
        top: 0;
        right: 0;
        display: inline-flex;
        margin-bottom: 12px;
    }
}
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 1024px) {
    .contact-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}
        
        /* ========== 系统要求 ========== */
        .requirements-table {
            width: 100%;
            border-collapse: collapse;
        }
        
        .requirements-table tr {
            border-bottom: 1px solid #f0f0f0;
        }
        
        .requirements-table td {
            padding: 14px 0;
        }
        
        .requirements-table td:first-child {
            font-weight: 600;
            color: #1e293b;
            width: 120px;
        }
        
        .requirements-table td:last-child {
            color: #64748b;
        }
        
        /* ========== 响应式 ========== */
        @media (max-width: 900px) {
            .app-container {
                flex-direction: column;
            }
            
            .app-sidebar {
                width: 100%;
                position: relative;
                top: 0;
                max-height: none;
            }
            
            .feature-grid {
                grid-template-columns: 1fr;
            }
            
            .app-showcase {
                justify-content: center;
                text-align: center;
            }
            
            .download-buttons {
                justify-content: center;
            }
        }
        
        @media (max-width: 640px) {
            .download-buttons {
                flex-direction: column;
            }
            
            .download-btn {
                justify-content: center;
            }
        }
        .faq-item .faq-answer {
    display: none;
}
.faq-item.active .faq-answer {
    display: block !important;
}
.faq-item.active .faq-question .icon img {
    transform: rotate(90deg);
}
.faq-question .icon img {
    transition: transform 0.3s;
}
    </style>
</head>
<body>
    <div class="app-container">
        <!-- 左侧目录树 -->
        <aside class="app-sidebar">
            <div class="sidebar-header">
                <h3>
                    <img src="https://api.iconify.design/mdi:cellphone-arrow-down.svg?color=%233b82f6" width="24" height="24" alt="">
                    APP下载
                </h3>
            </div>
            
            <ul class="tree-menu">
                <li class="tree-item">
                    <a href="#overview" class="tree-link active">
                        <span class="icon">
                            <img src="https://api.iconify.design/mdi:cellphone.svg?color=%233b82f6" width="20" height="20" alt="">
                        </span>
                        <span>APP介绍</span>
                    </a>
                </li>
                
                <li class="tree-item">
                    <a href="#features" class="tree-link">
                        <span class="icon">
                            <img src="https://api.iconify.design/mdi:star.svg?color=%23fbbf24" width="20" height="20" alt="">
                        </span>
                        <span>功能特性</span>
                    </a>
                </li>
                
                <li class="tree-item">
                    <a href="#screenshots" class="tree-link">
                        <span class="icon">
                            <img src="https://api.iconify.design/mdi:image-multiple.svg?color=%2310b981" width="20" height="20" alt="">
                        </span>
                        <span>界面预览</span>
                    </a>
                </li>
                
                <div class="tree-divider"></div>
                
                <li class="tree-item">
                    <a href="#changelog" class="tree-link">
                        <span class="icon">
                            <img src="https://api.iconify.design/mdi:newspaper.svg?color=%2306b6d4" width="20" height="20" alt="">
                        </span>
                        <span>更新日志</span>
                        <span class="tree-badge">NEW</span>
                    </a>
                </li>
                
                <li class="tree-item">
                    <a href="#requirements" class="tree-link">
                        <span class="icon">
                            <img src="https://api.iconify.design/mdi:cog.svg?color=%23647b8b" width="20" height="20" alt="">
                        </span>
                        <span>系统要求</span>
                    </a>
                </li>
                
                <li class="tree-item">
                    <a href="#faq" class="tree-link">
                        <span class="icon">
                            <img src="https://api.iconify.design/mdi:help-circle.svg?color=%23f59e0b" width="20" height="20" alt="">
                        </span>
                        <span>常见问题</span>
                    </a>
                </li>
            </ul>
        </aside>
        
        <!-- 右侧内容区 -->
        <main class="app-content">
            <!-- APP介绍 -->
            <div id="overview" class="content-card">
                <div class="page-header">
                    <div class="page-icon" style="background: transparent; border-radius: 28px;">
    <img src="/assets/app/applogo.png" alt="APP图标" style="width: 100%; height: 100%; object-fit: contain; border-radius: 28px;">
</div>
                    <div class="page-title">
                        <h1><?php echo htmlspecialchars($site_name); ?> APP</h1>
                        <p>随时随地，畅享便捷服务</p>
                    </div>
                </div>
                
                <div class="app-showcase">
                    <div class="app-icon-large" style="background: transparent; border-radius: 28px;">
    <img src="/assets/app/applogo.png" alt="APP图标" style="width: 100%; height: 100%; object-fit: contain; border-radius: 28px;">
</div>
                    <div class="app-info">
                        <h2 class="app-name"><?php echo htmlspecialchars($site_name); ?></h2>
                        <div class="app-version">
                            <img src="https://api.iconify.design/mdi:tag.svg?color=%2310b981" width="14" height="14" alt="">
                            版本 v<?php echo htmlspecialchars($app_version); ?>
                            <span style="margin: 0 6px;">·</span>
                            <img src="https://api.iconify.design/mdi:calendar.svg?color=%2310b981" width="14" height="14" alt="">
                            <?php echo htmlspecialchars($app_update_date); ?>
                        </div>
                        <p class="app-desc">
                            官方正版APP，支持扫码登录、授权管理、余额充值、订单查询等功能。
                            简洁高效的界面设计，让您随时随地管理您的授权服务。
                        </p>
                        
                        <div class="download-buttons">
                            <a href="<?php echo htmlspecialchars($android_download_url); ?>" class="download-btn android">
                                <img src="https://api.iconify.design/mdi:android.svg?color=white" width="24" height="24" alt="">
                                <div class="btn-text">
                                    <span class="btn-label">Android 下载</span>
                                    <span class="btn-platform">APK 安装包</span>
                                </div>
                            </a>
                           
                        </div>
                    </div>
                </div>
                
                <div class="qrcode-section">
                    <div class="qrcode-box">
                        <img src="/assets/app/qrcode.png" alt="APP下载二维码">
                    </div>
                    <div class="qrcode-tip">
                        <h4>
                            <img src="https://api.iconify.design/mdi:qrcode-scan.svg?color=%233b82f6" width="18" height="18" style="vertical-align: middle; margin-right: 6px;">
                            手机扫码下载
                        </h4>
                        <p>使用手机相机或浏览器扫描二维码，即可快速下载安装APP。支持 Android系统。</p>
                    </div>
                </div>
            </div>
            
            <!-- 功能特性 -->
            <div id="features" class="content-card">
                <div class="page-header">
                    <div class="page-icon" style="background: linear-gradient(135deg, #fbbf24, #f59e0b);">
                        <img src="https://api.iconify.design/mdi:star.svg?color=white" width="28" height="28" alt="">
                    </div>
                    <div class="page-title">
                        <h1>功能特性</h1>
                        <p>强大的功能，简洁的操作</p>
                    </div>
                </div>
                
                <div class="feature-grid">
                    <div class="feature-card">
                        <div class="feature-icon">
                            <img src="https://api.iconify.design/mdi:qrcode-scan.svg?color=%233b82f6" width="32" height="32" alt="">
                        </div>
                        <div class="feature-title">扫码登录</div>
                        <div class="feature-desc">手机扫码，一键登录平台，无需输入密码</div>
                    </div>
                    <div class="feature-card">
                        <div class="feature-icon">
                            <img src="https://api.iconify.design/mdi:key.svg?color=%2310b981" width="32" height="32" alt="">
                        </div>
                        <div class="feature-title">授权管理</div>
                        <div class="feature-desc">随时随地查看和管理您的授权信息</div>
                    </div>
                    <div class="feature-card">
                        <div class="feature-icon">
                            <img src="https://api.iconify.design/mdi:wallet.svg?color=%23f59e0b" width="32" height="32" alt="">
                        </div>
                        <div class="feature-title">余额充值</div>
                        <div class="feature-desc">支持多种支付方式，随时充值余额</div>
                    </div>
                    <div class="feature-card">
                        <div class="feature-icon">
                            <img src="https://api.iconify.design/mdi:bell.svg?color=%23ef4444" width="32" height="32" alt="">
                        </div>
                        <div class="feature-title">消息通知</div>
                        <div class="feature-desc">实时推送订单、授权到期等重要通知</div>
                    </div>
                    <div class="feature-card">
                        <div class="feature-icon">
                            <img src="https://api.iconify.design/mdi:history.svg?color=%238b5cf6" width="32" height="32" alt="">
                        </div>
                        <div class="feature-title">订单记录</div>
                        <div class="feature-desc">完整记录所有交易和消费明细</div>
                    </div>
                    <div class="feature-card">
                        <div class="feature-icon">
                            <img src="https://api.iconify.design/mdi:shield-check.svg?color=%2306b6d4" width="32" height="32" alt="">
                        </div>
                        <div class="feature-title">安全加密</div>
                        <div class="feature-desc">数据传输全程加密，保障账号安全</div>
                    </div>
                </div>
            </div>
            
            <!-- 界面预览 -->
            <div id="screenshots" class="content-card">
                <div class="page-header">
                    <div class="page-icon" style="background: linear-gradient(135deg, #10b981, #059669);">
                        <img src="https://api.iconify.design/mdi:image-multiple.svg?color=white" width="28" height="28" alt="">
                    </div>
                    <div class="page-title">
                        <h1>界面预览</h1>
                        <p>简洁美观，操作流畅</p>
                    </div>
                </div>
                
                <div style="display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; padding: 20px 0;">
                    <div style="text-align: center;">
                        <div style="width: 180px; height: 360px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 32px; display: flex; align-items: center; justify-content: center; box-shadow: 0 20px 40px rgba(0,0,0,0.15);">
                            <img src="/assets/app/index.jpg" width="100%" height="100%" alt="">
                        </div>
                        <p style="margin-top: 12px; color: #64748b; font-size: 13px;">首页</p>
                    </div>
                    <div style="text-align: center;">
                        <div style="width: 180px; height: 360px; background: linear-gradient(135deg, #3b82f6, #2563eb); border-radius: 32px; display: flex; align-items: center; justify-content: center; box-shadow: 0 20px 40px rgba(0,0,0,0.15);">
                            <img src="/assets/app/license.jpg" width="100%" height="100%" alt="">
                        </div>
                        <p style="margin-top: 12px; color: #64748b; font-size: 13px;">授权管理</p>
                    </div>
                    <div style="text-align: center;">
                        <div style="width: 180px; height: 360px; background: linear-gradient(135deg, #10b981, #059669); border-radius: 32px; display: flex; align-items: center; justify-content: center; box-shadow: 0 20px 40px rgba(0,0,0,0.15);">
                            <img src="/assets/app/user.jpg" width="100%" height="100%" alt="">
                        </div>
                        <p style="margin-top: 12px; color: #64748b; font-size: 13px;">个人中心</p>
                    </div>
                </div>
                <p style="text-align: center; color: #94a3b8; font-size: 13px; margin-top: 16px;">
                    <img src="https://api.iconify.design/mdi:image-outline.svg?color=%2394a3b8" width="14" height="14" style="vertical-align: middle; margin-right: 4px;">
                    以上为示意预览，实际以APP内为准
                </p>
            </div>
            
            <!-- 更新日志 -->
<div id="changelog" class="content-card">
    <div class="page-header">
        <div class="page-icon" style="background: linear-gradient(135deg, #06b6d4, #0891b2);">
            <img src="https://api.iconify.design/mdi:newspaper.svg?color=white" width="28" height="28" alt="">
        </div>
        <div class="page-title">
            <h1>更新日志</h1>
            <p>系统版本更新记录 · 新功能 · 优化 · 修复</p>
        </div>
    </div>
    
    <?php if (empty($changelog)): ?>
        <div style="text-align: center; padding: 40px; color: #94a3b8;">
            <img src="https://api.iconify.design/mdi:note-off.svg?color=%2394a3b8" width="48" height="48" alt="">
            <p style="margin-top: 16px;">暂无更新日志</p>
        </div>
    <?php else: ?>
        <div class="timeline">
            <?php foreach ($changelog as $index => $log): ?>
                <div class="timeline-item <?php echo $index === 0 ? 'latest' : ''; ?>">
                    <?php if ($index === 0): ?>
                        <div class="latest-badge">
                            <img src="https://api.iconify.design/mdi:star.svg?color=white" width="12" height="12" alt="">
                            最新
                        </div>
                    <?php endif; ?>
                    
                    
                    
                    <div class="timeline-content">
                        <div class="timeline-header">
                            <span class="timeline-version">
                                <img src="https://api.iconify.design/mdi:tag.svg?color=%2306b6d4" width="16" height="16" alt="">
                                v<?php echo htmlspecialchars($log['version']); ?>
                                <?php if (!empty($log['is_featured'])): ?>
                                    <span class="featured-tag">
                                        <img src="https://api.iconify.design/mdi:star.svg?color=%23f59e0b" width="12" height="12" alt="">
                                        重要更新
                                    </span>
                                <?php endif; ?>
                            </span>
                            <span class="timeline-date">
                                <img src="https://api.iconify.design/mdi:calendar.svg?color=%2394a3b8" width="14" height="14" alt="">
                                <?php echo htmlspecialchars($log['release_date'] ?? $log['created_at'] ?? ''); ?>
                            </span>
                        </div>
                        
                        <?php if (!empty($log['content'])): ?>
                            <div class="timeline-body">
                                <?php 
$content = $log['content'];
$lines = explode("\n", $content);
foreach ($lines as $line):
    $line = trim($line);
    if (empty($line)) continue;
    
    $icon = 'circle-small';
    $color = '#64748b';
    if (strpos($line, '新增') === 0 || strpos($line, '✨') === 0) {
        $icon = 'plus-circle';
        $color = '#10b981';
    } elseif (strpos($line, '修复') === 0 || strpos($line, '🐛') === 0) {
        $icon = 'bug';
        $color = '#ef4444';
    } elseif (strpos($line, '优化') === 0 || strpos($line, '🎨') === 0) {
        $icon = 'palette';
        $color = '#f59e0b';
    } elseif (strpos($line, '移除') === 0) {
        $icon = 'minus-circle';
        $color = '#dc2626';
    } elseif (strpos($line, '安全') === 0 || strpos($line, '🔒') === 0) {
        $icon = 'shield';
        $color = '#8b5cf6';
    }
?>
    <div class="timeline-line">
        <img src="https://api.iconify.design/mdi:<?php echo $icon; ?>.svg?color=<?php echo ltrim($color, '#'); ?>" width="16" height="16" alt="">
        <span style="color: <?php echo $color; ?>;"><?php echo htmlspecialchars($line); ?></span>
    </div>
<?php endforeach; ?>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>
</div>
            
            <!-- 系统要求 -->
            <div id="requirements" class="content-card">
                <div class="page-header">
                    <div class="page-icon" style="background: linear-gradient(135deg, #647b8b, #475569);">
                        <img src="https://api.iconify.design/mdi:cog.svg?color=white" width="28" height="28" alt="">
                    </div>
                    <div class="page-title">
                        <h1>系统要求</h1>
                        <p>请确保您的设备满足以下要求</p>
                    </div>
                </div>
                
                <table class="requirements-table">
                    <tr>
                        <td>
                            <img src="https://api.iconify.design/mdi:android.svg?color=%233b82f6" width="18" height="18" style="vertical-align: middle; margin-right: 8px;">
                            Android
                        </td>
                        <td>Android 8.0 及以上版本</td>
                    </tr>
                    
                    <tr>
                        <td>
                            <img src="https://api.iconify.design/mdi:memory.svg?color=%23f59e0b" width="18" height="18" style="vertical-align: middle; margin-right: 8px;">
                            存储空间
                        </td>
                        <td>至少 10MB 可用空间</td>
                    </tr>
                    <tr>
                        <td>
                            <img src="https://api.iconify.design/mdi:wifi.svg?color=%2310b981" width="18" height="18" style="vertical-align: middle; margin-right: 8px;">
                            网络
                        </td>
                        <td>需要互联网连接</td>
                    </tr>
                </table>
            </div>
            
            <!-- 常见问题 -->
            <div id="faq" class="content-card">
                <div class="page-header">
                    <div class="page-icon" style="background: linear-gradient(135deg, #f59e0b, #d97706);">
                        <img src="https://api.iconify.design/mdi:help-circle.svg?color=white" width="28" height="28" alt="">
                    </div>
                    <div class="page-title">
                        <h1>常见问题</h1>
                        <p>关于APP的常见问题解答</p>
                    </div>
                </div>
                
                <div class="faq-list" style="margin-top: 20px;">
                    <div class="faq-item" style="border-bottom: 1px solid #f0f0f0;">
                        <div class="faq-question"  style="display: flex; align-items: center; gap: 14px; padding: 18px 0; cursor: pointer; font-weight: 600; color: #1a1a1a;">
                            <span class="icon" style="transition: transform 0.3s;">
                                <img src="https://api.iconify.design/mdi:chevron-right.svg?color=%233b82f6" width="18" height="18" alt="">
                            </span>
                            <span>APP 是否免费下载？</span>
                        </div>
                        <div class="faq-answer" style="padding: 0 0 18px 36px; color: #64748b; font-size: 14px; line-height: 1.7; display: none;">
                            是的，APP 完全免费下载使用。部分功能需要使用平台账号登录后使用。
                        </div>
                    </div>
                    <div class="faq-item" style="border-bottom: 1px solid #f0f0f0;">
                        <div class="faq-question"  style="display: flex; align-items: center; gap: 14px; padding: 18px 0; cursor: pointer; font-weight: 600; color: #1a1a1a;">
                            <span class="icon" style="transition: transform 0.3s;">
                                <img src="https://api.iconify.design/mdi:chevron-right.svg?color=%233b82f6" width="18" height="18" alt="">
                            </span>
                            <span>安装时提示"未知来源"怎么办？</span>
                        </div>
                        <div class="faq-answer" style="padding: 0 0 18px 36px; color: #64748b; font-size: 14px; line-height: 1.7; display: none;">
                            Android 用户请在「设置」→「安全」中开启「允许安装未知来源应用」，然后重新安装即可。
                        </div>
                    </div>
                    <div class="faq-item" style="border-bottom: 1px solid #f0f0f0;">
                        <div class="faq-question"  style="display: flex; align-items: center; gap: 14px; padding: 18px 0; cursor: pointer; font-weight: 600; color: #1a1a1a;">
                            <span class="icon" style="transition: transform 0.3s;">
                                <img src="https://api.iconify.design/mdi:chevron-right.svg?color=%233b82f6" width="18" height="18" alt="">
                            </span>
                            <span>APP 与网页版数据同步吗？</span>
                        </div>
                        <div class="faq-answer" style="padding: 0 0 18px 36px; color: #64748b; font-size: 14px; line-height: 1.7; display: none;">
                            是的，APP 与网页版数据完全同步，使用同一账号登录即可查看所有信息。
                        </div>
                    </div>
                    <div class="faq-item">
                        <div class="faq-question"  style="display: flex; align-items: center; gap: 14px; padding: 18px 0; cursor: pointer; font-weight: 600; color: #1a1a1a;">
                            <span class="icon" style="transition: transform 0.3s;">
                                <img src="https://api.iconify.design/mdi:chevron-right.svg?color=%233b82f6" width="18" height="18" alt="">
                            </span>
                            <span>iOS 版本什么时候上线？</span>
                        </div>
                        <div class="faq-answer" style="padding: 0 0 18px 36px; color: #64748b; font-size: 14px; line-height: 1.7; display: none;">
                            iOS 版本正在审核中，预计近期上线，敬请期待。
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>
    
    <?php include 'footer.php'; ?>
    
    <script>
document.addEventListener('DOMContentLoaded', function() {
    
    // ========== 平滑滚动 ==========
    document.querySelectorAll('.tree-link[href^="#"]').forEach(link => {
        link.addEventListener('click', function(e) {
            e.preventDefault();
            const target = document.querySelector(this.getAttribute('href'));
            if (target) {
                target.scrollIntoView({ behavior: 'smooth', block: 'start' });
            }
        });
    });
    
    // ========== 高亮当前目录 ==========
    const sections = document.querySelectorAll('[id]');
    const navLinks = document.querySelectorAll('.tree-link[href^="#"]');
    
    window.addEventListener('scroll', function() {
        let current = '';
        sections.forEach(section => {
            const sectionTop = section.offsetTop;
            if (scrollY >= sectionTop - 100) {
                current = section.getAttribute('id');
            }
        });
        
        navLinks.forEach(link => {
            link.classList.remove('active');
            if (link.getAttribute('href') === '#' + current) {
                link.classList.add('active');
            }
        });
    });
    
    // ========== FAQ 展开/收起 ==========
    document.querySelectorAll('.faq-question').forEach(q => {
        q.addEventListener('click', function(e) {
            e.stopPropagation(); // 防止事件冒泡
            
            const item = this.closest('.faq-item');
            const icon = this.querySelector('.icon img');
            const answer = item.querySelector('.faq-answer');
            
            console.log('FAQ clicked', item); // 调试用，可以删除
            
            // 切换当前FAQ的展开/收起状态
            if (item.classList.contains('active')) {
                // 收起
                item.classList.remove('active');
                if (answer) answer.style.display = 'none';
                if (icon) icon.style.transform = 'rotate(0deg)';
            } else {
                // 展开
                item.classList.add('active');
                if (answer) answer.style.display = 'block';
                if (icon) icon.style.transform = 'rotate(90deg)';
            }
        });
    });
    
    console.log('FAQ items found:', document.querySelectorAll('.faq-question').length); // 调试用
    
});
</script>
    
    <style>
.faq-item .faq-answer {
    display: none;
}
.faq-item.active .faq-answer {
    display: block !important;
}
.faq-item .faq-question {
    cursor: pointer;
}
.faq-question .icon img {
    transition: transform 0.3s;
}
    </style>
</body>
</html>