File size: 8,637 Bytes
4c38e52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sistema Integrado - Cadastro</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .fade-in {
            animation: fadeIn 0.3s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        .slide-in {
            animation: slideIn 0.3s ease-out;
        }
        @keyframes slideIn {
            from { transform: translateY(20px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }
        .password-strength {
            height: 4px;
            transition: all 0.3s;
        }
        .strength-0 { width: 0%; background-color: #ef4444; }
        .strength-1 { width: 25%; background-color: #ef4444; }
        .strength-2 { width: 50%; background-color: #f59e0b; }
        .strength-3 { width: 75%; background-color: #3b82f6; }
        .strength-4 { width: 100%; background-color: #10b981; }
    </style>
</head>
<body class="min-h-screen gradient-bg p-4 transition-all duration-300">

<!-- Main Container -->
<div class="flex items-center justify-center min-h-screen">
    <!-- Cadastro Card -->
    <div class="w-full max-w-md bg-white rounded-2xl shadow-xl p-8 slide-in">
        <div class="flex justify-center mb-6">
            <i class="fas fa-user-plus text-indigo-600 text-4xl"></i>
        </div>
        <h2 class="text-3xl font-bold text-center text-gray-800">Crie sua conta</h2>
        <p class="text-center text-gray-600 mb-6">Preencha os campos abaixo para se cadastrar</p>

        <form id="registerForm" class="space-y-5">
            <!-- Nome Completo -->
            <div>
                <label for="fullName" class="block mb-1 text-sm font-medium text-gray-700">Nome Completo</label>
                <input type="text" id="fullName" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-indigo-500" placeholder="Seu nome completo" required>
                <p id="nameError" class="hidden text-sm text-red-600 mt-1"></p>
            </div>

            <!-- Email -->
            <div>
                <label for="email" class="block mb-1 text-sm font-medium text-gray-700">E-mail</label>
                <input type="email" id="email" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-indigo-500" placeholder="seu@email.com" required>
                <p id="emailError" class="hidden text-sm text-red-600 mt-1"></p>
            </div>

            <!-- Senha -->
            <div>
                <label for="password" class="block mb-1 text-sm font-medium text-gray-700">Senha</label>
                <div class="relative">
                    <input type="password" id="password" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-indigo-500" placeholder="••••••••" required>
                    <button type="button" id="togglePassword" class="absolute right-3 top-1/2 transform -translate-y-1/2">
                        <i class="fas fa-eye text-gray-400"></i>
                    </button>
                </div>
                <div class="password-strength strength-0 mt-1 rounded-full" id="passwordStrength"></div>
                <div class="text-xs text-gray-500 mt-1" id="passwordTips">
                    A senha deve conter pelo menos 8 caracteres, incluindo letras maiúsculas, minúsculas, números e símbolos.
                </div>
                <p id="passwordError" class="hidden text-sm text-red-600 mt-1"></p>
            </div>

            <!-- Confirmar Senha -->
            <div>
                <label for="confirmPassword" class="block mb-1 text-sm font-medium text-gray-700">Confirmar Senha</label>
                <div class="relative">
                    <input type="password" id="confirmPassword" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-indigo-500" placeholder="••••••••" required>
                    <button type="button" id="toggleConfirmPassword" class="absolute right-3 top-1/2 transform -translate-y-1/2">
                        <i class="fas fa-eye text-gray-400"></i>
                    </button>
                </div>
                <p id="confirmPasswordError" class="hidden text-sm text-red-600 mt-1"></p>
            </div>

            <!-- Termos e Condições -->
            <div class="flex items-start">
                <div class="flex items-center h-5">
                    <input id="terms" type="checkbox" class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" required>
                </div>
                <div class="ml-3 text-sm">
                    <label for="terms" class="font-medium text-gray-700">Eu concordo com os</label>
                    <button type="button" class="text-indigo-600 hover:underline">Termos e Condições</button>
                </div>
            </div>
            <p id="termsError" class="hidden text-sm text-red-600 mt-1"></p>

            <!-- Botão de Cadastro -->
            <button type="submit" id="registerBtn" class="w-full py-3 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg flex items-center justify-center">
                <span id="registerText">Cadastrar</span>
                <i id="registerSpinner" class="fas fa-spinner fa-spin ml-2 hidden"></i>
            </button>

            <!-- Link para Login -->
            <p class="text-sm text-center text-gray-600">Já tem uma conta? 
                <a href="login.html" class="text-indigo-600 hover:underline">Faça login</a>
            </p>
        </form>
    </div>
</div>

<!-- Modal de Sucesso -->
<div id="successModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
    <div class="bg-white rounded-xl p-6 max-w-sm w-full mx-4 slide-in">
        <div class="flex justify-center mb-4">
            <i class="fas fa-check-circle text-green-500 text-5xl"></i>
        </div>
        <h3 class="text-xl font-bold text-center text-gray-800 mb-2">Cadastro realizado!</h3>
        <p class="text-center text-gray-600 mb-6">Sua conta foi criada com sucesso. Você será redirecionado para a página de login.</p>
        <button id="closeSuccessModal" class="w-full py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg">
            Ok
        </button>
    </div>
</div>

<script>
    // Elementos do DOM
    const registerForm = document.getElementById('registerForm');
    const fullNameInput = document.getElementById('fullName');
    const emailInput = document.getElementById('email');
    const passwordInput = document.getElementById('password');
    const confirmPasswordInput = document.getElementById('confirmPassword');
    const togglePasswordBtn = document.getElementById('togglePassword');
    const toggleConfirmPasswordBtn = document.getElementById('toggleConfirmPassword');
    const registerBtn = document.getElementById('registerBtn');
    const registerText = document.getElementById('registerText');
    const registerSpinner = document.getElementById('registerSpinner');
    const passwordStrength = document.getElementById('passwordStrength');
    const successModal = document.getElementById('successModal');
    const closeSuccessModal = document.getElementById('closeSuccessModal');

    // Mostrar/ocultar senha
    togglePasswordBtn.addEventListener('click', () => {
        const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
        passwordInput.setAttribute('type', type);
        togglePasswordBtn.innerHTML = type === 'password' ? '<i class="fas fa-eye text-gray-400"></i>' : '<i class="fas fa-eye-slash text-gray-400"></i>';
    });

    toggleConfirmPasswordBtn.addEventListener('click', () => {
        const type = confirmPasswordInput.getAttribute('type') === 'password' ? 'text' : 'password';
        confirmPasswordInput.setAttribute('type', type);
        toggleConfirmPasswordBtn.innerHTML = type === 'password' ? '<i class="fas fa-eye text-gray-400"></i>' : '<i class="fas fa-eye-slash text-gray-400"></i>';
    });

    // Validar força da senha em tempo real
    passwordInput.addEventListener('input', () => {
        const password = passwordInput.value;
        let strength = 0;})


</html>