<?php
require __DIR__ . '/app/bootstrap.php';
require __DIR__ . '/app/layout.php';
$terms=active_platform_terms();
render_public_header('Termos e políticas');
?>
<section class="section" style="padding-top:45px;max-width:980px">
  <div class="section-head"><span>DOCUMENTOS DA PLATAFORMA</span><h1>Termos e políticas</h1><p>Consulte os documentos atualmente publicados pela administração.</p><?php if(current_user()):?><div class="actions" style="margin-top:14px"><a class="btn btn-secondary" href="dashboard.php?page=home">← Voltar ao painel</a></div><?php endif;?></div>
  <?php if(!$terms):?><div class="panel"><div class="empty-state"><strong>Nenhum documento publicado</strong></div></div><?php endif;?>
  <?php foreach($terms as $term):?><article class="panel policy-document" id="term-<?= (int)$term['id'] ?>"><div class="panel-header"><div><h2><?= e($term['title']) ?></h2><p>Versão <?= (int)$term['version'] ?> • Atualizado em <?= e(date('d/m/Y H:i',strtotime($term['updated_at']))) ?></p></div><?= !empty($term['required'])?'<span class="status status-active">Obrigatório</span>':'' ?></div><div class="policy-content"><?= nl2br(e($term['content'])) ?></div></article><?php endforeach;?>
</section>
<?php render_public_footer(); ?>
