<?php
/**
 * Rate Limit 503 Throttle Page View
 *
 * Displayed when a visitor is being throttled due to rate limiting violations.
 * Shows a 503 Service Unavailable page with retry information.
 *
 * @package VMPFence
 * @since 2.0.0
 *
 * @var array $violation Violation data containing count, limit, type, etc.
 */

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

// Set 503 status and retry header
status_header(503);
header('Retry-After: 60');

// Load custom block text from configuration
$custom_text = VMPFence_Config::get('custom_block_text');
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Service Temporarily Unavailable</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            margin: 0;
            padding: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
        }
        .container {
            background: white;
            border-radius: 10px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.2);
            max-width: 500px;
            padding: 40px;
            text-align: center;
        }
        h1 {
            color: #333;
            font-size: 24px;
            margin: 0 0 20px 0;
        }
        p {
            color: #666;
            line-height: 1.6;
            margin: 0 0 15px 0;
        }
        .message {
            background: #f8f9fa;
            border-left: 4px solid #667eea;
            padding: 15px;
            margin: 20px 0;
            text-align: left;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>🚦 Service Temporarily Unavailable</h1>
        <p>The server is temporarily unable to handle your request due to high traffic.</p>
        <?php if (!empty($custom_text)): ?>
        <div class="message"><?php echo esc_html($custom_text); ?></div>
        <?php endif; ?>
        <p><strong>Please try again in a moment.</strong></p>
    </div>
</body>
</html>
