<?php
/**
 * 芋头CMS - 招聘详情页
 */
if (!defined('ROOT_PATH')) { exit('Access Denied'); }

if (!isset($recruit) && isset($id) && $id > 0) {
    $recruit = $db->fetch("SELECT r.*, c.channel_name FROM {$db->table('recruit')} r LEFT JOIN {$db->table('channel')} c ON r.channel_id=c.id WHERE r.id=? AND r.status=1", [$id]);
}
if (!$recruit) {
    echo '<div style="padding:100px;text-align:center;">该信息不存在或已下架</div>';
    require_once __DIR__ . '/../_footer.php';
    exit;
}
$pageTitle = htmlspecialchars($recruit['title']);

require_once __DIR__ . '/../_header.php';
?>

<div style="padding-top:70px;">
<div style="height:280px;background:linear-gradient(135deg,var(--dark) 0%,var(--primary-dark) 100%);display:flex;align-items:center;justify-content:center;">
<div style="text-align:center;color:white;">
<h1 style="font-size:36px;margin-bottom:10px;">人才招聘</h1>
</div>
</div>

<section class="section">
<div class="container" style="max-width:860px;">
<div style="background:#fff;border-radius:12px;padding:40px;box-shadow:0 2px 12px rgba(0,0,0,0.06);">

<div style="border-bottom:2px solid var(--border);padding-bottom:20px;margin-bottom:24px;">
<h2 style="font-size:24px;color:var(--dark);margin-bottom:16px;"><?php echo htmlspecialchars($recruit['title']); ?></h2>
<div style="display:flex;gap:20px;flex-wrap:wrap;font-size:14px;color:var(--gray);">
<?php if (!empty($recruit['department'])): ?><span>📌 部门：<?php echo htmlspecialchars($recruit['department']); ?></span><?php endif; ?>
<?php if (!empty($recruit['region'])): ?><span>📍 工作地点：<?php echo htmlspecialchars($recruit['region']); ?></span><?php endif; ?>
<?php if (!empty($recruit['work_type'])): ?><span>💼 工作性质：<?php echo htmlspecialchars($recruit['work_type']); ?></span><?php endif; ?>
<?php if (!empty($recruit['salary'])): ?><span style="color:var(--primary);font-weight:700;">💰 薪资：<?php echo htmlspecialchars($recruit['salary']); ?></span><?php endif; ?>
</div>
</div>

<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:30px;">
<?php if (!empty($recruit['experience'])): ?>
<div style="padding:16px;background:var(--bg-light);border-radius:8px;">
<div style="font-size:13px;color:var(--gray-light);margin-bottom:4px;">经验要求</div>
<div style="font-size:15px;color:var(--dark);font-weight:500;"><?php echo htmlspecialchars($recruit['experience']); ?></div>
</div>
<?php endif; ?>
<?php if (!empty($recruit['education'])): ?>
<div style="padding:16px;background:var(--bg-light);border-radius:8px;">
<div style="font-size:13px;color:var(--gray-light);margin-bottom:4px;">学历要求</div>
<div style="font-size:15px;color:var(--dark);font-weight:500;"><?php echo htmlspecialchars($recruit['education']); ?></div>
</div>
<?php endif; ?>
<?php if (!empty($recruit['quantity'])): ?>
<div style="padding:16px;background:var(--bg-light);border-radius:8px;">
<div style="font-size:13px;color:var(--gray-light);margin-bottom:4px;">招聘人数</div>
<div style="font-size:15px;color:var(--dark);font-weight:500;"><?php echo htmlspecialchars($recruit['quantity']); ?> 人</div>
</div>
<?php endif; ?>
</div>

<?php if (!empty($recruit['content'])): ?>
<div style="line-height:1.9;font-size:15px;color:var(--text);margin-bottom:30px;">
<h3 style="font-size:18px;color:var(--dark);margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid var(--border);">职位详情</h3>
<div style="padding-top:10px;"><?php echo $recruit['content']; ?></div>
</div>
<?php endif; ?>

<div style="text-align:center;padding-top:20px;">
<a href="javascript:history.back();" style="display:inline-block;padding:12px 30px;background:var(--dark);color:#fff;border-radius:6px;font-size:15px;text-decoration:none;">返回列表</a>
</div>

</div>
</div>
</section>
</div>

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