<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Elfit Arabia - Registration</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="stylesheet" href="/style.css">
    <style>
        body {
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
            background-attachment: fixed;
            color: #f8fafc;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
            padding: 20px;
        }

        .registration-container {
            background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
            padding: 2.5rem;
            border-radius: 16px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
            max-width: 520px;
            width: 100%;
            border: 1px solid #475569;
        }

        h2 {
            color: #f8fafc;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }

        h2 span {
            background: linear-gradient(135deg, #60a5fa 0%, #93c5fd 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .form-label {
            color: #cbd5e1;
            font-weight: 500;
        }

        .form-control {
            background-color: #334155;
            border: 1px solid #475569;
            color: #f8fafc;
            border-radius: 8px;
            padding: 12px 16px;
        }

        .form-control::placeholder {
            color: #94a3b8;
        }

        .form-control:focus {
            background-color: #475569;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
            color: #f8fafc;
        }

        .btn-primary {
            background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
            border: none;
            font-weight: 600;
            border-radius: 8px;
            padding: 12px 20px;
            transition: all 0.2s ease;
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        }

        .alert-success {
            background-color: rgba(34, 197, 94, 0.15);
            border: 1px solid #22c55e;
            border-left: 4px solid #22c55e;
            color: #86efac;
            border-radius: 8px;
        }

        .alert-danger {
            background-color: rgba(239, 68, 68, 0.15);
            border: 1px solid #ef4444;
            border-left: 4px solid #ef4444;
            color: #fca5a5;
            border-radius: 8px;
        }

        .login-link {
            text-align: center;
            margin-top: 1.5rem;
            color: #94a3b8;
        }

        .login-link a {
            color: #60a5fa;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.2s ease;
        }

        .login-link a:hover {
            color: #93c5fd;
            text-decoration: underline;
        }

        .required-note {
            font-size: 0.85rem;
            color: #94a3b8;
            margin-bottom: 1.5rem;
        }
    </style>
</head>

<body>
    <div class="registration-container">
        <h2 class="text-center mb-2"><i class="fas fa-user-plus me-2"></i><span>Elfit Arabia</span></h2>
        <p class="text-center text-muted mb-4">Create your B2B account</p>

        <p class="required-note text-center"><i class="fas fa-info-circle me-1"></i> Fields marked with * are required
        </p>

        <!-- Flash Messages -->
        <% const messages=getFlashedMessages(true); %>
            <% if (messages && messages.length> 0) { %>
                <% messages.forEach(function(msg) { %>
                    <div class="alert alert-<%= msg.category === 'success' ? 'success' : 'danger' %>" role="alert">
                        <i
                            class="fas fa-<%= msg.category === 'success' ? 'check-circle' : 'exclamation-circle' %> me-2"></i>
                        <%= msg.message %>
                    </div>
                    <% }); %>
                        <% } %>

                            <form method="POST" class="mb-4">
                                <div class="mb-3">
                                    <label for="email" class="form-label"><i class="fas fa-envelope me-1"></i> Email
                                        Address *</label>
                                    <input type="email" name="email" id="email" class="form-control"
                                        placeholder="Enter your email" value="<%= request.form.email || '' %>" required>
                                </div>

                                <div class="mb-3">
                                    <label for="client_name" class="form-label"><i class="fas fa-user me-1"></i> Full
                                        Name *</label>
                                    <input type="text" name="client_name" id="client_name" class="form-control"
                                        placeholder="Enter your full name" value="<%= request.form.client_name || '' %>"
                                        required>
                                </div>

                                <div class="mb-3">
                                    <label for="phone" class="form-label"><i class="fas fa-phone me-1"></i> Phone Number
                                        *</label>
                                    <input type="tel" name="phone" id="phone" class="form-control"
                                        placeholder="Enter your phone number" value="<%= request.form.phone || '' %>"
                                        required>
                                </div>

                                <div class="mb-3">
                                    <label for="address" class="form-label"><i class="fas fa-map-marker-alt me-1"></i>
                                        Address</label>
                                    <textarea name="address" id="address" class="form-control" rows="3"
                                        placeholder="Enter your address (optional)"><%= request.form.address || '' %></textarea>
                                </div>

                                <div class="mb-3">
                                    <label for="company" class="form-label"><i class="fas fa-building me-1"></i>
                                        Company</label>
                                    <input type="text" name="company" id="company" class="form-control"
                                        placeholder="Enter your company name (optional)"
                                        value="<%= request.form.company || '' %>">
                                </div>

                                <button type="submit" class="btn btn-primary w-100">
                                    <i class="fas fa-paper-plane me-1"></i> Register
                                </button>
                            </form>

                            <div class="login-link">
                                <p>Already have an account? <a href="/"><i class="fas fa-sign-in-alt me-1"></i>Login
                                        here</a></p>
                            </div>
    </div>

    <script>
        setTimeout(function () {
            const flashMessages = document.querySelectorAll('.alert');
            flashMessages.forEach(msg => {
                msg.style.transition = 'opacity 0.5s';
                msg.style.opacity = '0';
                setTimeout(() => msg.remove(), 500);
            });
        }, 5000);
    </script>
</body>

</html>