<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

        @php
            $statusCode = $code
                ?? ((isset($exception) && method_exists($exception, 'getStatusCode')) ? $exception->getStatusCode() : null)
                ?? (http_response_code() ?: 500);
        @endphp

        <title>{{ config('site_title', '') }} - {{ $statusCode }}</title>

        <link rel="stylesheet" href="{{ URL::to('') }}/themes/idh/default/design/css/bootstrap.min.css">
        <link rel="stylesheet" href="{{ URL::to('') }}/themes/idh/default/design/css/main.css" defer="defer">
        <link rel="stylesheet" href="{{ URL::to('') }}/themes/idh/default/design/css/custom.css" defer="defer">

        <style>
            html, body { height: 100%; }
            body {
                margin: 0;
                background-color: #efeeee;
                background-image: url('https://mspost.idhubs.com/uploads/users/10743/community/themes/VKy25XDM5pGdbSfWFcHM6TwX4t2RgiTl.jpg');
                background-repeat: no-repeat;
                background-position: center center;
                background-attachment: fixed;
                background-size: cover;
            }
            .error-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 30px 15px; }
            .error-card { width: 100%; max-width: 560px; min-height: 240px; background: #fff; border: 1px solid #eee; border-radius: 14px; padding: 44px 28px; text-align: center; box-shadow: 0 18px 45px rgba(0,0,0,0.12); }
            .error-title { font-size: 22px; font-weight: 700; margin: 0 0 8px 0; }
            .error-msg { font-size: 14px; color: #666; margin: 0 0 18px 0; }
            .error-actions .btn { margin: 0 6px 8px 6px; min-width: 120px; }
        </style>
    </head>

    <body>
        @php
            $currentUrl = url()->current();
            $supportUrl = 'https://idhubs.com/c/75/survey/support';
        @endphp

        <div class="error-wrap">
            <div class="error-card">
                <h1 class="error-title">{{ $title ?? 'Something went wrong' }}</h1>
                <p class="error-msg">{{ $message ?? 'Please try again.' }}</p>

                <div class="error-actions">
                    <a class="btn btn-primary" href="{{ $currentUrl }}" onclick="window.location.reload(); return false;">Try Again</a>
                    <a class="btn btn-default" href="{{ url('/') }}">Go Home</a>
                    <a class="btn btn-default" href="{{ $supportUrl }}" target="_blank" rel="noopener noreferrer">Contact Support</a>
                </div>
            </div>
        </div>
    </body>
</html>
