<?php
/** Halaman error generik (dipanggil oleh Response::abort). */
use App\Core\Settings;
use App\Core\Url;

$icons = [403 => 'shield-lock', 404 => 'compass', 405 => 'slash-circle', 419 => 'clock-history',
          422 => 'exclamation-diamond', 429 => 'hourglass', 500 => 'bug'];
$icon = $icons[$code] ?? 'exclamation-triangle';
?><!DOCTYPE html>
<html lang="id"><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= (int)$code ?> — <?= htmlspecialchars((string)$title, ENT_QUOTES, 'UTF-8') ?></title>
<link href="<?= Url::asset('vendor/bootstrap.min.css') ?>" rel="stylesheet">
<link href="<?= Url::asset('vendor/bootstrap-icons.css') ?>" rel="stylesheet">
<link href="<?= Url::asset('css/app.css') ?>" rel="stylesheet">
</head><body class="login-page">
<div class="login-card" style="max-width:520px">
  <div class="login-head">
    <i class="bi bi-<?= $icon ?>" style="font-size:46px;color:#1f3864"></i>
    <h1 style="margin-top:.5rem"><?= (int)$code ?> &middot; <?= htmlspecialchars((string)$title, ENT_QUOTES, 'UTF-8') ?></h1>
    <p><?= htmlspecialchars((string)($message ?: 'Terjadi kesalahan saat memproses permintaan Anda.'), ENT_QUOTES, 'UTF-8') ?></p>
  </div>
  <div class="login-body text-center pb-4 d-flex gap-2 justify-content-center">
    <a class="btn btn-primary" href="<?= Url::to('/') ?>"><i class="bi bi-house me-1"></i>Kembali ke Dashboard</a>
    <button class="btn btn-light" type="button" onclick="history.back()">Halaman Sebelumnya</button>
  </div>
  <div class="login-foot">
    <?= htmlspecialchars(Settings::str('umum.nama_perusahaan', ''), ENT_QUOTES, 'UTF-8') ?> &middot; SIPIUTANG
  </div>
</div>
</body></html>
