<?php

renderErrorPage('Payment Verification Failed', 'We were unable to verify your payment. Please complete the payment to activate your subscription and access our services.');

function renderErrorPage(string $title, string $message): void
{
?>
    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title><?= htmlspecialchars($title); ?></title>
        <style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }

            body {
                font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                min-height: 100vh;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 20px;
            }

            .container {
                background: white;
                border-radius: 12px;
                box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
                max-width: 500px;
                width: 100%;
                padding: 40px;
                text-align: center;
            }

            .icon {
                width: 80px;
                height: 80px;
                margin: 0 auto 20px;
                border-radius: 50%;
                background: #f8d7da;
                color: #dc3545;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 40px;
            }

            h1 {
                color: #333;
                margin-bottom: 15px;
                font-size: 28px;
            }

            p {
                color: #666;
                margin-bottom: 20px;
                line-height: 1.6;
            }

            .btn {
                display: inline-block;
                padding: 12px 30px;
                background: #667eea;
                color: white;
                text-decoration: none;
                border-radius: 6px;
                font-weight: 600;
                transition: background 0.3s;
            }

            .btn:hover {
                background: #5568d3;
            }
        </style>
    </head>

    <body>
        <div class="container">
            <div class="icon">✕</div>
            <h1><?= htmlspecialchars($title); ?></h1>
            <p><?= htmlspecialchars($message); ?></p>
            <a href="/" class="btn">Return to Home</a>
        </div>
    </body>

    </html>
<?php
}
