Spaces:
Running

File size: 59,248 Bytes
33c13ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AgriCensus Pro - Agricultural Baseline Survey</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script>
        tailwind.config = {
            darkMode: 'class',
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#ecfdf5',
                            100: '#d1fae5',
                            200: '#a7f3d0',
                            300: '#6ee7b7',
                            400: '#34d399',
                            500: '#10b981',
                            600: '#059669',
                            700: '#047857',
                            800: '#065f46',
                            900: '#064e3b',
                        },
                        secondary: {
                            50: '#fffbeb',
                            100: '#fef3c7',
                            200: '#fde68a',
                            300: '#fcd34d',
                            400: '#fbbf24',
                            500: '#f59e0b',
                            600: '#d97706',
                            700: '#b45309',
                            800: '#92400e',
                            900: '#78350f',
                        }
                    }
                }
            }
        }
    </script>
</head>
<body class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-200 transition-colors duration-300">
    <!-- Navigation -->
    <nav class="bg-white dark:bg-gray-800 shadow-lg fixed w-full z-50">
        <div class="max-w-7xl mx-auto px-4">
            <div class="flex justify-between items-center h-16">
                <div class="flex items-center space-x-3">
                    <div class="bg-primary-500 p-2 rounded-lg">
                        <i data-feather="bar-chart-2" class="text-white w-6 h-6"></i>
                    </div>
                    <span class="font-bold text-xl text-gray-800 dark:text-white">AgriCensus Pro</span>
                </div>
                <div class="flex items-center space-x-4">
                    <button id="themeToggle" class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">
                        <i data-feather="moon" class="w-5 h-5"></i>
                    </button>
                    <div id="authButtons" class="flex items-center space-x-2">
                        <button onclick="showLoginModal()" class="bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 rounded-lg transition-colors">
                            Login
                        </button>
                    </div>
                    <div id="userMenu" class="hidden flex items-center space-x-3">
                        <span id="userName" class="text-sm font-medium"></span>
                        <button onclick="logout()" class="text-red-500 hover:text-red-600">
                            <i data-feather="log-out" class="w-5 h-5"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <main class="pt-16">
        <!-- Hero Section -->
        <section id="heroSection" class="min-h-screen flex items-center justify-center bg-gradient-to-br from-primary-50 to-secondary-50 dark:from-gray-900 dark:to-gray-800">
            <div class="max-w-7xl mx-auto px-4 py-20 text-center">
                <div class="mb-8">
                    <span class="inline-block bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 px-4 py-2 rounded-full text-sm font-semibold mb-4">
                        🌾 Province-Level Agricultural Survey
                    </span>
                    <h1 class="text-5xl md:text-7xl font-bold text-gray-900 dark:text-white mb-6 leading-tight">
                        Baseline Data Collection<br>
                        <span class="text-primary-500">Made Simple</span>
                    </h1>
                    <p class="text-xl text-gray-600 dark:text-gray-400 max-w-3xl mx-auto mb-8">
                        Comprehensive agricultural census platform for enumerators and administrators. 
                        Collect, manage, and analyze agricultural data with ease.
                    </p>
                </div>
                <div class="flex flex-wrap justify-center gap-4">
                    <button onclick="showEnumeratorRegister()" class="bg-primary-500 hover:bg-primary-600 text-white px-8 py-4 rounded-xl text-lg font-semibold transition-all transform hover:scale-105 shadow-lg">
                        <i data-feather="user-plus" class="inline w-5 h-5 mr-2"></i>
                        Become an Enumerator
                    </button>
                    <button onclick="showLoginModal()" class="bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-800 dark:text-white border-2 border-gray-200 dark:border-gray-700 px-8 py-4 rounded-xl text-lg font-semibold transition-all">
                        <i data-feather="log-in" class="inline w-5 h-5 mr-2"></i>
                        Login
                    </button>
                </div>
                
                <!-- Stats -->
                <div class="mt-16 grid grid-cols-2 md:grid-cols-4 gap-8">
                    <div class="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-lg">
                        <div class="text-3xl font-bold text-primary-500">50K+</div>
                        <div class="text-gray-600 dark:text-gray-400">Households Surveyed</div>
                    </div>
                    <div class="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-lg">
                        <div class="text-3xl font-bold text-secondary-500">200+</div>
                        <div class="text-gray-600 dark:text-gray-400">Active Enumerators</div>
                    </div>
                    <div class="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-lg">
                        <div class="text-3xl font-bold text-primary-500">15</div>
                        <div class="text-gray-600 dark:text-gray-400">Provinces Covered</div>
                    </div>
                    <div class="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-lg">
                        <div class="text-3xl font-bold text-secondary-500">98%</div>
                        <div class="text-gray-600 dark:text-gray-400">Data Accuracy</div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Dashboard Section (Hidden by default) -->
        <section id="dashboardSection" class="hidden min-h-screen bg-gray-50 dark:bg-gray-900">
            <div class="max-w-7xl mx-auto px-4 py-8">
                <!-- Dashboard Header -->
                <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-6 mb-6">
                    <div class="flex flex-wrap items-center justify-between gap-4">
                        <div>
                            <h2 class="text-2xl font-bold text-gray-900 dark:text-white">Survey Dashboard</h2>
                            <p class="text-gray-600 dark:text-gray-400">Manage your data collection assignments</p>
                        </div>
                        <button onclick="createNewSurvey()" class="bg-primary-500 hover:bg-primary-600 text-white px-6 py-3 rounded-xl font-semibold transition-colors">
                            <i data-feather="plus" class="inline w-5 h-5 mr-2"></i>
                            New Survey
                        </button>
                    </div>
                </div>

                <!-- Survey Cards Grid -->
                <div id="surveyGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                    <!-- Survey cards will be dynamically inserted here -->
                </div>
            </div>
        </section>

        <!-- Admin Dashboard (Hidden by default) -->
        <section id="adminSection" class="hidden min-h-screen bg-gray-50 dark:bg-gray-900">
            <div class="max-w-7xl mx-auto px-4 py-8">
                <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-6 mb-6">
                    <h2 class="text-2xl font-bold text-gray-900 dark:text-white">Admin Control Panel</h2>
                    <p class="text-gray-600 dark:text-gray-400">Manage enumerators, surveys, and data verification</p>
                </div>
                
                <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                    <!-- Enumerators Management -->
                    <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-6">
                        <h3 class="text-lg font-semibold mb-4 flex items-center">
                            <i data-feather="users" class="w-5 h-5 mr-2 text-primary-500"></i>
                            Enumerators
                        </h3>
                        <div id="enumeratorsList" class="space-y-3 max-h-96 overflow-y-auto">
                            <!-- Enumerators will be listed here -->
                        </div>
                    </div>
                    
                    <!-- Pending Surveys -->
                    <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-6">
                        <h3 class="text-lg font-semibold mb-4 flex items-center">
                            <i data-feather="clock" class="w-5 h-5 mr-2 text-secondary-500"></i>
                            Pending Verification
                        </h3>
                        <div id="pendingSurveysList" class="space-y-3 max-h-96 overflow-y-auto">
                            <!-- Pending surveys will be listed here -->
                        </div>
                    </div>
                    
                    <!-- Statistics -->
                    <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-6">
                        <h3 class="text-lg font-semibold mb-4 flex items-center">
                            <i data-feather="pie-chart" class="w-5 h-5 mr-2 text-primary-500"></i>
                            Survey Statistics
                        </h3>
                        <div id="adminStats" class="space-y-4">
                            <!-- Statistics will be shown here -->
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Login Modal -->
    <div id="loginModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50 flex items-center justify-center p-4">
        <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-md w-full p-8 transform transition-all">
            <div class="flex justify-between items-center mb-6">
                <h3 class="text-2xl font-bold text-gray-900 dark:text-white">Login</h3>
                <button onclick="closeLoginModal()" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
                    <i data-feather="x" class="w-6 h-6"></i>
                </button>
            </div>
            
            <div class="flex gap-4 mb-6">
                <button onclick="switchLoginType('enumerator')" id="enumLoginBtn" class="flex-1 py-2 px-4 rounded-lg bg-primary-500 text-white font-medium transition-colors">
                    Enumerator
                </button>
                <button onclick="switchLoginType('admin')" id="adminLoginBtn" class="flex-1 py-2 px-4 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 font-medium transition-colors">
                    Admin
                </button>
            </div>
            
            <form id="loginForm" onsubmit="handleLogin(event)">
                <div class="space-y-4">
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email / ID</label>
                        <input type="text" id="loginEmail" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label>
                        <input type="password" id="loginPassword" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all">
                    </div>
                </div>
                <button type="submit" class="w-full mt-6 bg-primary-500 hover:bg-primary-600 text-white py-3 rounded-lg font-semibold transition-colors">
                    Login
                </button>
            </form>
        </div>
    </div>

    <!-- Enumerator Registration Modal -->
    <div id="registerModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50 flex items-center justify-center p-4 overflow-y-auto">
        <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-2xl w-full p-8 my-8">
            <div class="flex justify-between items-center mb-6">
                <h3 class="text-2xl font-bold text-gray-900 dark:text-white">Enumerator Registration</h3>
                <button onclick="closeRegisterModal()" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
                    <i data-feather="x" class="w-6 h-6"></i>
                </button>
            </div>
            
            <form id="registerForm" onsubmit="handleRegister(event)">
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Full Name *</label>
                        <input type="text" name="fullName" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email *</label>
                        <input type="email" name="email" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Phone *</label>
                        <input type="tel" name="phone" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">College/Institution *</label>
                        <input type="text" name="college" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">College ID Number *</label>
                        <input type="text" name="collegeId" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password *</label>
                        <input type="password" name="password" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                    </div>
                </div>
                
                <div class="mb-4">
                    <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">College ID Card Photo *</label>
                    <div class="border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-6 text-center hover:border-primary-500 transition-colors cursor-pointer" onclick="document.getElementById('idCardPhoto').click()">
                        <i data-feather="upload" class="w-8 h-8 mx-auto text-gray-400 mb-2"></i>
                        <p class="text-sm text-gray-600 dark:text-gray-400">Click to upload College ID Card</p>
                        <input type="file" id="idCardPhoto" name="idCardPhoto" accept="image/*" required class="hidden" onchange="previewIdCard(this)">
                    </div>
                    <img id="idCardPreview" class="hidden mt-4 max-h-48 rounded-lg mx-auto">
                </div>
                
                <div class="flex items-start gap-3 mb-6">
                    <input type="checkbox" id="terms" required class="mt-1 w-4 h-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500">
                    <label for="terms" class="text-sm text-gray-600 dark:text-gray-400">
                        I confirm that all information provided is accurate and I agree to the terms of data collection. I understand that my College ID will be verified before account activation.
                    </label>
                </div>
                
                <button type="submit" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-3 rounded-lg font-semibold transition-colors">
                    Submit Registration
                </button>
            </form>
        </div>
    </div>

    <!-- Survey Form Modal -->
    <div id="surveyModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50 overflow-y-auto">
        <div class="min-h-screen py-8 px-4">
            <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-6xl mx-auto">
                <!-- Survey Header -->
                <div class="sticky top-0 bg-white dark:bg-gray-800 border-b dark:border-gray-700 rounded-t-2xl p-6 z-10">
                    <div class="flex flex-wrap items-center justify-between gap-4">
                        <div>
                            <h3 class="text-2xl font-bold text-gray-900 dark:text-white" id="surveyTitle">New Agricultural Survey</h3>
                            <p class="text-sm text-gray-600 dark:text-gray-400" id="surveySubtitle">Complete all sections to submit</p>
                        </div>
                        <div class="flex items-center gap-3">
                            <span id="surveyStatus" class="px-3 py-1 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200">
                                Draft
                            </span>
                            <button onclick="closeSurveyModal()" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
                                <i data-feather="x" class="w-6 h-6"></i>
                            </button>
                        </div>
                    </div>
                    
                    <!-- Progress Steps -->
                    <div class="mt-6">
                        <div class="flex items-center justify-between text-xs font-medium">
                            <div class="flex items-center gap-2">
                                <span id="step1Indicator" class="w-8 h-8 rounded-full bg-primary-500 text-white flex items-center justify-center">1</span>
                                <span class="hidden sm:inline text-primary-500">Admin & Geo</span>
                            </div>
                            <div class="flex-1 h-1 mx-2 bg-gray-200 dark:bg-gray-700 rounded">
                                <div id="progress1" class="h-full bg-primary-500 rounded transition-all duration-500" style="width: 0%"></div>
                            </div>
                            <div class="flex items-center gap-2">
                                <span id="step2Indicator" class="w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 flex items-center justify-center">2</span>
                                <span class="hidden sm:inline text-gray-500">Community</span>
                            </div>
                            <div class="flex-1 h-1 mx-2 bg-gray-200 dark:bg-gray-700 rounded">
                                <div id="progress2" class="h-full bg-primary-500 rounded transition-all duration-500" style="width: 0%"></div>
                            </div>
                            <div class="flex items-center gap-2">
                                <span id="step3Indicator" class="w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 flex items-center justify-center">3</span>
                                <span class="hidden sm:inline text-gray-500">Environment</span>
                            </div>
                            <div class="flex-1 h-1 mx-2 bg-gray-200 dark:bg-gray-700 rounded">
                                <div id="progress3" class="h-full bg-primary-500 rounded transition-all duration-500" style="width: 0%"></div>
                            </div>
                            <div class="flex items-center gap-2">
                                <span id="step4Indicator" class="w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 flex items-center justify-center">4</span>
                                <span class="hidden sm:inline text-gray-500">Soil & Climate</span>
                            </div>
                            <div class="flex-1 h-1 mx-2 bg-gray-200 dark:bg-gray-700 rounded">
                                <div id="progress4" class="h-full bg-primary-500 rounded transition-all duration-500" style="width: 0%"></div>
                            </div>
                            <div class="flex items-center gap-2">
                                <span id="step5Indicator" class="w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 flex items-center justify-center">5</span>
                                <span class="hidden sm:inline text-gray-500">Households</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Survey Form Content -->
                <form id="surveyForm" class="p-6">
                    <!-- Step 1: Administrative & Geo-Reference Data -->
                    <div id="step1" class="survey-step">
                        <div class="bg-primary-50 dark:bg-primary-900/20 rounded-xl p-4 mb-6">
                            <h4 class="text-lg font-semibold text-primary-700 dark:text-primary-300 flex items-center">
                                <i data-feather="map-pin" class="w-5 h-5 mr-2"></i>
                                1. Administrative & Geo-Reference Data
                            </h4>
                        </div>
                        
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Province Code *</label>
                                <input type="number" name="provinceCode" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">District Code *</label>
                                <input type="number" name="districtCode" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Municipality Code *</label>
                                <input type="number" name="municipalityCode" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Ward Code *</label>
                                <input type="number" name="wardCode" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div class="md:col-span-2">
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Community / Village Name *</label>
                                <input type="text" name="villageName" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                        </div>
                        
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">GPS Latitude *</label>
                                <input type="number" step="0.000001" name="gpsLat" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">GPS Longitude *</label>
                                <input type="number" step="0.000001" name="gpsLng" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Altitude (m)</label>
                                <input type="number" name="altitude" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                        </div>
                        
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Survey Round *</label>
                                <select name="surveyRound" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    <option value="">Select Round</option>
                                    <option value="baseline">Baseline</option>
                                    <option value="midline">Midline</option>
                                    <option value="endline">Endline</option>
                                </select>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Survey Date *</label>
                                <input type="date" name="surveyDate" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Enumerator ID</label>
                                <input type="text" name="enumeratorId" readonly class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-100 dark:bg-gray-600 text-gray-600 dark:text-gray-400">
                            </div>
                        </div>
                    </div>

                    <!-- Step 2: Community Profile -->
                    <div id="step2" class="survey-step hidden">
                        <div class="bg-secondary-50 dark:bg-secondary-900/20 rounded-xl p-4 mb-6">
                            <h4 class="text-lg font-semibold text-secondary-700 dark:text-secondary-300 flex items-center">
                                <i data-feather="users" class="w-5 h-5 mr-2"></i>
                                2. Community Profile (Aggregated)
                            </h4>
                        </div>
                        
                        <h5 class="font-medium text-gray-900 dark:text-white mb-4">2.1 Demographics</h5>
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Total Households *</label>
                                <input type="number" name="totalHouseholds" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Total Population *</label>
                                <input type="number" name="totalPopulation" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Agricultural Households *</label>
                                <input type="number" name="agriHouseholds" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Female-headed Households</label>
                                <input type="number" name="femaleHeadedHH" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Indigenous/Minority HH (%)</label>
                                <input type="number" step="0.01" name="indigenousHHPercent" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Average HH Size</label>
                                <input type="number" step="0.1" name="avgHHSize" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                        </div>
                    </div>

                    <!-- Step 3: Physical Environment -->
                    <div id="step3" class="survey-step hidden">
                        <div class="bg-green-50 dark:bg-green-900/20 rounded-xl p-4 mb-6">
                            <h4 class="text-lg font-semibold text-green-700 dark:text-green-300 flex items-center">
                                <i data-feather="globe" class="w-5 h-5 mr-2"></i>
                                3. Physical Environment Data
                            </h4>
                        </div>
                        
                        <h5 class="font-medium text-gray-900 dark:text-white mb-4">3.1 Geography</h5>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Agro-ecological Zone *</label>
                                <select name="agroEcologicalZone" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    <option value="">Select Zone</option>
                                    <option value="terai">Terai</option>
                                    <option value="hill">Hill</option>
                                    <option value="mountain">Mountain</option>
                                </select>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Terrain Type *</label>
                                <select name="terrainType" required class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    <option value="">Select Type</option>
                                    <option value="plain">Plain</option>
                                    <option value="sloping">Sloping</option>
                                    <option value="steep">Steep</option>
                                </select>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Slope (%)</label>
                                <input type="number" step="0.1" name="slopePercent" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div class="flex gap-4">
                                <label class="flex items-center gap-2">
                                    <input type="checkbox" name="floodProne" class="w-4 h-4 text-primary-500 rounded">
                                    <span class="text-sm text-gray-700 dark:text-gray-300">Flood Prone</span>
                                </label>
                                <label class="flex items-center gap-2">
                                    <input type="checkbox" name="droughtProne" class="w-4 h-4 text-primary-500 rounded">
                                    <span class="text-sm text-gray-700 dark:text-gray-300">Drought Prone</span>
                                </label>
                            </div>
                        </div>
                        
                        <h5 class="font-medium text-gray-900 dark:text-white mb-4">6. Agricultural Land Use (Community Level) - ha</h5>
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Total Geographical Area</label>
                                <input type="number" step="0.01" name="totalGeoArea" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Cultivable Land</label>
                                <input type="number" step="0.01" name="cultivableLand" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Irrigated Land</label>
                                <input type="number" step="0.01" name="irrigatedLand" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Rainfed Land</label>
                                <input type="number" step="0.01" name="rainfedLand" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Pasture/Grazing</label>
                                <input type="number" step="0.01" name="pastureLand" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Forest/Agro-forest</label>
                                <input type="number" step="0.01" name="forestLand" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                            </div>
                        </div>
                    </div>

                    <!-- Step 4: Soil & Climate -->
                    <div id="step4" class="survey-step hidden">
                        <div class="bg-amber-50 dark:bg-amber-900/20 rounded-xl p-4 mb-6">
                            <h4 class="text-lg font-semibold text-amber-700 dark:text-amber-300 flex items-center">
                                <i data-feather="layers" class="w-5 h-5 mr-2"></i>
                                4. Soil Data & 5. Climate Data
                            </h4>
                        </div>
                        
                        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                            <!-- Soil Data -->
                            <div>
                                <h5 class="font-medium text-gray-900 dark:text-white mb-4">4.1 Soil Physical Properties</h5>
                                <div class="space-y-3 mb-6">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Soil Depth (cm)</label>
                                        <input type="number" name="soilDepth" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Texture</label>
                                        <select name="soilTexture" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                            <option value="">Select Texture</option>
                                            <option value="sandy">Sandy</option>
                                            <option value="loam">Loam</option>
                                            <option value="clay">Clay</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Bulk Density (g/cm³)</label>
                                        <input type="number" step="0.01" name="bulkDensity" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Water Holding Capacity (%)</label>
                                        <input type="number" step="0.1" name="waterHoldingCapacity" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                </div>
                                
                                <h5 class="font-medium text-gray-900 dark:text-white mb-4">4.2 Soil Chemical Properties</h5>
                                <div class="space-y-3">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">pH</label>
                                        <input type="number" step="0.1" name="soilPh" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Organic Matter (%)</label>
                                        <input type="number" step="0.01" name="organicMatter" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                    <div class="grid grid-cols-3 gap-2">
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">N (kg/ha)</label>
                                            <input type="number" name="nitrogen" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">P (kg/ha)</label>
                                            <input type="number" name="phosphorus" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">K (kg/ha)</label>
                                            <input type="number" name="potassium" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                    </div>
                                </div>
                                
                                <h5 class="font-medium text-gray-900 dark:text-white mb-4 mt-6">4.3 Soil Fertility Status</h5>
                                <div class="flex flex-wrap gap-3">
                                    <label class="flex items-center gap-2">
                                        <input type="radio" name="soilFertility" value="veryLow" class="w-4 h-4 text-primary-500">
                                        <span class="text-sm text-gray-700 dark:text-gray-300">Very Low</span>
                                    </label>
                                    <label class="flex items-center gap-2">
                                        <input type="radio" name="soilFertility" value="low" class="w-4 h-4 text-primary-500">
                                        <span class="text-sm text-gray-700 dark:text-gray-300">Low</span>
                                    </label>
                                    <label class="flex items-center gap-2">
                                        <input type="radio" name="soilFertility" value="medium" class="w-4 h-4 text-primary-500">
                                        <span class="text-sm text-gray-700 dark:text-gray-300">Medium</span>
                                    </label>
                                    <label class="flex items-center gap-2">
                                        <input type="radio" name="soilFertility" value="high" class="w-4 h-4 text-primary-500">
                                        <span class="text-sm text-gray-700 dark:text-gray-300">High</span>
                                    </label>
                                </div>
                            </div>
                            
                            <!-- Climate Data -->
                            <div>
                                <h5 class="font-medium text-gray-900 dark:text-white mb-4">5. Climate & Weather Data</h5>
                                <div class="space-y-3">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Mean Annual Rainfall (mm)</label>
                                        <input type="number" name="annualRainfall" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Rainfall Variability (%)</label>
                                        <input type="number" step="0.1" name="rainfallVariability" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                    </div>
                                    <div class="grid grid-cols-2 gap-3">
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Avg. Max Temp (°C)</label>
                                            <input type="number" step="0.1" name="avgMaxTemp" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Avg. Min Temp (°C)</label>
                                            <input type="number" step="0.1" name="avgMinTemp" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                    </div>
                                    <div class="grid grid-cols-2 gap-3">
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Frost Days/Year</label>
                                            <input type="number" name="frostDays" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                        <div>
                                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Heat Stress Days</label>
                                            <input type="number" name="heatStressDays" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                        </div>
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Climate Hazard Frequency</label>
                                        <select name="climateHazard" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500">
                                            <option value="">Select Primary Hazard</option>
                                            <option value="flood">Flood</option>
                                            <option value="drought">Drought</option>
                                            <option value="hail">Hail</option>
                                            <option value="none">None</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Step 5: Agri-Household Profiles -->
                    <div id="step5" class="survey-step hidden">
                        <div class="bg-purple-50 dark:bg-purple-900/20 rounded-xl p-4 mb-6">
                            <h4 class="text-lg font-semibold text-purple-700 dark:text-purple-300 flex items-center">
                                <i data-feather="home" class="w-5 h-5 mr-2"></i>
                                7-22. Agri-Household Profiles & Detailed Data
                            </h4>
                        </div>
                        
                        <div id="householdsContainer" class="space-y-6">
                            <!-- Household cards will be added here dynamically -->
                        </div>
                        
                        <button type="button" onclick="addHousehold()" class="w-full mt-6 py-4 border-2 border-dashed border-primary-500 text-primary-500 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-xl font-semibold transition-colors flex items-center justify-center gap-2">
                            <i data-feather="plus-circle" class="w-5 h-5"></i>
                            Add New Household
                        </button>
                    </div>

                    <!-- Navigation Buttons -->
                    <div class="sticky bottom-0 bg-white dark:bg-gray-800 border-t dark:border-gray-700 rounded-b-2xl p-6 mt-8 flex flex-wrap justify-between gap-4">
                        <div>
                            <button type="button" onclick="prevStep()" id="prevBtn" class="hidden px-6 py-3 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg font-medium hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors">
                                <i data-feather="arrow-left" class="inline w-4 h-4 mr-2"></i>
                                Previous
                            </button>
                        </div>
                        <div class="flex gap-3">
                            <button type="button" onclick="saveDraft()" class="px-6 py-3 bg-secondary-100 dark:bg-secondary-900/30 text-secondary-700 dark:text-secondary-300 rounded-lg font-medium hover:bg-secondary-200 dark:hover:bg-secondary-900/50 transition-colors">
                                <i data-feather="save" class="inline w-4 h-4 mr-2"></i>
                                Save Draft
                            </button>
                            <button type="button" onclick="nextStep()" id="nextBtn" class="px-6 py-3 bg-primary-500 text-white rounded-lg font-medium hover:bg-primary-600 transition-colors">
                                Next
                                <i data-feather="arrow-right" class="inline w-4 h-4 ml-2"></i>
                            </button>
                            <button type="button" onclick="showFinalSubmitModal()" id="submitBtn" class="hidden px-6 py-3 bg-green-500 text-white rounded-lg font-medium hover:bg-green-600 transition-colors">
                                <i data-feather="check-circle" class="inline w-4 h-4 mr-2"></i>
                                Final Submit
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!-- Final Submit Modal -->
    <div id="finalSubmitModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50 flex items-center justify-center p-4">
        <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-lg w-full p-8">
            <div class="text-center mb-6">
                <div class="w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mx-auto mb-4">
                    <i data-feather="check-circle" class="w-8 h-8 text-green-500"></i>
                </div>
                <h3 class="text-2xl font-bold text-gray-900 dark:text-white">Final Submission</h3>
                <p class="text-gray-600 dark:text-gray-400 mt-2">Please review your data before final submission</p>
            </div>
            
            <div class="bg-gray-50 dark:bg-gray-700 rounded-xl p-4 mb-6 max-h-48 overflow-y-auto">
                <div id="submissionSummary" class="text-sm space-y-2">
                    <!-- Summary will be populated here -->
                </div>
            </div>
            
            <div class="space-y-4 mb-6">
                <label class="flex items-start gap-3">
                    <input type="checkbox" id="finalTerms1" required class="mt-1 w-4 h-4 text-primary-500 rounded">
                    <span class="text-sm text-gray-600 dark:text-gray-400">I confirm that all data entered is accurate and verified with the community/households surveyed.</span>
                </label>
                <label class="flex items-start gap-3">
                    <input type="checkbox" id="finalTerms2" required class="mt-1 w-4 h-4 text-primary-500 rounded">
                    <span class="text-sm text-gray-600 dark:text-gray-400">I understand that after final submission, this data cannot be edited by me and will be sent for admin verification.</span>
                </label>
                <label class="flex items-start gap-3">
                    <input type="checkbox" id="finalTerms3" required class="mt-1 w-4 h-4 text-primary-500 rounded">
                    <span class="text-sm text-gray-600 dark:text-gray-400">I take full responsibility for the authenticity of this survey data.</span>
                </label>
            </div>
            
            <div class="flex gap-3">
                <button onclick="closeFinalSubmitModal()" class="flex-1 px-4 py-3 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg font-medium hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors">
                    Cancel
                </button>
                <button onclick="finalSubmit()" class="flex-1 px-4 py-3 bg-green-500 text-white rounded-lg font-medium hover:bg-green-600 transition-colors">
                    Confirm Submit
                </button>
            </div>
        </div>
    </div>

    <!-- Toast Notification -->
    <div id="toast" class="fixed bottom-4 right-4 transform translate-y-20 opacity-0 transition-all duration-300 z-50">
        <div class="bg-gray-800 dark:bg-gray-700 text-white px-6 py-4 rounded-xl shadow-lg flex items-center gap-3">
            <i data-feather="check-circle" class="w-5 h-5 text-green-400"></i>
            <span id="toastMessage">Operation successful</span>
        </div>
    </div>

    <script src="script.js"></script>
    <script>feather.replace();</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html>