<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Access Denied - CGW Product Finder</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

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

        .access-denied-container {
            background: white;
            padding: 50px;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            text-align: center;
            max-width: 500px;
        }

        .icon {
            font-size: 80px;
            margin-bottom: 20px;
        }

        h1 {
            color: #f56565;
            margin-bottom: 15px;
            font-size: 32px;
        }

        .message {
            color: #666;
            margin-bottom: 10px;
            font-size: 16px;
            line-height: 1.6;
        }

        .permission-info {
            background: #fed7d7;
            color: #742a2a;
            padding: 12px;
            border-radius: 5px;
            margin: 20px 0;
            font-family: 'Courier New', monospace;
            font-size: 14px;
            border-left: 4px solid #f56565;
        }

        .btn {
            display: inline-block;
            padding: 12px 30px;
            margin: 10px 5px;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            text-decoration: none;
        }

        .btn-primary {
            background: #667eea;
            color: white;
        }

        .btn-primary:hover {
            background: #5568d3;
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #e0e0e0;
            color: #333;
        }

        .btn-secondary:hover {
            background: #d0d0d0;
            transform: translateY(-2px);
        }

        .contact-info {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 2px solid #e0e0e0;
            color: #999;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="access-denied-container">
        <div class="icon">🚫</div>
        <h1>Access Denied</h1>
        <p class="message">
            You do not have permission to access this page or perform this action.
        </p>
        
        {% if required_permission %}
        <div class="permission-info">
            Required Permission: <strong>{{ required_permission }}</strong>
        </div>
        {% endif %}
        
        <p class="message">
            If you believe this is an error, please contact your administrator.
        </p>

        <div style="margin-top: 30px;">
            <a href="javascript:history.back()" class="btn btn-secondary">← Go Back</a>
            <a href="{{ url_for('index') }}" class="btn btn-primary">Return to Home</a>
        </div>

        <div class="contact-info">
            Need help? Contact your system administrator to request access.
        </div>
    </div>
</body>
</html>
