<?php
/**
 * 芋头CMS - 家具定制企业网站模板 - 文章详情
 */
if (!defined('ROOT_PATH')) { exit('Access Denied'); }
if (!isset($article) && isset($id) && $id > 0) {
    $article = $db->fetch("SELECT a.*, c.channel_name FROM {$db->table('article')} a LEFT JOIN {$db->table('channel')} c ON a.channel_id=c.id WHERE a.id=? AND a.status=1", [$id]);
}
$pageTitle = htmlspecialchars($article['title'] ?? '文章详情');
$extraHead = '<style>.article-detail-body { padding-top: 70px; }</style>';

require_once __DIR__ . '/../_header.php';
?>
<div class="article-detail-body">
<div style="height:280px;background:linear-gradient(135deg,var(--dark) 0%,var(--primary-dark) 100%);display:flex;align-items:center;justify-content:center;margin-top:70px;">
<div style="text-align:center;color:white;">
<h1 style="font-size:32px;margin-bottom:10px;"><?php echo htmlspecialchars($article['title'] ?? ''); ?></h1>
<p style="opacity:0.7;font-size:13px;">
发布时间：<?php echo !empty($article['create_time']) ? date('Y-m-d', $article['create_time']) : ''; ?>
&nbsp;|&nbsp;浏览：<?php echo intval($article['view'] ?? 0); ?> 次
</p>
</div>
</div>

<div class="section">
<div class="container" style="max-width:860px;">
<div style="background:white;padding:40px;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,0.06);">
<div style="line-height:1.9;font-size:16px;color:#444;">
<?php echo isset($article['content']) ? $article['content'] : ''; ?>
</div>
<div style="margin-top:30px;padding-top:20px;border-top:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;">
<a href="javascript:history.back();" style="padding:10px 24px;background:var(--dark);color:white;border-radius:4px;font-size:14px;">‹ 返回列表</a>
</div>
</div>
</div>
</div>

<?php require_once __DIR__ . '/../_footer.php'; ?>