Spaces:
Running

File size: 10,310 Bytes
89b2aec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TaxWizard Pro - Login</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
    <style>
        #vanta-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.15;
        }
        .auth-card {
            max-width: 28rem;
            margin: 0 auto;
        }
        .social-btn {
            transition: all 0.2s ease;
        }
        .social-btn:hover {
            transform: translateY(-2px);
        }
    </style>
</head>
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex items-center justify-center p-4">
    <div id="vanta-bg" class="dark:opacity-30"></div>
    
    <!-- Theme Toggle -->
    <button id="themeToggle" class="fixed top-4 right-4 z-50 p-2 rounded-full bg-white dark:bg-gray-800 shadow-lg">
        <i data-feather="moon" class="hidden dark:block text-yellow-300"></i>
        <i data-feather="sun" class="dark:hidden text-yellow-500"></i>
    </button>

    <!-- Main Auth Card -->
    <div class="auth-card bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 w-full">
        <div class="p-8">
            <div class="text-center mb-8">
                <div class="flex justify-center items-center mb-4">
                    <div class="bg-blue-100 dark:bg-blue-900 p-3 rounded-full">
                        <i data-feather="dollar-sign" class="text-blue-600 dark:text-blue-400 w-8 h-8"></i>
                    </div>
                    <span class="ml-2 text-xs font-semibold bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200 px-2 py-1 rounded-full">BETA</span>
                </div>
                <h1 class="text-2xl font-bold mb-1">Welcome back</h1>
                <p class="text-gray-600 dark:text-gray-400">Sign in to your TaxWizard Pro account</p>
            </div>

            <!-- Error Messages -->
            <div id="authError" class="hidden bg-red-100 dark:bg-red-900/50 border-l-4 border-red-500 dark:border-red-400 p-4 mb-6">
                <div class="flex items-center">
                    <i data-feather="alert-circle" class="h-5 w-5 text-red-500 dark:text-red-400 mr-3"></i>
                    <p id="errorMessage" class="text-sm text-red-700 dark:text-red-300"></p>
                </div>
            </div>

            <!-- Login Form -->
            <form id="loginForm" class="space-y-4">
                <div>
                    <label for="email" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label>
                    <input type="email" id="email" name="email" required 
                        class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"
                        placeholder="you@example.com">
                    <p id="emailError" class="hidden mt-1 text-sm text-red-600 dark:text-red-400"></p>
                </div>
                <div>
                    <label for="password" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label>
                    <input type="password" id="password" name="password" required 
                        class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"
                        placeholder="••••••••">
                    <p id="passwordError" class="hidden mt-1 text-sm text-red-600 dark:text-red-400"></p>
                </div>
                <div class="flex items-center justify-between">
                    <div class="flex items-center">
                        <input id="remember" name="remember" type="checkbox" 
                            class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700">
                        <label for="remember" class="ml-2 block text-sm text-gray-700 dark:text-gray-300">Remember me</label>
                    </div>
                    <a href="forgot-password.html" class="text-sm text-blue-600 dark:text-blue-400 hover:underline">Forgot password?</a>
                </div>
                <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg font-medium transition">
                    Sign In
                </button>
            </form>

            <!-- Social Login (Optional) -->
            <div class="mt-6">
                <div class="relative">
                    <div class="absolute inset-0 flex items-center">
                        <div class="w-full border-t border-gray-300 dark:border-gray-600"></div>
                    </div>
                    <div class="relative flex justify-center text-sm">
                        <span class="px-2 bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400">Or continue with</span>
                    </div>
                </div>
                <div class="mt-6 grid grid-cols-2 gap-3">
                    <a href="#" class="social-btn w-full inline-flex justify-center py-2 px-4 border border-gray-300 dark:border-gray-600 rounded-lg shadow-sm bg-white dark:bg-gray-700 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600">
                        <i data-feather="github" class="h-5 w-5"></i>
                        <span class="ml-2">GitHub</span>
                    </a>
                    <a href="#" class="social-btn w-full inline-flex justify-center py-2 px-4 border border-gray-300 dark:border-gray-600 rounded-lg shadow-sm bg-white dark:bg-gray-700 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600">
                        <i data-feather="google" class="h-5 w-5"></i>
                        <span class="ml-2">Google</span>
                    </a>
                </div>
            </div>

            <div class="mt-6 text-center text-sm text-gray-600 dark:text-gray-400">
                Don't have an account? <a href="signup.html" class="text-blue-600 dark:text-blue-400 hover:underline">Sign up</a>
            </div>
        </div>
    </div>

    <script>
        feather.replace();
        
        // Initialize Vanta.js
        VANTA.GLOBE({
            el: "#vanta-bg",
            mouseControls: true,
            touchControls: true,
            gyroControls: false,
            minHeight: 200.00,
            minWidth: 200.00,
            scale: 1.00,
            scaleMobile: 1.00,
            color: 0x3b82f6,
            backgroundColor: 0xffffff,
            size: 0.8
        });

        // Theme toggle functionality
        const themeToggle = document.getElementById('themeToggle');
        const html = document.documentElement;
        
        themeToggle.addEventListener('click', () => {
            html.classList.toggle('dark');
            localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light');
            
            // Update Vanta.js background for theme
            if (html.classList.contains('dark')) {
                VANTA.GLOBE({
                    el: "#vanta-bg",
                    color: 0x3b82f6,
                    backgroundColor: 0x111827
                });
            } else {
                VANTA.GLOBE({
                    el: "#vanta-bg",
                    color: 0x3b82f6,
                    backgroundColor: 0xffffff
                });
            }
        });

        // Check for saved theme preference
        if (localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
            html.classList.add('dark');
            VANTA.GLOBE({
                el: "#vanta-bg",
                color: 0x3b82f6,
                backgroundColor: 0x111827
            });
        }

        // Form validation
        document.getElementById('loginForm').addEventListener('submit', function(e) {
            e.preventDefault();
            
            const email = document.getElementById('email').value;
            const password = document.getElementById('password').value;
            let isValid = true;

            // Reset errors
            document.getElementById('authError').classList.add('hidden');
            document.getElementById('emailError').classList.add('hidden');
            document.getElementById('passwordError').classList.add('hidden');

            // Email validation
            if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
                document.getElementById('emailError').textContent = 'Please enter a valid email address';
                document.getElementById('emailError').classList.remove('hidden');
                isValid = false;
            }

            // Password validation
            if (!password || password.length < 8) {
                document.getElementById('passwordError').textContent = 'Password must be at least 8 characters';
                document.getElementById('passwordError').classList.remove('hidden');
                isValid = false;
            }

            if (isValid) {
                // Simulate login
                document.getElementById('loginForm').querySelector('button[type="submit"]').disabled = true;
                document.getElementById('loginForm').querySelector('button[type="submit"]').innerHTML = '<i data-feather="loader" class="animate-spin w-4 h-4 mx-auto"></i>';

                setTimeout(() => {
                    // For demo purposes, redirect to index.html
                    window.location.href = 'index.html';
                }, 1500);
            }
        });

        // Re-render icons after form submission
        document.addEventListener('feather.replace', function() {
            feather.replace();
        });
    </script>
</body>
</html>