File size: 84,712 Bytes
e592b04
c971f4d
e592b04
 
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
 
 
c971f4d
e592b04
 
 
 
c971f4d
e592b04
c971f4d
e592b04
 
 
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
c971f4d
e592b04
 
 
 
 
 
 
 
 
c971f4d
e592b04
 
c971f4d
 
e592b04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
 
 
c971f4d
e592b04
c971f4d
 
 
e592b04
 
 
c971f4d
 
e592b04
 
 
 
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
 
 
 
 
 
 
c971f4d
 
e592b04
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
 
 
 
 
 
 
e592b04
c971f4d
 
 
 
 
 
 
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
c971f4d
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
c971f4d
e592b04
c971f4d
 
e592b04
 
 
 
 
 
 
c971f4d
 
 
e592b04
 
c971f4d
 
e592b04
 
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
 
 
c971f4d
 
e592b04
 
 
 
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
 
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
 
 
 
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
c971f4d
 
e592b04
 
 
 
 
c971f4d
 
 
 
 
 
 
 
 
e592b04
c971f4d
 
 
 
 
 
 
 
e592b04
c971f4d
 
 
 
 
e592b04
c971f4d
 
 
 
 
e592b04
 
 
 
c971f4d
e592b04
 
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
 
c971f4d
 
e592b04
 
c971f4d
e592b04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c971f4d
 
 
 
 
 
e592b04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c971f4d
e592b04
c971f4d
 
e592b04
 
 
 
c971f4d
e592b04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c971f4d
 
 
 
 
e592b04
 
 
 
 
c971f4d
 
e592b04
 
 
 
 
 
c971f4d
 
e592b04
 
 
 
c971f4d
 
e592b04
c971f4d
e592b04
 
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
 
 
 
c971f4d
 
e592b04
 
 
 
c971f4d
 
e592b04
c971f4d
e592b04
 
c971f4d
e592b04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c971f4d
 
e592b04
c971f4d
e592b04
 
c971f4d
e592b04
 
 
 
 
 
 
 
 
 
c971f4d
e592b04
 
 
 
 
 
 
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
e592b04
 
 
 
c971f4d
 
 
 
 
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
e592b04
 
 
c971f4d
 
e592b04
 
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e592b04
c971f4d
 
e592b04
 
 
c971f4d
 
e592b04
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
e592b04
 
 
c971f4d
 
 
e592b04
 
 
 
 
 
c971f4d
 
e592b04
c971f4d
 
e592b04
c971f4d
e592b04
 
 
 
c971f4d
e592b04
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
 
e592b04
c971f4d
 
e592b04
 
 
 
 
 
 
 
c971f4d
e592b04
 
c971f4d
 
e592b04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c971f4d
 
 
 
 
 
 
 
 
e592b04
 
 
 
 
 
 
 
 
 
 
 
c971f4d
 
 
 
 
 
e592b04
 
 
c971f4d
 
e592b04
 
c971f4d
e592b04
 
c971f4d
e592b04
c971f4d
 
 
 
 
e592b04
 
c971f4d
 
e592b04
c971f4d
e592b04
 
 
 
 
 
c971f4d
 
e592b04
 
 
 
 
c971f4d
 
 
e592b04
 
c971f4d
 
e592b04
 
 
 
 
 
c971f4d
 
e592b04
 
c971f4d
e592b04
 
 
 
c971f4d
 
 
 
 
e592b04
 
c971f4d
 
 
 
e592b04
c971f4d
 
e592b04
c971f4d
 
 
 
e592b04
c971f4d
 
e592b04
c971f4d
e592b04
 
 
c971f4d
 
 
 
 
 
 
 
 
e592b04
 
 
 
 
c971f4d
e592b04
 
 
 
 
c971f4d
e592b04
 
 
c971f4d
e592b04
 
c971f4d
 
