File size: 56,014 Bytes
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475f9b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ca6d91
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Reconstruction Project Estimator</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>
        .calculator-card {
            transition: all 0.3s ease;
        }
        .calculator-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .tab-button {
            transition: all 0.2s ease;
        }
        .tab-button.active {
            background-color: #3b82f6;
            color: white;
        }
        .summary-item {
            border-left: 4px solid #3b82f6;
        }
        input[type="number"]::-webkit-inner-spin-button,
        input[type="number"]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        .profit-positive {
            color: #10b981;
        }
        .profit-negative {
            color: #ef4444;
        }
        .profit-neutral {
            color: #6b7280;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <header class="bg-blue-700 text-white shadow-lg">
        <div class="container mx-auto px-4 py-6">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h1 class="text-3xl font-bold">Reconstruction Estimator Pro</h1>
                    <p class="text-blue-200 mt-1">Accurate pricing based on industry standards</p>
                </div>
                <div class="flex items-center space-x-4">
                    <button id="resetBtn" class="bg-white text-blue-700 px-4 py-2 rounded-lg font-semibold hover:bg-blue-50 transition">
                        <i class="fas fa-redo mr-2"></i>Reset All
                    </button>
                    <button id="printBtn" class="bg-blue-800 text-white px-4 py-2 rounded-lg font-semibold hover:bg-blue-900 transition">
                        <i class="fas fa-print mr-2"></i>Print Estimate
                    </button>
                </div>
            </div>
        </div>
    </header>

    <main class="container mx-auto px-4 py-8">
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
            <div class="lg:col-span-2">
                <div class="bg-white rounded-xl shadow-md p-6 mb-6">
                    <h2 class="text-2xl font-bold text-gray-800 mb-4">Project Details</h2>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Project Name</label>
                            <input type="text" id="projectName" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="e.g., Smith Residence Kitchen">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Project Date</label>
                            <input type="date" id="projectDate" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="mt-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Project Notes</label>
                        <textarea id="projectNotes" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" rows="3" placeholder="Any special considerations..."></textarea>
                    </div>
                    <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Contract Total ($)</label>
                            <input type="number" id="contractTotal" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Total contract amount">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Estimated Overhead (%)</label>
                            <input type="number" id="overheadPercent" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" value="15" placeholder="Overhead percentage">
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md p-6 mb-6">
                    <div class="flex overflow-x-auto space-x-1 pb-2">
                        <button class="tab-button px-4 py-2 rounded-lg font-medium" data-tab="maintrade">Main Trade</button>
                        <button class="tab-button active px-4 py-2 rounded-lg font-medium" data-tab="countertops">Countertops</button>
                        <button class="tab-button px-4 py-2 rounded-lg font-medium" data-tab="flooring">Flooring</button>
                        <button class="tab-button px-4 py-2 rounded-lg font-medium" data-tab="tile">Tile</button>
                        <button class="tab-button px-4 py-2 rounded-lg font-medium" data-tab="showers">Showers</button>
                        <button class="tab-button px-4 py-2 rounded-lg font-medium" data-tab="cabinetry">Cabinetry</button>
                    </div>

                    <div id="tabContent" class="mt-4">
                        <!-- Main Trade Tab -->
                        <div class="tab-content hidden" id="maintrade-tab">
                            <div class="calculator-card bg-gray-50 p-4 rounded-lg">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Main Trade Labor</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Number of Days</label>
                                        <input type="number" id="tradeDays" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Estimated days">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Daily Rate</label>
                                        <select id="tradeRate" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
                                            <option value="600">$600/day (Standard)</option>
                                            <option value="700">$700/day (Moderate)</option>
                                            <option value="800">$800/day (Heavy Labor)</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="mt-3 space-y-2">
                                    <label class="inline-flex items-center">
                                        <input type="checkbox" id="tradeMaterials" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                                        <span class="ml-2 text-sm text-gray-700">Add Materials Surcharge (+15%)</span>
                                    </label>
                                    <label class="inline-flex items-center">
                                        <input type="checkbox" id="tradeHeavy" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                                        <span class="ml-2 text-sm text-gray-700">Heavy Labor (+10%)</span>
                                    </label>
                                </div>
                                <button onclick="calculateTrade()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="tradeResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="tradeCost" class="font-bold">$0.00</span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- Countertops Tab -->
                        <div class="tab-content active" id="countertops-tab">
                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Solid/Stone Countertops</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Square Footage</label>
                                        <input type="number" id="countertopSqft" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Total sqft">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Number of Slabs</label>
                                        <input type="number" id="countertopSlabs" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Slab count">
                                    </div>
                                </div>
                                <div class="mt-3 space-y-2">
                                    <label class="inline-flex items-center">
                                        <input type="checkbox" id="countertopDisposal" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                                        <span class="ml-2 text-sm text-gray-700">Disposal Needed (+$170)</span>
                                    </label>
                                    <label class="inline-flex items-center">
                                        <input type="checkbox" id="countertopSubdeck" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                                        <span class="ml-2 text-sm text-gray-700">Sub Deck Needed (+$200)</span>
                                    </label>
                                </div>
                                <button onclick="calculateCountertop()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="countertopResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="countertopCost" class="font-bold">$0.00</span>
                                    </div>
                                </div>
                            </div>

                            <div class="calculator-card bg-gray-50 p-4 rounded-lg">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Laminate Countertops</h3>
                                <div>
                                    <label class="block text-sm font-medium text-gray-700 mb-1">Linear Feet</label>
                                    <input type="number" id="laminateLnft" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Total linear feet">
                                </div>
                                <button onclick="calculateLaminate()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="laminateResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                   极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                            </div>
                        </div>

                        <!-- Flooring Tab -->
                        <div class="tab-content hidden" id="flooring-tab">
                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Vinyl/Laminate Flooring</h3>
                                <极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                            </div>

                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Wood/Glue Down Flooring</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                                    </div>
                                </div>
                                <button onclick="calculateWood()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="woodResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="woodCost" class="font-bold">$0.00</span>
                                    </div>
                                </div>
                            </div>

                            <div class="calculator-card bg-gray-50 p极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                            </div>
                        </div>

                        <!-- Tile Tab -->
                        <div class="tab-content hidden" id="tile-tab">
                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Tile Flooring</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Square Footage</label>
                                        <input type="number" id="tileSqft" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Total sqft">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Tile Cost ($/sqft)</label>
                                        <input type="number" id="tileMaterialCost" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                                </div>
                                <button onclick="calculateTile()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="tileResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="tileCost" class="font-bold">$0.00</span>
                                    </div>
                                </div>
                            </div>

                            <div class="calculator-card bg-gray-50 p-4 rounded-lg">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Backsplash</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Square Footage</label>
                                        <input type="number" id="backsplashSqft" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Total sqft">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Complexity</label>
                                        <select id="backsplashComplexity" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
                                            <option value="simple">Simple Design</option>
                                            <option value="medium">Medium Complexity</option>
                                            <option value="complex">Complex Design</option>
                                        </select>
                                    </div>
                                </div>
                                <button onclick="calculateBacksplash()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="backsplashResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="backsplash极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                                </div>
                            </div>
                        </div>

                        <!-- Showers Tab -->
                        <div class="tab-content hidden" id="showers-tab">
                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Shower Installation</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Shower Size</label>
                                        <select id="shooterSize" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
                                            <option value="basic">Basic (3x3)</option>
                                            <option value="medium">Medium (4x4)</option>
                                            <option value="large">Large (5x5+)</option>
                                            <option value="custom">Custom Size</option>
                                        </select>
                                    </div>
                                    <div id="showerCustomSize" class="hidden">
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Dimensions (feet)</label>
                                        <input type="text" id="showerDimensions" class="w-full px-3 py极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                                </div>
                                <button onclick="calculateShower()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="showerResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="showerCost" class="font-bold">$0.00</span>
                                    </div>
                                </div>
                            </div>

                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Tub Surround</h3>
                                <div class="space-y-2">
                                    <label class="inline-flex items-center">
                                        <input type="checkbox" id="tubStandard" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" checked>
                                        <span class="ml-2 text-sm text-gray-700">Standard Tub Surround</span>
                                    </label>
                                </div>
                                <button onclick="calculateTub()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                                </div>
                            </div>

                            <div class="calculator-card bg-gray-50 p-4 rounded-lg">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Shower Glass</h3>
                                <div class="grid grid极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
                                </div>
                            </div>
                        </div>

                        <!-- Cabinetry Tab -->
                        <div class="tab-content hidden" id="cabinetry-tab">
                            <div class="calculator-card bg-gray-50 p-4 rounded-lg mb-4">
                                <h3 class="font-bold text-lg text-gray-800 mb-3">Cabinet Repair</h3>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Linear Feet</label>
                                        <input type="number" id="cabinetLnft" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Linear feet">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Number of Doors/Frames</label>
                                        <input type="number" id="cabinetDoors" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500" placeholder="Count">
                                    </div>
                                </div>
                                <button onclick="calculateCabinet()" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition">Calculate</button>
                                <div id="cabinetResult" class="mt-3 p-3 bg-blue-50 rounded-md hidden">
                                    <div class="flex justify-between">
                                        <span class="font-medium">Estimated Cost:</span>
                                        <span id="cabinetCost" class="font-bold">$0.00</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="lg:col-span-1">
                <div class="bg-white rounded-xl shadow-md p-6 sticky top-8">
                    <h2 class="text-2xl font-bold text-gray-800 mb-4">Project Summary</h2>
                    
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-700 mb-2">Financial Overview</h3>
                        <div class="space-y-3">
                            <div class="flex justify-between">
                                <span class="text-gray-600">Contract Total:</span>
                                <span id="summaryContractTotal" class="font-medium">$0.00</span>
                            </div>
                            <div class="flex justify-between">
                                <span class="text-gray-600">Estimated Costs:</span>
                                <span id="summaryEstimatedCosts" class="font-medium">$0.00</span>
                            </div>
                            <div class="flex justify-between">
                                <span class="text-gray-600">Overhead (<span id="overheadPercentDisplay">15</span>%):</span>
                                <span id="summaryOverhead" class="font-medium">$0.00</span>
                            </div>
                            <div class="border-t border-gray-200 pt-2 mt-2">
                                <div class="flex justify-between">
                                    <span class="text-gray-800 font-semibold">Gross Profit:</span>
                                    <span id="summaryGrossProfit" class="font-bold">$0.00</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-gray-600">Profit Margin:</span>
                                    <span id="summaryProfitMargin" class="font-medium">0%</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-700 mb-2">Cost Breakdown</h3>
                        <div id="costItems" class="space-y-3">
                            <div class="text-center text-gray-500 py-4">
                                <i class="fas fa-calculator text-2xl mb-2"></i>
                                <p>Start adding items to see your cost breakdown</p>
                            </div>
                        </div>
                    </div>

                    <div class="border-t border-gray-200 pt-4">
                        <div class="flex justify-between items-center">
                            <span class="text-lg font-semibold text-gray-800">Total Estimated Cost</span>
                            <span id="totalEstimatedCost" class="text-2xl font-bold text-blue-600">$0.00</span>
                        </div>
                        <button onclick="updateSummary()" class="mt-4 w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700 transition flex items-center justify-center">
                            <i class="fas fa-sync-alt mr-2"></i> Update Summary
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <script>
        // Global variables to store calculated values
        const calculatedItems = {
            trade: 0,
            countertop: 0,
            laminate: 0,
            vinyl: 0,
            wood: 0,
            carpet: 0,
            tile: 0,
            backsplash: 0,
            shower: 0,
            tub: 0,
            glass: 0,
            cabinet: 0
        };

        // Tab switching functionality
        document.querySelectorAll('.tab-button').forEach(button => {
            button.addEventListener('click', function() {
                // Remove active class from all buttons
                document.querySelectorAll('.tab-button').forEach(btn => {
                    btn.classList.remove('active');
                });
                
                // Add active class to clicked button
                this.classList.add('active');
                
                // Hide all tab contents
                document.querySelectorAll('.tab-content').forEach(content => {
                    content.classList.add('hidden');
                });
                
                // Show the selected tab content
                const tabId = this.getAttribute('data-tab') + '-tab';
                document.getElementById(tabId).classList.remove('hidden');
            });
        });

        // Calculate Trade Labor
        function calculateTrade() {
            const days = parseFloat(document.getElementById('tradeDays').value) || 0;
            const rate = parseFloat(document.getElementById('tradeRate').value) || 0;
            const materialsSurcharge = document.getElementById('tradeMaterials').checked;
            const heavyLabor = document.getElementById('tradeHeavy').checked;
            
            let cost = days * rate;
            
            if (materialsSurcharge) cost *= 1.15;
            if (heavyLabor) cost *= 1.10;
            
            calculatedItems.trade = cost;
            
            document.getElementById('tradeCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('tradeResult').classList.remove('hidden');
            addCostItem('Main Trade Labor', cost);
            updateSummary();
        }

        // Calculate Countertop
        function calculateCountertop() {
            const sqft = parseFloat(document.getElementById('countertopSqft').value) || 0;
            const slabs = parseFloat(document.getElementById('countertopSlabs').value) || 0;
            const disposal = document.getElementById('countertopDisposal').checked;
            const subdeck = document.getElementById('countertopSubdeck').checked;
            
            // Base rate per sqft
            let cost = sqft * 45;
            
            // Additional costs
            if (slabs > 0) cost += slabs * 150;
            if (disposal) cost += 170;
            if (subdeck) cost += 200;
            
            calculatedItems.countertop = cost;
            
            document.getElementById('countertopCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('countertopResult').classList.remove('hidden');
            addCostItem('Solid Countertops', cost);
            updateSummary();
        }

        // Calculate Laminate
        function calculateLaminate() {
            const lnft = parseFloat(document.getElementById('laminateLnft').value) || 0;
            
            // Base rate per linear foot
            const cost = lnft * 35;
            
            calculatedItems.laminate = cost;
            
            document.getElementById('laminateCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('laminateResult').classList.remove('hidden');
            addCostItem('Laminate Countertops', cost);
            updateSummary();
        }

        // Calculate Vinyl Flooring
        function calculateVinyl() {
            const sqft = parseFloat(document.getElementById('vinylSqft').value) || 0;
            const lnft = parseFloat(document.getElementById('vinylLnft').value) || 0;
            const materialCost = parseFloat(document.getElementById('vinylMaterialCost').value) || 0;
            const trips = parseFloat(document.getElementById('vinylTrips').value) || 0;
            const demo = document.getElementById('vinylDemo').checked;
            const underlayment = document.getElementById('vinylUnderlayment').checked;
            const leveling = document.getElementById('vinylLeveling').checked;
            
            // Base installation cost
            let cost = sqft * 2.50;
            
            // Add material cost
            cost += sqft * materialCost;
            
            // Add quarter round
            cost += lnft * 2.50;
            
            // Add delivery trips
            cost += trips * 75;
            
            // Add demo if needed
            if (demo) cost += sqft * 1.50;
            
            // Add underlayment if needed
            if (underlayment) cost += sqft * 0.75;
            
            // Add leveling if needed
            if (leveling) cost += sqft * 1.25;
            
            calculatedItems.vinyl = cost;
            
            document.getElementById('vinylCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('vinylResult').classList.remove('hidden');
            addCostItem('Vinyl Flooring', cost);
            updateSummary();
        }

        // Calculate Wood Flooring
        function calculateWood() {
            const sqft = parseFloat(document.getElementById('woodSqft').value) || 0;
            const lnft = parse极好的!我已经添加了一个"Main Trade"选项卡,其中包含以下功能:

1. **每日费率选择**:
   - $600/天(标准)
   - $700/天(中等)
   - $800/天(重体力劳动)

2. **额外选项**:
   - 材料附加费(+15%)
   - 重体力劳动附加费(+10%)

3. **计算功能**:
   - 根据天数、费率选择和附加选项计算总成本

这个新选项卡位于所有其他选项卡之前,用户可以轻松估算主要贸易工作的成本。计算器会考虑材料和劳动强度因素,正如您所要求的。

您可以将此代码直接复制到HTML文件中使用,或者我可以根据您的需求进一步调整
            const materialCost = parseFloat(document.getElementById('woodMaterialCost').value) || 0;
            const demo = document.getElementById('woodDemo').checked;
            const leveling = document.getElementById('woodLeveling').checked;
            
            // Base installation cost
            let cost = sqft * 3.50;
            
            // Add material cost
            cost += sqft * materialCost;
            
            // Add quarter round
            cost += lnft * 3.00;
            
            // Add demo if needed
            if (demo) cost += sqft * 2.00;
            
            // Add leveling if needed
            if (leveling) cost += sqft * 1.50;
            
            calculatedItems.wood = cost;
            
            document.getElementById('woodCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('woodResult').classList.remove('hidden');
            addCostItem('Wood Flooring', cost);
            updateSummary();
        }

        // Calculate Carpet
        function calculateCarpet() {
            const sqft = parseFloat(document.getElementById('carpetSqft').value) || 0;
            const rooms = parseFloat(document.getElementById('carpetRooms').value) || 0;
            const materialCost = parseFloat(document.getElementById('carpetMaterialCost').value) || 0;
            const demo = document.getElementById('carpetDemo').checked;
            
            // Base installation cost
            let cost = sqft * 1.75;
            
            // Add material cost
            cost += sqft * materialCost;
            
            // Add per room charge
            cost += rooms * 50;
            
            // Add demo if needed
            if (demo) cost += sqft * 1.00;
            
            calculatedItems.carpet = cost;
            
            document.getElementById('carpetCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('carpetResult').classList.remove('hidden');
            addCostItem('Carpet', cost);
            updateSummary();
        }

        // Calculate Tile
        function calculateTile() {
            const sqft = parseFloat(document.getElementById('tileSqft').value) || 0;
            const materialCost = parseFloat(document.getElementById('tileMaterialCost').value) || 0;
            const demo = document.getElementById('tileDemo').checked;
            const smallBath = document.getElementById('tileSmallBath').checked;
            const bathLocation = document.querySelector('input[name="bathLocation"]:checked')?.value;
            
            // Base installation cost
            let cost = sqft * 5.00;
            
            // Add material cost
            cost += sqft * materialCost;
            
            // Add demo if needed
            if (demo) cost += sqft * 2.00;
            
            // Small bathroom premium
            if (smallBath) {
                cost += 150;
                if (bathLocation === 'upstairs') cost += 100;
            }
            
            calculatedItems.tile = cost;
            
            document.getElementById('tileCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('tileResult').classList.remove('hidden');
            addCostItem('Tile Flooring', cost);
            updateSummary();
        }

        // Calculate Backsplash
        function calculateBacksplash() {
            const sqft = parseFloat(document.getElementById('backsplashSqft').value) || 0;
            const complexity = document.getElementById('backsplashComplexity').value;
            
            // Base rates based on complexity
            let rate;
            switch(complexity) {
                case 'simple': rate = 8.00; break;
                case 'medium': rate = 10.00; break;
                case 'complex': rate = 15.00; break;
                default: rate = 8.00;
            }
            
            const cost = sqft * rate;
            
            calculatedItems.backsplash = cost;
            
            document.getElementById('backsplashCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('backsplashResult').classList.remove('hidden');
            addCostItem('Backsplash', cost);
            updateSummary();
        }

        // Calculate Shower
        function calculateShower() {
            const size = document.getElementById('shooterSize').value;
            const dualHead = document.getElementById('showerDualHead').checked;
            const bench = document.getElementById('showerBench').checked;
            const niches = document.getElementById('showerMultipleNiches').checked;
            
            // Base rates based on size
            let cost;
            switch(size) {
                case 'basic': cost = 2500; break;
                case 'medium': cost = 3500; break;
                case 'large': cost = 4500; break;
                case 'custom':
                    const dimensions = document.getElementById('showerDimensions').value;
                    if (dimensions) {
                        const [length, width] = dimensions.split('x').map(Number);
                        const area = length * width;
                        cost = area * 100;
                    } else {
                        cost = 3000;
                    }
                    break;
                default: cost = 2500;
            }
            
            // Add features
            if (dualHead) cost += 300;
            if (bench) cost += 450;
            if (niches) cost += 200;
            
            calculatedItems.shower = cost;
            
            document.getElementById('showerCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('showerResult').classList.remove('hidden');
            addCostItem('Shower Installation', cost);
            updateSummary();
        }

        // Calculate Tub
        function calculateTub() {
            const standard = document.getElementById('tubStandard').checked;
            
            // Base rate
            const cost = standard ? 1200 : 0;
            
            calculatedItems.tub = cost;
            
            document.getElementById('tubCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('tubResult').classList.remove('hidden');
            addCostItem('Tub Surround', cost);
            updateSummary();
        }

        // Calculate Glass
        function calculateGlass() {
            const type = document.getElementById('glassType').value;
            const lnft = parseFloat(document.getElementById('glassLnft').value) || 0;
            
            // Rates based on type
            let rate;
            switch(type) {
                case 'standard': rate = 75; break;
                case 'frameless': rate = 125; break;
                case 'reinstall': rate = 40; break;
                default: rate = 75;
            }
            
            const cost = lnft * rate;
            
            calculatedItems.glass = cost;
            
            document.getElementById('glassCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('glassResult').classList.remove('hidden');
            addCostItem('Shower Glass', cost);
            updateSummary();
        }

        // Calculate Cabinet
        function calculateCabinet() {
            const lnft = parseFloat(document.getElementById('cabinetLnft').value) || 0;
            const doors = parseFloat(document.getElementById('cabinetDoors').value) || 0;
            
            // Base rate per linear foot plus per door
            const cost = (lnft * 25) + (doors * 50);
            
            calculatedItems.cabinet = cost;
            
            document.getElementById('cabinetCost').textContent = `$${cost.toFixed(2)}`;
            document.getElementById('cabinetResult').classList.remove('hidden');
            addCostItem('Cabinet Repair', cost);
            updateSummary();
        }

        // Add cost item to summary
        function addCostItem(name, cost) {
            const costItems = document.getElementById('costItems');
            
            // Check if item already exists
            const existingItem = Array.from(costItems.children).find(item => {
                return item.querySelector('.item-name')?.textContent === name;
            });
            
            if (existingItem) {
                // Update existing item
                existingItem.querySelector('.item-cost').textContent = `$${cost.toFixed(2)}`;
            } else {
                // Create new item
                const item = document.createElement('div');
                item.className = 'summary-item pl-3 py-2';
                item.innerHTML = `
                    <div class="flex justify-between items-center">
                        <span class="item-name text-gray-700">${name}</span>
                        <span class="item-cost font-medium">$${cost.toFixed(2)}</span>
                    </div>
                `;
                
                // Add to the top of the list
                if (costItems.firstChild && costItems.firstChild.classList.contains('text-center')) {
                    costItems.replaceChild(item, costItems.firstChild);
                } else {
                    costItems.prepend(item);
                }
            }
        }

        // Update summary with totals
        function updateSummary() {
            // Calculate total estimated cost
            const totalCost = Object.values(calculatedItems).reduce((sum, cost) => sum + cost, 0);
            
            // Get contract total and overhead
            const contractTotal = parseFloat(document.getElementById('contractTotal').value) || 0;
            const overheadPercent = parseFloat(document.getElementById('overheadPercent').value) || 0;
            const overheadAmount = totalCost * (overheadPercent / 100);
            
            // Calculate gross profit
            const grossProfit = contractTotal - totalCost - overheadAmount;
            const profitMargin = contractTotal > 0 ? (grossProfit / contractTotal) * 100 : 0;
            
            // Update display
            document.getElementById('summaryContractTotal').textContent = `$${contractTotal.toFixed(2)}`;
            document.getElementById('summaryEstimatedCosts').textContent = `$${totalCost.toFixed(2)}`;
            document.getElementById('summaryOverhead').textContent = `$${overheadAmount.toFixed(2)}`;
            document.getElementById('overheadPercentDisplay').textContent = overheadPercent;
            document.getElementById('summaryGrossProfit').textContent = `$${grossProfit.toFixed(2)}`;
            document.getElementById('summaryProfitMargin').textContent = `${profitMargin.toFixed(1)}%`;
            document.getElementById('totalEstimatedCost').textContent = `$${totalCost.toFixed(2)}`;
            
            // Style profit based on value
            const grossProfitElement = document.getElementById('summaryGrossProfit');
            const profitMarginElement = document.getElementById('summaryProfitMargin');
            
            if (grossProfit > 0) {
                grossProfitElement.classList.add('profit-positive');
                grossProfitElement.classList.remove('profit-negative', 'profit-neutral');
                profitMarginElement.classList.add('profit-positive');
                profitMarginElement.classList.remove('profit-negative', 'profit-neutral');
            } else if (grossProfit < 0) {
                grossProfitElement.classList.add('profit-negative');
                grossProfitElement.classList.remove('profit-positive', 'profit-neutral');
                profitMarginElement.classList.add('profit-negative');
                profitMarginElement.classList.remove('profit-positive', 'profit-neutral');
            } else {
                grossProfitElement.classList.add('profit-neutral');
                grossProfitElement.classList.remove('profit-positive', 'profit-negative');
                profitMarginElement.classList.add('profit-neutral');
                profitMarginElement.classList.remove('profit-positive', 'profit-negative');
            }
        }

        // Reset all fields
        document.getElementById('resetBtn').addEventListener('click', function() {
            // Reset all input fields
            document.querySelectorAll('input[type="text"], input[type="number"], input[type="date"], textarea').forEach(input => {
                input.value = '';
            });
            
            // Reset checkboxes and radios
            document.querySelectorAll('input[type="checkbox"], input[type="radio"]').forEach(input => {
                input.checked = false;
            });
            
            // Reset selects
            document.querySelectorAll('select').forEach(select => {
                select.selectedIndex = 0;
            });
            
            // Reset calculated items
            for (const key in calculatedItems) {
                calculatedItems[key] = 0;
            }
            
            // Reset results displays
            document.querySelectorAll('[id$="Result"]').forEach(result => {
                result.classList.add('hidden');
            });
            
            // Reset summary
            document.getElementById('costItems').innerHTML = `
                <div class="text-center text-gray-500 py-4">
                    <i class="fas fa-calculator text-2xl mb-2"></i>
                    <p>Start adding items to see your cost breakdown</p>
                </div>
            `;
            
            updateSummary();
        });

        // Print functionality
        document.getElementById('printBtn').addEventListener('click', function() {
            window.print();
        });

        // Show/hide custom shower size field
        document.getElementById('shooterSize').addEventListener('change', function() {
            const customSizeField = document.getElementById('showerCustomSize');
            if (this.value === 'custom') {
                customSizeField.classList.remove('hidden');
            } else {
                customSizeField.classList.add('hidden');
            }
        });

        // Show/hide bathroom location options
        document.getElementById('tileSmallBath').addEventListener('change', function() {
            const bathLocationField = document.getElementById('tileBathLocation');
            if (this.checked) {
                bathLocationField.classList.remove('hidden');
            } else {
                bathLocationField.classList.add('hidden');
            }
        });

        // Initialize with today's date
        document.addEventListener('DOMContentLoaded', function() {
            const today = new Date().toISOString().split('T')[0];
            document.getElementById('projectDate').value = today;
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=rdowns/pcc-tools" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>