<?php
/**
 * @var \App\View\AppView $this
 * @var string $message
 * @var string $url
 */
use Cake\Core\Configure;
use Cake\Error\Debugger;

$this->setLayout('error');

if (Configure::read('debug')) :
    $this->setLayout('dev_error');

    $this->assign('title', $message);
    $this->assign('templateName', 'error500.php');

    $this->start('file');
?>
<?php if ($error instanceof Error) : ?>
    <?php $file = $error->getFile() ?>
    <?php $line = $error->getLine() ?>
    <strong>Error in: </strong>
    <?= $this->Html->link(sprintf('%s, line %s', Debugger::trimPath($file), $line), Debugger::editorUrl($file, $line)); ?>
<?php endif; ?>
<?php
    echo $this->element('auto_table_warning');

    $this->end();
endif;
?>
<section class="cc-error-hero">
    <div class="cc-error-code">500</div>
    <h1>Something on our end broke.</h1>
    <p>Sorry about that. Our team has been notified — please try again in a moment, or jump back to the home page.</p>
    <?php if (Configure::read('debug') && !empty($message)): ?>
        <pre style="background: #FAF8F5; padding: 16px; border-radius: 8px; margin: 16px auto 24px; max-width: 600px; text-align: left; font-size: 13px; overflow-x: auto;"><?= h($message) ?></pre>
    <?php endif; ?>
    <div class="cc-error-ctas">
        <a class="cc-btn cc-btn--primary" href="/">Back to home</a>
        <a class="cc-btn cc-btn--outline" href="/contact">Send an enquiry</a>
    </div>
</section>