e592b04
 
 
 
 
c971f4d
e592b04
 
 
c971f4d
 
 
e592b04
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
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Site Builder Pro</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>
        .builder-container {
            display: grid;
            grid-template-columns: 250px 1fr 300px;
            gap: 1rem;
            height: calc(100vh - 80px);
        }
        .component-list {
            background-color: #f8fafc;
            border-right: 1px solid #e2e8f0;
            overflow-y: auto;
        }
        .site-canvas {
            background-color: #ffffff;
            overflow-y: auto;
            padding: 1rem;
            min-height: 100%;
            position: relative;
        }
        .component-settings {
            background-color: #f8fafc;
            border-left: 1px solid #e2e8f0;
            overflow-y: auto;
        }
        .draggable-component {
            cursor: grab;
            transition: all 0.2s;
        }
        .draggable-component:active {
            cursor: grabbing;
        }
        .site-component {
            position: relative;
            transition: all 0.2s;
        }
        .site-component:hover {
            box-shadow: 0 0 0 2px #3b82f6;
        }
        .site-component.selected {
            box-shadow: 0 0 0 2px #3b82f6;
            background-color: #eff6ff;
        }
        .component-actions {
            position: absolute;
            right: 0;
            top: 0;
            display: none;
        }
        .site-component:hover .component-actions {
            display: flex;
        }
        .site-component.selected .component-actions {
            display: flex;
        }
        .empty-state {
            border: 2px dashed #cbd5e1;
            border-radius: 0.5rem;
            padding: 2rem;
            text-align: center;
            color: #64748b;
        }
        #sitePreviewModal {
            transition: opacity 0.3s ease;
        }
        .site-preview {
            width: 100%;
            margin: 0 auto;
            background: white;
            border-radius: 0.5rem;
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        }
        .layout-container {
            border: 2px dashed #cbd5e1;
            border-radius: 0.5rem;
            padding: 1rem;
            margin-bottom: 1rem;
            background-color: #f8fafc;
        }
        .layout-row {
            border: 2px dashed #a5b4fc;
            border-radius: 0.5rem;
            padding: 0.75rem;
            margin-bottom: 0.5rem;
            background-color: #eef2ff;
        }
        .layout-column {
            border: 2px dashed #93c5fd;
            border-radius: 0.5rem;
            padding: 0.5rem;
            margin-bottom: 0.25rem;
            background-color: #eff6ff;
        }
        .layout-placeholder {
            border: 2px dashed #d1d5db;
            border-radius: 0.25rem;
            padding: 1rem;
            text-align: center;
            color: #6b7280;
            background-color: #f9fafb;
            margin-bottom: 0.5rem;
        }
        .layout-actions {
            position: absolute;
            right: 0;
            top: 0;
            display: none;
        }
        .layout-container:hover .layout-actions,
        .layout-row:hover .layout-actions,
        .layout-column:hover .layout-actions {
            display: flex;
        }
        .grid-resize-handle {
            position: absolute;
            right: 5px;
            bottom: 5px;
            width: 12px;
            height: 12px;
            cursor: nwse-resize;
            opacity: 0;
            transition: opacity 0.2s;
        }
        .layout-column:hover .grid-resize-handle {
            opacity: 1;
        }
        .drop-zone {
            min-height: 50px;
            transition: background-color 0.2s;
        }
        .drop-zone.active {
            background-color: #dbeafe;
        }
        .navbar-preview {
            background-color: #ffffff;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
        .hero-preview {
            background: linear-gradient(135deg, #6b7280, #1e40af);
            color: white;
        }
        .section-preview {
            background-color: #f9fafb;
        }
        .footer-preview {
            background-color: #1f2937;
            color: white;
        }
        .template-card {
            transition: all 0.2s;
        }
        .template-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }
        .color-option {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid transparent;
        }
        .color-option.selected {
            border-color: #1e40af;
        }
    </style>
</head>
<body class="bg-gray-50">
    <header class="bg-white shadow-sm">
        <div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8 flex justify-between items-center">
            <h1 class="text-2xl font-bold text-gray-900">Site Builder Pro</h1>
            <div class="flex space-x-3">
                <button id="templatesBtn" class="px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                    <i class="fas fa-th-large mr-2"></i> Templates
                </button>
                <button id="previewBtn" class="px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                    <i class="fas fa-eye mr-2"></i> Preview
                </button>
                <button id="publishBtn" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                    <i class="fas fa-cloud-upload-alt mr-2"></i> Publicar
                </button>
            </div>
        </div>
    </header>

    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
        <div class="builder-container">
            <!-- Component Library -->
            <div class="component-list p-4">
                <div class="flex justify-between items-center mb-4">
                    <h2 class="text-lg font-semibold text-gray-800">Componentes</h2>
                    <div class="relative">
                        <button id="toggleComponents" class="p-1 rounded-md hover:bg-gray-200">
                            <i class="fas fa-chevron-down"></i>
                        </button>
                    </div>
                </div>
                
                <div id="componentsAccordion" class="space-y-4">
                    <div class="space-y-2">
                        <h3 class="text-sm font-medium text-gray-500 uppercase tracking-wider mb-2">Layout</h3>
                        <div class="space-y-2">
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="container">
                                <div class="flex items-center">
                                    <i class="fas fa-square-full text-indigo-500 mr-2"></i>
                                    <span>Container</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="row">
                                <div class="flex items-center">
                                    <i class="fas fa-grip-lines text-indigo-500 mr-2"></i>
                                    <span>Row</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="column">
                                <div class="flex items-center">
                                    <i class="fas fa-columns text-indigo-500 mr-2"></i>
                                    <span>Column</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="space-y-2">
                        <h3 class="text-sm font-medium text-gray-500 uppercase tracking-wider mb-2">Seções</h3>
                        <div class="space-y-2">
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="navbar">
                                <div class="flex items-center">
                                    <i class="fas fa-bars text-blue-500 mr-2"></i>
                                    <span>Navbar</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="hero">
                                <div class="flex items-center">
                                    <i class="fas fa-star text-blue-500 mr-2"></i>
                                    <span>Hero Section</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="section">
                                <div class="flex items-center">
                                    <i class="fas fa-square text-blue-500 mr-2"></i>
                                    <span>Content Section</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="footer">
                                <div class="flex items-center">
                                    <i class="fas fa-window-minimize text-blue-500 mr-2"></i>
                                    <span>Footer</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="space-y-2">
                        <h3 class="text-sm font-medium text-gray-500 uppercase tracking-wider mb-2">Elementos</h3>
                        <div class="space-y-2">
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="heading">
                                <div class="flex items-center">
                                    <i class="fas fa-heading text-blue-500 mr-2"></i>
                                    <span>Heading</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="paragraph">
                                <div class="flex items-center">
                                    <i class="fas fa-paragraph text-blue-500 mr-2"></i>
                                    <span>Paragraph</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="button">
                                <div class="flex items-center">
                                    <i class="fas fa-square text-blue-500 mr-2"></i>
                                    <span>Button</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="image">
                                <div class="flex items-center">
                                    <i class="fas fa-image text-blue-500 mr-2"></i>
                                    <span>Image</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="space-y-2">
                        <h3 class="text-sm font-medium text-gray-500 uppercase tracking-wider mb-2">Formulários</h3>
                        <div class="space-y-2">
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="text">
                                <div class="flex items-center">
                                    <i class="fas fa-font text-blue-500 mr-2"></i>
                                    <span>Text Input</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="email">
                                <div class="flex items-center">
                                    <i class="fas fa-envelope text-blue-500 mr-2"></i>
                                    <span>Email Input</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="textarea">
                                <div class="flex items-center">
                                    <i class="fas fa-align-left text-blue-500 mr-2"></i>
                                    <span>Text Area</span>
                                </div>
                            </div>
                            <div draggable="true" class="draggable-component p-3 bg-white rounded border border-gray-200 shadow-sm" data-type="select">
                                <div class="flex items-center">
                                    <i class="fas fa-list-ul text-blue-500 mr-2"></i>
                                    <span>Dropdown</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Site Canvas -->
            <div class="site-canvas" id="siteCanvas">
                <div id="siteContainer" class="drop-zone">
                    <div class="empty-state">
                        <i class="fas fa-mouse-pointer text-4xl mb-3 text-gray-400"></i>
                        <h3 class="font-medium text-gray-500">Arraste componentes aqui</h3>
                        <p class="text-sm text-gray-400 mt-1">Comece construindo seu site arrastando componentes do painel esquerdo</p>
                    </div>
                </div>
            </div>

            <!-- Component Settings -->
            <div class="component-settings p-4">
                <div class="flex justify-between items-center mb-4">
                    <h2 class="text-lg font-semibold text-gray-800">Configurações</h2>
                    <div class="flex space-x-2">
                        <button id="pageSettingsBtn" class="p-1 rounded-md hover:bg-gray-200" title="Configurações da Página">
                            <i class="fas fa-cog"></i>
                        </button>
                        <button id="themeSettingsBtn" class="p-1 rounded-md hover:bg-gray-200" title="Configurações de Tema">
                            <i class="fas fa-palette"></i>
                        </button>
                    </div>
                </div>
                
                <div id="componentSettings">
                    <p class="text-gray-500 italic">Selecione um componente para editar suas propriedades</p>
                </div>
                
                <div id="pageSettings" class="hidden">
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Título da Página</label>
                            <input type="text" id="pageTitle" class="w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" value="Meu Site">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Favicon</label>
                            <div class="mt-1 flex items-center">
                                <span class="inline-block h-8 w-8 rounded-full overflow-hidden bg-gray-100">
                                    <svg class="h-full w-full text-gray-300" fill="currentColor" viewBox="0 0 24 24">
                                        <path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" />
                                    </svg>
                                </span>
                                <button type="button" class="ml-3 bg-white py-1 px-2 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                                    Alterar
                                </button>
                            </div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Meta Description</label>
                            <textarea class="w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" rows="3">Descrição do meu site para motores de busca</textarea>
                        </div>
                    </div>
                </div>
                
                <div id="themeSettings" class="hidden">
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2">Cores do Tema</label>
                            <div class="flex space-x-2">
                                <div class="color-option bg-blue-600 selected" data-color="blue"></div>
                                <div class="color-option bg-indigo-600" data-color="indigo"></div>
                                <div class="color-option bg-purple-600" data-color="purple"></div>
                                <div class="color-option bg-pink-600" data-color="pink"></div>
                                <div class="color-option bg-red-600" data-color="red"></div>
                                <div class="color-option bg-green-600" data-color="green"></div>
                            </div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Fonte Principal</label>
                            <select class="w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm">
                                <option>Inter (sans-serif)</option>
                                <option>Roboto (sans-serif)</option>
                                <option>Lora (serif)</option>
                                <option>Montserrat (sans-serif)</option>
                                <option>Open Sans (sans-serif)</option>
                            </select>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Estilo de Botão</label>
                            <select class="w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm">
                                <option>Padrão</option>
                                <option>Arredondado</option>
                                <option>Outline</option>
                                <option>Minimalista</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Templates Modal -->
    <div id="templatesModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-4xl sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
                            <h3 class="text-lg leading-6 font-medium text-gray-900 mb-4">Escolha um Template</h3>
                            <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
                                <div class="template-card p-4 border border-gray-200 rounded-md cursor-pointer">
                                    <div class="bg-gray-100 h-40 rounded-md mb-2 flex items-center justify-center">
                                        <span class="text-gray-400">Template 1</span>
                                    </div>
                                    <h4 class="font-medium text-gray-900">Landing Page</h4>
                                    <p class="text-sm text-gray-500">Página inicial simples</p>
                                </div>
                                <div class="template-card p-4 border border-gray-200 rounded-md cursor-pointer">
                                    <div class="bg-gray-100 h-40 rounded-md mb-2 flex items-center justify-center">
                                        <span class="text-gray-400">Template 2</span>
                                    </div>
                                    <h4 class="font-medium text-gray-900">Portfolio</h4>
                                    <p class="text-sm text-gray-500">Para mostrar seu trabalho</p>
                                </div>
                                <div class="template-card p-4 border border-gray-200 rounded-md cursor-pointer">
                                    <div class="bg-gray-100 h-40 rounded-md mb-2 flex items-center justify-center">
                                        <span class="text-gray-400">Template 3</span>
                                    </div>
                                    <h4 class="font-medium text-gray-900">Blog</h4>
                                    <p class="text-sm text-gray-500">Para publicar artigos</p>
                                </div>
                                <div class="template-card p-4 border border-gray-200 rounded-md cursor-pointer">
                                    <div class="bg-gray-100 h-40 rounded-md mb-2 flex items-center justify-center">
                                        <span class="text-gray-400">Template 4</span>
                                    </div>
                                    <h4 class="font-medium text-gray-900">E-commerce</h4>
                                    <p class="text-sm text-gray-500">Loja virtual simples</p>
                                </div>
                                <div class="template-card p-4 border border-gray-200 rounded-md cursor-pointer">
                                    <div class="bg-gray-100 h-40 rounded-md mb-2 flex items-center justify-center">
                                        <span class="text-gray-400">Template 5</span>
                                    </div>
                                    <h4 class="font-medium text-gray-900">Serviços</h4>
                                    <p class="text-sm text-gray-500">Para empresas de serviços</p>
                                </div>
                                <div class="template-card p-4 border border-gray-200 rounded-md cursor-pointer">
                                    <div class="bg-gray-100 h-40 rounded-md mb-2 flex items-center justify-center">
                                        <span class="text-gray-400">Template 6</span>
                                    </div>
                                    <h4 class="font-medium text-gray-900">Em branco</h4>
                                    <p class="text-sm text-gray-500">Comece do zero</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="applyTemplate" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Aplicar Template
                    </button>
                    <button type="button" id="closeTemplates" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Cancelar
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Site Preview Modal -->
    <div id="sitePreviewModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-4xl sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
                            <h3 class="text-lg leading-6 font-medium text-gray-900 mb-4">Visualização do Site</h3>
                            <div class="site-preview">
                                <div id="previewSiteContainer" class="w-full"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="closePreview" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Fechar
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Publish Modal -->
    <div id="publishModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
                            <i class="fas fa-cloud-upload-alt text-blue-600"></i>
                        </div>
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
                            <h3 class="text-lg leading-6 font-medium text-gray-900">Publicar Site</h3>
                            <div class="mt-2">
                                <div class="space-y-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Domínio</label>
                                        <div class="mt-1 flex rounded-md shadow-sm">
                                            <input type="text" class="focus:ring-blue-500 focus:border-blue-500 flex-1 block w-full rounded-none rounded-l-md sm:text-sm border-gray-300" placeholder="meusite">
                                            <span class="inline-flex items-center px-3 rounded-r-md border border-l-0 border-gray-300 bg-gray-50 text-gray-500 sm:text-sm">.meudominio.com</span>
                                        </div>
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Plano</label>
                                        <select class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
                                            <option>Básico (R$ 29/mês)</option>
                                            <option>Profissional (R$ 59/mês)</option>
                                            <option>Premium (R$ 99/mês)</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="confirmPublish" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Publicar Agora
                    </button>
                    <button type="button" id="cancelPublish" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Cancelar
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Site data structure
            let siteData = {
                title: 'Meu Site',
                description: 'Descrição do meu site',
                theme: {
                    color: 'blue',
                    font: 'Inter',
                    buttonStyle: 'default'
                },
                pages: [
                    {
                        id: 'page-1',
                        name: 'Home',
                        components: []
                    }
                ],
                currentPage: 'page-1'
            };
            
            let selectedComponent = null;
            let nextComponentId = 1;
            let isResizing = false;
            let currentResizeColumn = null;
            let startX, startWidth;
            let draggedElement = null;

            // DOM elements
            const draggableComponents = document.querySelectorAll('.draggable-component');
            const siteCanvas = document.getElementById('siteCanvas');
            const siteContainer = document.getElementById('siteContainer');
            const componentSettings = document.getElementById('componentSettings');
            const pageSettings = document.getElementById('pageSettings');
            const themeSettings = document.getElementById('themeSettings');
            const previewSiteContainer = document.getElementById('previewSiteContainer');
            const templatesBtn = document.getElementById('templatesBtn');
            const previewBtn = document.getElementById('previewBtn');
            const publishBtn = document.getElementById('publishBtn');
            const pageSettingsBtn = document.getElementById('pageSettingsBtn');
            const themeSettingsBtn = document.getElementById('themeSettingsBtn');
            const templatesModal = document.getElementById('templatesModal');
            const sitePreviewModal = document.getElementById('sitePreviewModal');
            const publishModal = document.getElementById('publishModal');
            const closeTemplates = document.getElementById('closeTemplates');
            const applyTemplate = document.getElementById('applyTemplate');
            const closePreview = document.getElementById('closePreview');
            const confirmPublish = document.getElementById('confirmPublish');
            const cancelPublish = document.getElementById('cancelPublish');
            const colorOptions = document.querySelectorAll('.color-option');
            const toggleComponents = document.getElementById('toggleComponents');
            const componentsAccordion = document.getElementById('componentsAccordion');

            // Set up drag events for all draggable components
            draggableComponents.forEach(component => {
                component.addEventListener('dragstart', function(e) {
                    e.dataTransfer.setData('text/plain', component.dataset.type);
                    draggedElement = component;
                    e.dataTransfer.effectAllowed = 'copy';
                });
            });

            // Set up drop zones
            function setupDropZones() {
                // Main container drop zone
                siteContainer.addEventListener('dragover', function(e) {
                    e.preventDefault();
                    e.dataTransfer.dropEffect = 'copy';
                    this.classList.add('active');
                });

                siteContainer.addEventListener('dragleave', function() {
                    this.classList.remove('active');
                });

                siteContainer.addEventListener('drop', function(e) {
                    e.preventDefault();
                    this.classList.remove('active');
                    
                    const componentType = e.dataTransfer.getData('text/plain');
                    addComponentToSite(componentType, this);
                });

                // Container drop zones (can accept rows or components)
                document.querySelectorAll('.layout-container').forEach(container => {
                    container.addEventListener('dragover', function(e) {
                        e.preventDefault();
                        e.dataTransfer.dropEffect = 'copy';
                        this.classList.add('active');
                    });

                    container.addEventListener('dragleave', function() {
                        this.classList.remove('active');
                    });

                    container.addEventListener('drop', function(e) {
                        e.preventDefault();
                        this.classList.remove('active');
                        
                        const componentType = e.dataTransfer.getData('text/plain');
                        // Containers can accept rows or components directly
                        if (componentType === 'row' || componentType === 'container' || 
                            ['navbar', 'hero', 'section', 'footer', 'heading', 'paragraph', 
                             'button', 'image', 'text', 'email', 'textarea', 'select'].includes(componentType)) {
                            addComponentToSite(componentType, this);
                        }
                    });
                });

                // Row drop zones (can accept columns)
                document.querySelectorAll('.layout-row').forEach(row => {
                    row.addEventListener('dragover', function(e) {
                        e.preventDefault();
                        e.dataTransfer.dropEffect = 'copy';
                        this.classList.add('active');
                    });

                    row.addEventListener('dragleave', function() {
                        this.classList.remove('active');
                    });

                    row.addEventListener('drop', function(e) {
                        e.preventDefault();
                        this.classList.remove('active');
                        
                        const componentType = e.dataTransfer.getData('text/plain');
                        // Rows can only accept columns
                        if (componentType === 'column') {
                            addComponentToSite(componentType, this);
                        }
                    });
                });

                // Column drop zones (can accept components)
                document.querySelectorAll('.layout-column').forEach(column => {
                    column.addEventListener('dragover', function(e) {
                        e.preventDefault();
                        e.dataTransfer.dropEffect = 'copy';
                        this.classList.add('active');
                    });

                    column.addEventListener('dragleave', function() {
                        this.classList.remove('active');
                    });

                    column.addEventListener('drop', function(e) {
                        e.preventDefault();
                        this.classList.remove('active');
                        
                        const componentType = e.dataTransfer.getData('text/plain');
                        // Columns can accept components but not layout elements
                        if (['navbar', 'hero', 'section', 'footer', 'heading', 'paragraph', 
                            'button', 'image', 'text', 'email', 'textarea', 'select'].includes(componentType)) {
                            addComponentToSite(componentType, this);
                        }
                    });
                });
            }

            // Add a new component to the site at a specific drop zone
            function addComponentToSite(type, dropZone) {
                // Remove empty state if it exists
                const emptyState = dropZone.querySelector('.empty-state');
                if (emptyState) {
                    emptyState.remove();
                }
                
                const componentId = `component-${nextComponentId++}`;
                let componentHtml = '';
                let defaultSettings = {};
                
                switch(type) {
                    case 'container':
                        componentHtml = `
                            <div class="site-component layout-container mb-4 relative drop-zone" data-id="${componentId}" data-type="container">
                                <div class="layout-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="layout-placeholder">
                                    <i class="fas fa-square-full text-indigo-300 text-xl mb-2"></i>
                                    <p class="text-sm">Drop rows or components here</p>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            padding: '1rem',
                            margin: '0 0 1rem 0',
                            background: '#f8fafc'
                        };
                        break;
                        
                    case 'row':
                        componentHtml = `
                            <div class="site-component layout-row mb-2 relative drop-zone" data-id="${componentId}" data-type="row">
                                <div class="layout-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="layout-placeholder">
                                    <i class="fas fa-grip-lines text-indigo-300 text-xl mb-2"></i>
                                    <p class="text-sm">Drop columns here</p>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            columns: 1,
                            gap: '0.5rem'
                        };
                        break;
                        
                    case 'column':
                        componentHtml = `
                            <div class="site-component layout-column relative drop-zone" data-id="${componentId}" data-type="column">
                                <div class="layout-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="grid-resize-handle">
                                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4 text-gray-400">
                                        <path fill-rule="evenodd" d="M12 1.586l-4 4v3.586l4-4V1.586zm4 4l-4 4h3.586l4-4V5.586zm-4 9.414l4-4v3.586l-4 4v-3.586zm-4-4l4-4H8.414l-4 4v3.586z" clip-rule="evenodd" />
                                    </svg>
                                </div>
                                <div class="layout-placeholder">
                                    <i class="fas fa-columns text-indigo-300 text-xl mb-2"></i>
                                    <p class="text-sm">Drop components here</p>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            width: '100%',
                            minWidth: '200px'
                        };
                        break;
                        
                    case 'navbar':
                        componentHtml = `
                            <div class="site-component mb-4 relative" data-id="${componentId}" data-type="navbar">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="navbar-preview py-4 px-6">
                                    <div class="flex justify-between items-center">
                                        <div class="text-xl font-bold">Logo</div>
                                        <div class="hidden md:flex space-x-6">
                                            <a href="#" class="text-gray-700 hover:text-blue-600">Home</a>
                                            <a href="#" class="text-gray-700 hover:text-blue-600">Sobre</a>
                                            <a href="#" class="text-gray-700 hover:text-blue-600">Serviços</a>
                                            <a href="#" class="text-gray-700 hover:text-blue-600">Contato</a>
                                        </div>
                                        <button class="md:hidden text-gray-700">
                                            <i class="fas fa-bars"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            logoText: 'Logo',
                            menuItems: ['Home', 'Sobre', 'Serviços', 'Contato'],
                            backgroundColor: '#ffffff',
                            textColor: '#374151'
                        };
                        break;
                        
                    case 'hero':
                        componentHtml = `
                            <div class="site-component mb-4 relative" data-id="${componentId}" data-type="hero">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-blue-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="hero-preview py-16 px-6 text-center">
                                    <h1 class="text-4xl font-bold mb-4">Título Principal</h1>
                                    <p class="text-xl mb-8 max-w-2xl mx-auto">Uma frase impactante que resume seu negócio ou proposta de valor.</p>
                                    <div class="flex justify-center space-x-4">
                                        <button class="px-6 py-3 bg-white text-blue-600 font-medium rounded-md shadow-sm hover:bg-gray-100">Botão Primário</button>
                                        <button class="px-6 py-3 border border-white text-white font-medium rounded-md shadow-sm hover:bg-white hover:text-blue-600">Botão Secundário</button>
                                    </div>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            title: 'Título Principal',
                            subtitle: 'Uma frase impactante que resume seu negócio ou proposta de valor.',
                            primaryButtonText: 'Botão Primário',
                            secondaryButtonText: 'Botão Secundário',
                            background: 'linear-gradient(135deg, #6b7280, #1e40af)',
                            textColor: '#ffffff'
                        };
                        break;
                        
                    case 'section':
                        componentHtml = `
                            <div class="site-component mb-4 relative" data-id="${componentId}" data-type="section">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="section-preview py-12 px-6">
                                    <div class="max-w-4xl mx-auto text-center">
                                        <h2 class="text-3xl font-bold mb-4">Título da Seção</h2>
                                        <p class="text-lg text-gray-600 mb-8">Descrição da seção. Adicione conteúdo relevante aqui para informar seus visitantes.</p>
                                        <div class="grid md:grid-cols-3 gap-8">
                                            <div class="bg-white p-6 rounded-lg shadow-sm">
                                                <div class="text-blue-600 text-3xl mb-4">
                                                    <i class="fas fa-star"></i>
                                                </div>
                                                <h3 class="text-xl font-semibold mb-2">Recurso 1</h3>
                                                <p class="text-gray-600">Descrição breve do recurso ou benefício.</p>
                                            </div>
                                            <div class="bg-white p-6 rounded-lg shadow-sm">
                                                <div class="text-blue-600 text-3xl mb-4">
                                                    <i class="fas fa-heart"></i>
                                                </div>
                                                <h3 class="text-xl font-semibold mb-2">Recurso 2</h3>
                                                <p class="text-gray-600">Descrição breve do recurso ou benefício.</p>
                                            </div>
                                            <div class="bg-white p-6 rounded-lg shadow-sm">
                                                <div class="text-blue-600 text-3xl mb-4">
                                                    <i class="fas fa-flag"></i>
                                                </div>
                                                <h3 class="text-xl font-semibold mb-2">Recurso 3</h3>
                                                <p class="text-gray-600">Descrição breve do recurso ou benefício.</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            title: 'Título da Seção',
                            description: 'Descrição da seção. Adicione conteúdo relevante aqui para informar seus visitantes.',
                            backgroundColor: '#f9fafb',
                            textColor: '#111827',
                            features: [
                                { icon: 'star', title: 'Recurso 1', description: 'Descrição breve do recurso ou benefício.' },
                                { icon: 'heart', title: 'Recurso 2', description: 'Descrição breve do recurso ou benefício.' },
                                { icon: 'flag', title: 'Recurso 3', description: 'Descrição breve do recurso ou benefício.' }
                            ]
                        };
                        break;
                        
                    case 'footer':
                        componentHtml = `
                            <div class="site-component mb-4 relative" data-id="${componentId}" data-type="footer">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="footer-preview py-12 px-6">
                                    <div class="max-w-6xl mx-auto">
                                        <div class="grid md:grid-cols-4 gap-8">
                                            <div>
                                                <h3 class="text-xl font-bold mb-4">Empresa</h3>
                                                <p class="text-gray-400 mb-4">Uma breve descrição sobre sua empresa e o que você oferece.</p>
                                                <div class="flex space-x-4">
                                                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook-f"></i></a>
                                                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
                                                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram"></i></a>
                                                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin-in"></i></a>
                                                </div>
                                            </div>
                                            <div>
                                                <h3 class="text-xl font-bold mb-4">Links</h3>
                                                <ul class="space-y-2">
                                                    <li><a href="#" class="text-gray-400 hover:text-white">Home</a></li>
                                                    <li><a href="#" class="text-gray-400 hover:text-white">Sobre</a></li>
                                                    <li><a href="#" class="text-gray-400 hover:text-white">Serviços</a></li>
                                                    <li><a href="#" class="text-gray-400 hover:text-white">Contato</a></li>
                                                </ul>
                                            </div>
                                            <div>
                                                <h3 class="text-xl font-bold mb-4">Contato</h3>
                                                <ul class="space-y-2">
                                                    <li class="text-gray-400">email@exemplo.com</li>
                                                    <li class="text-gray-400">(11) 99999-9999</li>
                                                    <li class="text-gray-400">Rua Exemplo, 123 - São Paulo, SP</li>
                                                </ul>
                                            </div>
                                            <div>
                                                <h3 class="text-xl font-bold mb-4">Newsletter</h3>
                                                <p class="text-gray-400 mb-4">Assine nossa newsletter para receber atualizações.</p>
                                                <div class="flex">
                                                    <input type="email" placeholder="Seu email" class="px-4 py-2 w-full rounded-l-md focus:outline-none">
                                                    <button class="bg-blue-600 px-4 py-2 rounded-r-md hover:bg-blue-700">Enviar</button>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-400">
                                            <p>© 2023 Empresa. Todos os direitos reservados.</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            companyDescription: 'Uma breve descrição sobre sua empresa e o que você oferece.',
                            links: ['Home', 'Sobre', 'Serviços', 'Contato'],
                            contactInfo: {
                                email: 'email@exemplo.com',
                                phone: '(11) 99999-9999',
                                address: 'Rua Exemplo, 123 - São Paulo, SP'
                            },
                            socialLinks: ['facebook-f', 'twitter', 'instagram', 'linkedin-in'],
                            copyrightText: '© 2023 Empresa. Todos os direitos reservados.',
                            backgroundColor: '#1f2937',
                            textColor: '#ffffff'
                        };
                        break;
                        
                    case 'heading':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="heading">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <h2 class="text-2xl font-bold">Título</h2>
                            </div>
                        `;
                        defaultSettings = {
                            text: 'Título',
                            level: 'h2',
                            alignment: 'left',
                            color: '#111827'
                        };
                        break;
                        
                    case 'paragraph':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="paragraph">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <p class="text-gray-700">Este é um parágrafo de texto. Você pode editar o conteúdo, tamanho, cor e alinhamento nas configurações.</p>
                            </div>
                        `;
                        defaultSettings = {
                            text: 'Este é um parágrafo de texto. Você pode editar o conteúdo, tamanho, cor e alinhamento nas configurações.',
                            size: 'base',
                            alignment: 'left',
                            color: '#374151'
                        };
                        break;
                        
                    case 'button':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="button">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <button class="px-4 py-2 bg-blue-600 text-white rounded-md shadow-sm hover:bg-blue-700">Botão</button>
                            </div>
                        `;
                        defaultSettings = {
                            text: 'Botão',
                            link: '#',
                            style: 'primary',
                            size: 'medium',
                            color: '#2563eb'
                        };
                        break;
                        
                    case 'image':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="image">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <div class="bg-gray-100 h-40 rounded-md flex items-center justify-center">
                                    <span class="text-gray-400">Imagem</span>
                                </div>
                            </div>
                        `;
                        defaultSettings = {
                            src: '',
                            alt: 'Imagem',
                            width: '100%',
                            height: 'auto',
                            alignment: 'center'
                        };
                        break;
                        
                    case 'text':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="text">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Text Input</label>
                                <input type="text" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" placeholder="Enter text">
                            </div>
                        `;
                        defaultSettings = {
                            label: 'Text Input',
                            placeholder: 'Enter text',
                            required: false
                        };
                        break;
                        
                    case 'email':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="email">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Email Input</label>
                                <input type="email" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" placeholder="Enter email">
                            </div>
                        `;
                        defaultSettings = {
                            label: 'Email Input',
                            placeholder: 'Enter email',
                            required: false
                        };
                        break;
                        
                    case 'textarea':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="textarea">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Text Area</label>
                                <textarea rows="3" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" placeholder="Enter text"></textarea>
                            </div>
                        `;
                        defaultSettings = {
                            label: 'Text Area',
                            placeholder: 'Enter text',
                            required: false,
                            rows: 3
                        };
                        break;
                        
                    case 'select':
                        componentHtml = `
                            <div class="site-component mb-4 p-4 bg-white rounded border border-gray-200 shadow-sm relative" data-id="${componentId}" data-type="select">
                                <div class="component-actions absolute -top-3 -right-3 bg-white rounded-full shadow-md p-1 space-x-1">
                                    <button class="edit-component p-1 text-blue-500 hover:text-blue-700 rounded-full hover:bg-blue-50">
                                        <i class="fas fa-pencil-alt text-xs"></i>
                                    </button>
                                    <button class="delete-component p-1 text-red-500 hover:text-red-700 rounded-full hover:bg-red-50">
                                        <i class="fas fa-trash-alt text-xs"></i>
                                    </button>
                                </div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Dropdown</label>
                                <select class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
                                    <option>Option 1</option>
                                    <option>Option 2</option>
                                    <option>Option 3</option>
                                </select>
                            </div>
                        `;
                        defaultSettings = {
                            label: 'Dropdown',
                            options: ['Option 1', 'Option 2', 'Option 3'],
                            required: false
                        };
                        break;
                }
                
                // Create a temporary element to parse the HTML
                const tempDiv = document.createElement('div');
                tempDiv.innerHTML = componentHtml.trim();
                const newComponent = tempDiv.firstChild;
                
                // Add to site
                if (dropZone === siteContainer) {
                    // Adding to main container
                    dropZone.appendChild(newComponent);
                } else {
                    // Adding to a layout element (container, row, or column)
                    const placeholder = dropZone.querySelector('.layout-placeholder');
                    if (placeholder) {
                        dropZone.insertBefore(newComponent, placeholder);
                    } else {
                        dropZone.appendChild(newComponent);
                    }
                }
                
                // Add to site data
                const currentPage = siteData.pages.find(page => page.id === siteData.currentPage);
                if (currentPage) {
                    currentPage.components.push({
                        id: componentId,
                        type: type,
                        settings: defaultSettings,
                        parentId: dropZone !== siteContainer ? dropZone.dataset.id : null
                    });
                }
                
                // Set up component interactions
                setupComponentInteractions(newComponent);
                
                // Set up drop zones for the new element if it's a layout element
                if (['container', 'row', 'column'].includes(type)) {
                    setupDropZones();
                }
                
                // If it's a column, set up resize handle
                if (type === 'column') {
                    setupColumnResize(newComponent);
                }
                
                // Select the new component
                selectComponent(newComponent);
            }
            
            // Set up column resize functionality
            function setupColumnResize(columnElement) {
                const resizeHandle = columnElement.querySelector('.grid-resize-handle');
                
                resizeHandle.addEventListener('mousedown', function(e) {
                    e.preventDefault();
                    isResizing = true;
                    currentResizeColumn = columnElement;
                    startX = e.clientX;
                    startWidth = parseInt(document.defaultView.getComputedStyle(columnElement).width, 10);
                    
                    document.documentElement.style.cursor = 'nwse-resize';
                    document.addEventListener('mousemove', handleResize);
                    document.addEventListener('mouseup', stopResize);
                });
                
                function handleResize(e) {
                    if (!isResizing) return;
                    
                    const width = startWidth + e.clientX - startX;
                    currentResizeColumn.style.width = `${width}px`;
                    currentResizeColumn.style.minWidth = `${width}px`;
                    
                    // Update site data
                    const componentId = currentResizeColumn.dataset.id;
                    const currentPage = siteData.pages.find(page => page.id === siteData.currentPage);
                    if (currentPage) {
                        const componentData = currentPage.components.find(comp => comp.id === componentId);
                        if (componentData) {
                            componentData.settings.width = `${width}px`;
                            componentData.settings.minWidth = `${width}px`;
                        }
                    }
                }
                
                function stopResize() {
                    isResizing = false;
                    currentResizeColumn = null;
                    document.documentElement.style.cursor = '';
                    document.removeEventListener('mousemove', handleResize);
                    document.removeEventListener('mouseup', stopResize);
                }
            }
            
            // Set up component interactions (click, delete, etc.)
            function setupComponentInteractions(componentElement) {
                // Select component on click
                componentElement.addEventListener('click', function(e) {
                    if (!e.target.closest('.component-actions') && !e.target.closest('.layout-actions')) {
                        selectComponent(componentElement);
                    }
                });
                
                // Delete component
                const deleteBtn = componentElement.querySelector('.delete-component');
                if (deleteBtn) {
                    deleteBtn.addEventListener('click', function() {
                        const componentId = componentElement.dataset.id;
                        
                        // Remove from DOM
                        componentElement.remove();
                        
                        // Remove from site data
                        const currentPage = siteData.pages.find(page => page.id === siteData.currentPage);
                        if (currentPage) {
                            currentPage.components = currentPage.components.filter(comp => comp.id !== componentId);
                        }
                        
                        // Clear selection
                        selectedComponent = null;
                        renderComponentSettings(null);
                        
                        // Show empty state if no components left in container
                        const containers = document.querySelectorAll('.layout-container, .layout-row, .layout-column');
                        containers.forEach(container => {
                            if (container.children.length === 1 && container.querySelector('.layout-placeholder')) {
                                container.innerHTML = `
                                    <div class="layout-placeholder">
                                        <i class="fas fa-square-full text-indigo-300 text-xl mb-2"></i>
                                        <p class="text-sm">Drop ${container.classList.contains('layout-container') ? 'rows or components' : 
                                          container.classList.contains('layout-row') ? 'columns' : 'components'} here</p>
                                    </div>
                                `;
                            }
                        });
                        
                        // Show empty state if no components left in main container
                        if (siteContainer.children.length === 0) {
                            siteContainer.innerHTML = `
                                <div class="empty-state">
                                    <i class="fas fa-mouse-pointer text-4xl mb-3 text-gray-400"></i>
                                    <h3 class="font-medium text-gray-500">Arraste componentes aqui</h3>
                                    <p class="text-sm text-gray-400 mt-1">Comece construindo seu site arrastando componentes do painel esquerdo</p>
                                </div>
                            `;
                        }
                    });
                }
                
                // Edit component (same as select for now)
                const editBtn = componentElement.querySelector('.edit-component');
                if (editBtn) {
                    editBtn.addEventListener('click', function() {
                        selectComponent(componentElement);
                    });
                }
            }
            
            // Select a component and show its settings
            function selectComponent(componentElement) {
                // Deselect previously selected component
                if (selectedComponent) {
                    selectedComponent.classList.remove('selected');
                }
                
                // Select new component
                selectedComponent = componentElement;
                if (selectedComponent) {
                    selectedComponent.classList.add('selected');
                    
                    // Scroll to show the selected component
                    selectedComponent.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
                    
                    // Find the component in site data
                    const componentId = selectedComponent.dataset.id;
                    const currentPage = siteData.pages.find(page => page.id === siteData.currentPage);
                    const componentData = currentPage ? currentPage.components.find(comp => comp.id === componentId) : null;
                    
                    // Show component settings
                    renderComponentSettings(componentData);
                } else {
                    renderComponentSettings(null);
                }
            }
            
            // Render component settings panel
            function renderComponentSettings(componentData) {
                // Hide page and theme settings
                pageSettings.classList.add('hidden');
                themeSettings.classList.add('hidden');
                componentSettings.classList.remove('hidden');
                
                if (!componentData) {
                    componentSettings.innerHTML = '<p class="text-gray-500 italic">Selecione um componente para editar suas propriedades</p>';
                    return;
                }
                
                let settingsHtml = '';
                
                switch(componentData.type) {
                    case 'container':
                        settingsHtml = `
                            <div class="space-y-4">
                                <div>
                                    <label class="block text-sm font-medium text-gray-700 mb-1">Padding</label>
                                    <input type="text" class="component-setting w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" data-setting="padding" value="${componentData.settings.padding}">
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-700 mb-1">Margin</label>
                                    <input type="text" class="component-setting w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" data-setting="margin" value="${componentData.settings.margin}">
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-700 mb-1">Background Color</label>
                                    <input type="color" class="component-setting w-full h-10 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" data-setting="background" value="${componentData.settings.background}">
                                </div>
                            </div>
                        `;
                        break;
                        
                    case 'row':
                        settingsHtml = `
                            <div class="space-y-4">
                                <div>
                                    <label class="block text-sm font-medium text-gray-700 mb-1">Number of Columns</label>
                                    <select class="component-setting w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" data-setting="columns">
                                        <option value="1" ${componentData.settings.columns === 1 ? 'selected' : ''}>1 Column</
</html>