Spaces:
Running

File size: 47,470 Bytes
877b676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ICT Antigravity AI - Dashboard</title>
    
    <!-- Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>
    
    <!-- FontAwesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <!-- React & ReactDOM -->
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    
    <!-- Babel for JSX -->
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>

    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    <script>
        tailwind.config = {
            theme: {
                extend: {
                    fontFamily: {
                        sans: ['Inter', 'sans-serif'],
                    },
                    colors: {
                        gray: {
                            850: '#1f2937',
                            950: '#020617',
                        },
                        blue: {
                            500: '#3b82f6',
                            600: '#2563eb',
                            700: '#1d4ed8',
                        }
                    }
                }
            }
        }
    </script>
    
    <style>
        body {
            background-color: #020617;
            color: #e2e8f0;
        }
        /* Custom Scrollbar */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-track {
            background: #1e293b; 
        }
        ::-webkit-scrollbar-thumb {
            background: #475569; 
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: #64748b; 
        }
        
        .glass-panel {
            background: rgba(30, 41, 59, 0.7);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
    </style>
</head>
<body>
    <div id="root"></div>

    <script type="text/babel">
        const { useState, useEffect, useMemo } = React;

        // --- Mock Data ---
        const MOCK_CONCEPTS = [
            {
                id: 'ict-001',
                title: 'Fair Value Gap (FVG)',
                type: 'core_concept',
                description: 'A three-candle imbalance in price delivery often used as a target or entry.',
                confidence: 94,
                entry: { bullish: 'Price retraces into the FVG after a displacement leg.', bearish: 'Price rallies into the FVG after a bearish displacement.' },
                stop_loss: { bullish: 'Below the swing low creating the FVG.', bearish: 'Above the swing high creating the FVG.' },
                take_profits: [{ description: 'Opposing FVG' }, { description: 'Previous High/Low' }, { description: 'Equilibrium (50%)' }],
                invalidation: 'Price closes beyond the origin of the displacement candle.',
                confluence_factors: ['Market Structure Shift (MSS)', 'Time of Day (Killzone)', 'Premium/Discount Array'],
                confidence_boost: 'FVG aligns with a 4H Order Block.',
                notes: 'FVGs are most potent when occurring during the London or NY Killzone.',
                conditions: [{ type: 'Trend', description: 'Must align with higher timeframe bias.' }, { type: 'Liquidity', description: 'Liquidity sweep prior to displacement.' }],
                timestamp_examples: ['London Killzone - 02:00 AM EST', 'NY Killzone - 08:30 AM EST'],
                video_title: 'ICT 2022 Mentorship - Episode 1',
                video_id: '8s1w7s1w7s1' 
            },
            {
                id: 'ict-002',
                title: 'Order Blocks',
                type: 'strategy',
                description: 'Specific candles representing institutional buying or selling interest.',
                confidence: 88,
                entry: { bullish: 'Limit order at the open or 50% mean threshold of the OB.', bearish: 'Limit order at the open or 50% mean threshold of the OB.' },
                stop_loss: { bullish: 'Below the OB low.', bearish: 'Above the OB high.' },
                take_profits: [{ description: 'Nearest internal liquidity' }, { description: 'External Range Liquidity' }],
                invalidation: 'Price closes through the OB body.',
                confluence_factors: ['Break of Structure', 'FVG presence', 'Time alignment'],
                confidence_boost: 'OB formed after a liquidity sweep.',
                notes: 'Focus on unmitigated order blocks for the highest probability setups.',
                conditions: [{ type: 'Structure', description: 'Must break structure to be valid.' }, { type: 'Mitigation', description: 'Must be fresh (unmitigated).' }],
                timestamp_examples: ['London Open - 03:00 AM EST', 'NY AM Session - 09:30 AM EST'],
                video_title: 'Market Maker Primer Course',
                video_id: '9s2w8s2w8s2'
            },
            {
                id: 'ict-003',
                title: 'Liquidity Voids',
                type: 'supporting_concept',
                description: 'Areas where price moved rapidly, leaving unfilled orders.',
                confidence: 82,
                entry: { bullish: 'Retest of the void bottom.', bearish: 'Retest of the void top.' },
                stop_loss: { bullish: 'Below the void.', bearish: 'Above the void.' },
                take_profits: [{ description: 'Fill of the void (100%)' }, { description: 'Opposing liquidity pool' }],
                invalidation: 'Price does not respect the void boundary.',
                confluence_factors: ['Session High/Low', 'Psychological Levels'],
                confidence_boost: 'Void created on high volume news release.',
                notes: 'Voids act as magnets for price.',
                conditions: [{ type: 'Velocity', description: 'Rapid price movement required.' }],
                timestamp_examples: ['News Events - 08:30 AM EST'],
                video_title: 'Algo Trading Concepts',
                video_id: '7s3w9s3w9s3'
            }
        ];

        const MOCK_PAIRS = [
            { id: 1, symbol: 'EURUSD', name: 'Euro / US Dollar', asset_class: 'Forex', price: '1.0845', change: 0.45, trend: 'bullish', signal: 'bullish', confidence: 85, phase: 'markup', lastUpdate: '10s ago' },
            { id: 2, symbol: 'GBPUSD', name: 'British Pound / US Dollar', asset_class: 'Forex', price: '1.2630', change: -0.12, trend: 'bearish', signal: 'bearish', confidence: 78, phase: 'distribution', lastUpdate: '15s ago' },
            { id: 3, symbol: 'BTCUSD', name: 'Bitcoin / US Dollar', asset_class: 'Crypto', price: '64,230', change: 2.30, trend: 'bullish', signal: 'bullish', confidence: 92, phase: 'accumulation', lastUpdate: '5s ago' },
            { id: 4, symbol: 'XAUUSD', name: 'Gold / US Dollar', asset_class: 'Commodity', price: '2,035.50', change: 0.05, trend: 'neutral', signal: 'neutral', confidence: 50, phase: 'depreciation', lastUpdate: '30s ago' },
            { id: 5, symbol: 'US30', name: 'Dow Jones Industrial', asset_class: 'Index', price: '38,500', change: -0.85, trend: 'bearish', signal: 'bearish', confidence: 65, phase: 'distribution', lastUpdate: '1m ago' },
            { id: 6, symbol: 'NAS100', name: 'Nasdaq 100', asset_class: 'Index', price: '17,800', change: 1.10, trend: 'bullish', signal: 'neutral', confidence: 60, phase: 'markup', lastUpdate: '45s ago' },
        ];

        const CATEGORIES = [
            { id: 'all', name: 'All Concepts' },
            { id: 'core_concept', name: 'Core Concepts' },
            { id: 'strategy', name: 'Strategies' },
            { id: 'risk_management', name: 'Risk Management' },
            { id: 'supporting_concept', name: 'Supporting' },
        ];

        // --- Components ---

        const Header = ({ 
            isScannerActive, 
            onToggleScanner, 
            searchQuery, 
            onSearchChange,
            marketStatus
        }) => {
            return (
                <header className="h-16 border-b border-gray-700 flex items-center justify-between px-6 bg-gray-900 shadow-lg z-50 relative">
                    <div className="flex items-center gap-3">
                        <div className="p-2 bg-blue-600/10 rounded-lg border border-blue-500/30">
                            <i className="fa-solid fa-chart-line text-blue-400 text-xl"></i>
                        </div>
                        <h1 className="font-semibold text-lg tracking-tight text-white">ICT Antigravity AI</h1>
                        <span className="px-2 py-0.5 text-xs font-medium bg-green-500/10 text-green-400 border border-green-500/20 rounded-full animate-pulse hidden sm:inline-block">
                            {marketStatus}
                        </span>
                    </div>
                    
                    <div className="flex items-center gap-4">
                        <div className="flex items-center gap-2 bg-gray-800 rounded-lg p-1 border border-gray-600 w-64">
                            <input
                                type="text"
                                placeholder="Search concepts..."
                                value={searchQuery}
                                onChange={(e) => onSearchChange(e.target.value)}
                                className="bg-transparent border-none text-gray-200 text-sm focus:ring-0 w-full p-1.5 placeholder-gray-500"
                            />
                            <i className="fa-solid fa-search text-gray-400 text-sm px-2"></i>
                        </div>
                        
                        <button
                            onClick={onToggleScanner}
                            className={`px-4 py-1.5 text-sm font-medium rounded-lg transition-all duration-300 flex items-center gap-2 ${
                                isScannerActive
                                    ? 'bg-blue-600 text-white shadow-lg shadow-blue-600/20'
                                    : 'bg-gray-800 text-gray-300 hover:bg-gray-700 border border-gray-600'
                            }`}
                        >
                            {isScannerActive ? (
                                <>
                                    <i className="fa-solid fa-database"></i>
                                    <span className="hidden sm:inline">Knowledge Base</span>
                                </>
                            ) : (
                                <>
                                    <i className="fa-solid fa-magnifying-glass"></i>
                                    <span className="hidden sm:inline">Live Scanner</span>
                                </>
                            )}
                        </button>
                        
                        <a 
                            href="https://huggingface.co/spaces/akhaliq/anycoder"
                            target="_blank"
                            rel="noopener noreferrer"
                            className="text-xs font-medium text-gray-400 hover:text-blue-400 transition-colors flex items-center gap-2 px-3 py-1.5 rounded-full bg-gray-800 border border-gray-600 hover:border-blue-500/50 hover:bg-blue-500/10"
                        >
                            <span>Built with anycoder</span>
                            <i className="fa-solid fa-arrow-up-right-from-square text-[10px]"></i>
                        </a>
                    </div>
                </header>
            );
        };

        const Sidebar = ({ 
            selectedCategory, 
            onSelectCategory, 
            categories, 
            activeConceptId,
            onConceptSelect, 
            concepts, 
            filteredConcepts,
            onAddFile 
        }) => {
            const getIconForType = (type) => {
                const icons = {
                    core_concept: 'fa-book',
                    supporting_concept: 'fa-bookmark',
                    strategy: 'fa-chart-line',
                    risk_management: 'fa-shield-halved',
                    session_analysis: 'fa-clock'
                };
                return icons[type] || 'fa-file';
            };

            return (
                <aside className="w-80 bg-gray-800 border-r border-gray-700 flex flex-col h-full shadow-xl z-40 hidden lg:flex">
                    <div className="p-4 border-b border-gray-700 bg-gray-800">
                        <div className="flex items-center justify-between mb-4">
                            <h3 className="text-xs font-bold uppercase tracking-wider text-gray-400">ICT Knowledge Base</h3>
                            <span className="text-xs text-gray-500 bg-gray-900 px-2 py-0.5 rounded-md">{filteredConcepts.length} results</span>
                        </div>
                        
                        <div className="flex items-center justify-between mb-4">
                            <div className="flex items-center gap-2 text-gray-400 text-xs">
                                <i className="fa-solid fa-database"></i>
                                <span>{concepts.length} loaded</span>
                            </div>
                            <button 
                                onClick={onAddFile}
                                className="text-[10px] text-blue-400 hover:text-blue-300 hover:underline"
                                title="Simulate adding a new JSON file"
                            >
                                + Add File
                            </button>
                        </div>
                        
                        <div className="space-y-1">
                            {categories.map((category) => (
                                <button
                                    key={category.id}
                                    onClick={() => onSelectCategory(category.id)}
                                    className={`w-full text-left px-3 py-2 rounded-md text-sm font-medium transition-all duration-200 ${
                                        selectedCategory === category.id
                                            ? 'bg-blue-600/20 text-blue-400 border border-blue-500/30 shadow-sm'
                                            : 'text-gray-300 hover:bg-gray-700/50 hover:text-gray-100'
                                    }`}
                                >
                                    {category.name}
                                    {category.id === 'all' && <span className="ml-2 text-xs opacity-60">({concepts.length})</span>}
                                </button>
                            ))}
                        </div>
                    </div>
                    
                    <div className="flex-1 overflow-y-auto p-3 space-y-2 scrollbar-thin scrollbar-thumb-gray-700 scrollbar-track-transparent">
                        {filteredConcepts.length === 0 ? (
                            <div className="flex flex-col items-center justify-center h-full text-gray-500 text-sm p-4">
                                <i className="fa-regular fa-folder-open text-4xl mb-3 opacity-20"></i>
                                <p>No concepts found matching criteria</p>
                            </div>
                        ) : (
                            filteredConcepts.map((concept) => (
                                <div
                                    key={concept.id}
                                    onClick={() => onConceptSelect(concept.id)}
                                    className={`group relative p-3 rounded-lg cursor-pointer transition-all duration-200 border hover:shadow-md ${
                                        activeConceptId === concept.id
                                            ? 'bg-gradient-to-br from-blue-600/10 to-blue-700/5 border-blue-500/40 shadow-lg shadow-blue-900/20'
                                            : 'border-gray-700/50 hover:bg-gray-700 hover:border-gray-600'
                                    }`}
                                >
                                    <div className="flex items-start gap-3">
                                        <div className={`mt-1 p-1.5 rounded text-sm ${
                                            concept.type === 'core_concept' ? 'bg-blue-500/20 text-blue-400' :
                                            concept.type === 'strategy' ? 'bg-purple-500/20 text-purple-400' :
                                            concept.type === 'risk_management' ? 'bg-red-500/20 text-red-400' :
                                            'bg-orange-500/20 text-orange-400'
                                        }`}>
                                            <i className={`fa-solid ${getIconForType(concept.type)}`}></i>
                                        </div>
                                        <div className="flex-1 min-w-0">
                                            <h4 className="font-medium text-gray-200 truncate text-sm">{concept.title}</h4>
                                            <p className="text-xs text-gray-400 mt-1 line-clamp-2 leading-relaxed">{concept.description}</p>
                                            <div className="flex items-center gap-2 mt-2">
                                                <span className="text-[10px] px-2 py-0.5 rounded-full bg-green-500/10 text-green-400 border border-green-500/20 font-medium">
                                                    {concept.confidence}% Confidence
                                                </span>
                                                <span className="text-[10px] px-2 py-0.5 rounded-full bg-gray-700 text-gray-300 border border-gray-600 uppercase tracking-wide">
                                                    {concept.type.replace('_', ' ')}
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                    <div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
                                        <i className="fa-solid fa-chevron-right text-xs text-gray-500"></i>
                                    </div>
                                </div>
                            ))
                        )}
                    </div>
                    
                    <div className="p-3 border-t border-gray-700 bg-gray-800/50 text-xs text-gray-500 flex justify-between items-center">
                        <div className="flex items-center gap-2">
                            <i className="fa-solid fa-server"></i>
                            <span>v1.0.4</span>
                        </div>
                        <div className="flex items-center gap-2">
                            <div className="w-2 h-2 rounded-full bg-green-500"></div>
                            <span>Synced</span>
                        </div>
                    </div>
                </aside>
            );
        };

        const ConceptDetail = ({ concept, onBack }) => {
            if (!concept) {
                return (
                    <div className="flex-1 flex flex-col items-center justify-center text-gray-500 bg-gray-900 p-8">
                        <div className="w-24 h-24 rounded-full bg-gray-800 flex items-center justify-center mb-6 animate-pulse">
                            <i className="fa-regular fa-folder-open text-6xl opacity-20"></i>
                        </div>
                        <h3 className="text-2xl font-semibold text-gray-300 mb-3">Select a Concept</h3>
                        <p className="max-w-md text-center text-gray-400 leading-relaxed">Choose a concept from the sidebar to view detailed information, entry criteria, risk parameters, and trading strategies based on ICT principles.</p>
                    </div>
                );
            }

            const getIconForType = (type) => {
                const icons = {
                    core_concept: 'fa-book',
                    supporting_concept: 'fa-bookmark',
                    strategy: 'fa-chart-line',
                    risk_management: 'fa-shield-halved',
                    session_analysis: 'fa-clock'
                };
                return icons[type] || 'fa-file';
            };

            return (
                <div className="flex-1 flex flex-col bg-gray-900 h-full overflow-hidden">
                    {/* Header */}
                    <div className="h-16 border-b border-gray-700 flex items-center justify-between px-6 bg-gray-800/50 backdrop-blur-sm sticky top-0 z-30">
                        <div className="flex items-center gap-4">
                            {onBack && (
                                <button 
                                    onClick={onBack}
                                    className="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors"
                                >
                                    <i className="fa-solid fa-arrow-left"></i>
                                </button>
                            )}
                            <div className="flex items-center gap-3">
                                <div className={`p-2 rounded-lg ${
                                    concept.type === 'core_concept' ? 'bg-blue-500/20 text-blue-400' :
                                    concept.type === 'strategy' ? 'bg-purple-500/20 text-purple-400' :
                                    concept.type === 'risk_management' ? 'bg-red-500/20 text-red-400' :
                                    'bg-orange-500/20 text-orange-400'
                                }`}>
                                    <i className={`fa-solid ${getIconForType(concept.type)}`}></i>
                                </div>
                                <div>
                                    <h2 className="text-xl font-semibold text-gray-100">{concept.title}</h2>
                                    <p className="text-sm text-gray-400 flex items-center gap-2">
                                        {concept.description}
                                        <span className="px-2 py-0.5 bg-gray-700 rounded-full text-[10px] text-gray-300 border border-gray-600 font-mono">
                                            {concept.id.toUpperCase()}
                                        </span>
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div className="flex items-center gap-3">
                            <span className="px-3 py-1.5 bg-green-500/10 text-green-400 text-sm font-bold rounded-md border border-green-500/20 flex items-center gap-2">
                                <i className="fa-solid fa-check-circle"></i>
                                {concept.confidence}% Confidence
                            </span>
                            <button className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 rounded-md transition-all shadow-lg shadow-blue-900/20 hover:shadow-blue-600/30">
                                <i className="fa-solid fa-play"></i>
                                Backtest Strategy
                            </button>
                        </div>
                    </div>

                    {/* Content */}
                    <div className="flex-1 overflow-y-auto p-6 scrollbar-thin scrollbar-thumb-gray-700 scrollbar-track-transparent">
                        <div className="max-w-7xl mx-auto space-y-6">
                            {/* Grid Layout */}
                            <div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
                                {/* Entry Criteria */}
                                <div className="col-span-1">
                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-bullseye text-blue-400"></i>
                                                Entry Criteria
                                            </h3>
                                        </div>
                                        <div className="p-5 space-y-6">
                                            <div className="bg-blue-500/5 p-4 rounded-lg border border-blue-500/20">
                                                <h4 className="text-sm font-medium text-blue-400 mb-2 flex items-center gap-2">
                                                    <i className="fa-solid fa-arrow-up"></i>
                                                    Bullish Entry
                                                </h4>
                                                <p className="text-sm text-gray-300 leading-relaxed">{concept.entry.bullish}</p>
                                            </div>
                                            <div className="bg-red-500/5 p-4 rounded-lg border border-red-500/20">
                                                <h4 className="text-sm font-medium text-red-400 mb-2 flex items-center gap-2">
                                                    <i className="fa-solid fa-arrow-down"></i>
                                                    Bearish Entry
                                                </h4>
                                                <p className="text-sm text-gray-300 leading-relaxed">{concept.entry.bearish}</p>
                                            </div>
                                        </div>
                                    </div>

                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg mt-6">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-stopwatch text-red-400"></i>
                                                Risk Parameters
                                            </h3>
                                        </div>
                                        <div className="p-5 space-y-5">
                                            <div>
                                                <h4 className="text-sm font-medium text-gray-400 mb-3 flex items-center gap-2">
                                                    <i className="fa-solid fa-shield-halved"></i>
                                                    Stop Loss
                                                </h4>
                                                <div className="space-y-3">
                                                    <div className="p-3 bg-red-500/10 rounded-lg border border-red-500/20 flex items-start gap-3">
                                                        <i className="fa-solid fa-arrow-up text-red-400 mt-0.5"></i>
                                                        <div>
                                                            <p className="text-xs text-red-300 font-bold uppercase">Bullish Protection</p>
                                                            <p className="text-sm text-gray-300">{concept.stop_loss.bullish}</p>
                                                        </div>
                                                    </div>
                                                    <div className="p-3 bg-red-500/10 rounded-lg border border-red-500/20 flex items-start gap-3">
                                                        <i className="fa-solid fa-arrow-down text-red-400 mt-0.5"></i>
                                                        <div>
                                                            <p className="text-xs text-red-300 font-bold uppercase">Bearish Protection</p>
                                                            <p className="text-sm text-gray-300">{concept.stop_loss.bearish}</p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <div>
                                                <h4 className="text-sm font-medium text-gray-400 mb-3 flex items-center gap-2">
                                                    <i className="fa-solid fa-flag-checkered"></i>
                                                    Take Profits
                                                </h4>
                                                <div className="space-y-2">
                                                    {concept.take_profits.map((tp, idx) => (
                                                        <div key={idx} className="flex items-start gap-3 p-2 rounded-lg hover:bg-gray-700/50 transition-colors">
                                                            <span className="flex-shrink-0 w-6 h-6 rounded-full bg-green-500/20 text-green-400 flex items-center justify-center text-xs font-bold border border-green-500/30">
                                                                {idx + 1}
                                                            </span>
                                                            <span className="text-sm text-gray-300">{tp.description}</span>
                                                        </div>
                                                    ))}
                                                </div>
                                            </div>
                                            
                                            <div className="pt-4 border-t border-gray-700">
                                                <h4 className="text-sm font-medium text-gray-400 mb-2 flex items-center gap-2">
                                                    <i className="fa-solid fa-xmark"></i>
                                                    Invalidation
                                                </h4>
                                                <p className="text-sm text-gray-300 bg-gray-700/30 p-3 rounded-lg border border-gray-600/50 italic">
                                                    {concept.invalidation}
                                                </p>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                {/* Confluence Factors */}
                                <div className="col-span-1">
                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-layer-group text-purple-400"></i>
                                                Confluence Factors
                                            </h3>
                                        </div>
                                        <div className="p-5">
                                            <div className="space-y-3">
                                                {concept.confluence_factors.map((factor, idx) => (
                                                    <div key={idx} className="flex items-start gap-3 p-4 bg-gradient-to-r from-gray-800 to-gray-700/50 rounded-lg border border-purple-500/20 hover:border-purple-500/40 transition-all group">
                                                        <div className="mt-0.5 w-6 h-6 rounded-full bg-purple-500/20 text-purple-400 flex items-center justify-center text-xs font-bold border border-purple-500/30 group-hover:scale-110 transition-transform">
                                                            {idx + 1}
                                                        </div>
                                                        <p className="text-sm text-gray-300 leading-relaxed">{factor}</p>
                                                    </div>
                                                ))}
                                            </div>
                                        </div>
                                    </div>

                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg mt-6">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-chart-pie text-green-400"></i>
                                                Confidence Boosters
                                            </h3>
                                        </div>
                                        <div className="p-5 space-y-5">
                                            <div className="p-4 bg-green-500/10 rounded-lg border border-green-500/20 relative overflow-hidden">
                                                <div className="absolute top-0 right-0 p-2 opacity-10">
                                                    <i className="fa-solid fa-check-double text-4xl"></i>
                                                </div>
                                                <p className="text-sm text-green-400 font-medium leading-relaxed">{concept.confidence_boost}</p>
                                            </div>
                                            
                                            <div>
                                                <h4 className="text-sm font-medium text-gray-400 mb-2 flex items-center gap-2">
                                                    <i className="fa-solid fa-lightbulb"></i>
                                                    Expert Notes
                                                </h4>
                                                <p className="text-sm text-gray-300 leading-relaxed">{concept.notes}</p>
                                            </div>
                                        </div>
                                    </div>

                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg mt-6">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-list-check text-blue-400"></i>
                                                Conditions Checklist
                                            </h3>
                                        </div>
                                        <div className="p-5">
                                            <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
                                                {concept.conditions.map((condition, idx) => (
                                                    <div key={idx} className="flex items-start gap-3 p-3 bg-gray-700/30 rounded-lg border border-gray-600/30 hover:border-blue-500/30 transition-colors">
                                                        <div className="mt-0.5 w-5 h-5 rounded-full bg-blue-500/20 text-blue-400 flex items-center justify-center text-xs font-bold border border-blue-500/30">
                                                            {idx + 1}
                                                        </div>
                                                        <div>
                                                            <h4 className="text-xs font-medium text-gray-300 mb-1 uppercase tracking-wide">{condition.type.replace('_', ' ')}</h4>
                                                            <p className="text-sm text-gray-400">{condition.description}</p>
                                                        </div>
                                                    </div>
                                                ))}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                {/* Timing & Media */}
                                <div className="col-span-1">
                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-clock text-orange-400"></i>
                                                Timing Examples
                                            </h3>
                                        </div>
                                        <div className="p-5">
                                            <div className="space-y-3">
                                                {concept.timestamp_examples.map((example, idx) => {
                                                    const [session, time] = example.split(' - ');
                                                    return (
                                                        <div key={idx} className="flex items-start gap-3 p-3 bg-gradient-to-r from-gray-800 to-orange-900/20 rounded-lg border border-orange-500/20 hover:border-orange-500/40 transition-all group">
                                                            <div className="mt-0.5 w-8 h-8 rounded-full bg-orange-500/20 text-orange-400 flex items-center justify-center text-xs font-bold border border-orange-500/30 group-hover:scale-110 transition-transform">
                                                                {idx + 1}
                                                            </div>
                                                            <div>
                                                                <span className="inline-block px-2 py-0.5 text-[10px] font-bold text-orange-300 bg-orange-500/20 rounded mb-1 border border-orange-500/20">
                                                                    {session}
                                                                </span>
                                                                <p className="text-sm text-gray-300">{time}</p>
                                                            </div>
                                                        </div>
                                                    );
                                                })}
                                            </div>
                                        </div>
                                    </div>

                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg mt-6">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-video text-pink-400"></i>
                                                Video Source
                                            </h3>
                                        </div>
                                        <div className="p-5 space-y-4">
                                            <div className="p-4 bg-pink-500/10 rounded-lg border border-pink-500/20 relative overflow-hidden hover:bg-pink-500/15 transition-colors">
                                                <div className="absolute top-0 right-0 p-2 opacity-10">
                                                    <i className="fa-brands fa-youtube text-4xl"></i>
                                                </div>
                                                <h4 className="text-sm font-medium text-gray-300 mb-3 line-clamp-2">{concept.video_title}</h4>
                                                <a 
                                                    href={`https://www.youtube.com/watch?v=${concept.video_id}`}
                                                    target="_blank"
                                                    rel="noopener noreferrer"
                                                    className="flex items-center gap-3 text-sm text-pink-400 hover:text-pink-300 font-medium transition-colors group"
                                                >
                                                    <div className="w-8 h-8 rounded-full bg-pink-600 flex items-center justify-center group-hover:scale-110 transition-transform">
                                                        <i className="fa-solid fa-play"></i>
                                                    </div>
                                                    Watch Full Analysis
                                                    <i className="fa-solid fa-external-link-alt text-[10px]"></i>
                                                </a>
                                            </div>
                                            
                                            <div className="bg-gray-700/30 rounded-lg p-4 border border-gray-600/50">
                                                <h4 className="text-xs font-medium text-gray-400 uppercase mb-3">Resource Details</h4>
                                                <div className="flex justify-between text-sm">
                                                    <span className="text-gray-500">Length</span>
                                                    <span className="text-gray-300 font-mono">12:45</span>
                                                </div>
                                                <div className="flex justify-between text-sm mt-2">
                                                    <span className="text-gray-500">Speaker</span>
                                                    <span className="text-gray-300">ICT Master</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden shadow-lg mt-6">
                                        <div className="p-4 border-b border-gray-700 bg-gray-800/80">
                                            <h3 className="font-semibold text-gray-200 flex items-center gap-2">
                                                <i className="fa-solid fa-robot text-blue-400"></i>
                                                AI Analysis
                                            </h3>
                                        </div>
                                        <div className="p-5">
                                            <div className="p-4 bg-blue-500/5 rounded-lg border border-blue-500/20">
                                                <p className="text-sm text-gray-300 leading-relaxed">
                                                    AI Confidence Score: <span className="text-blue-400 font-bold">{concept.confidence}%</span>. Based on current market structure, this concept shows strong alignment with institutional order flow patterns. Recommended for high-probability setups.
                                                </p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            );
        };

        const Scanner = ({
            pairs,
            selectedPair,
            onSelectPair,
            filter,
            onFilterChange,
            marketStatus,
            onExecuteTrade,
            executingTrade
        }) => {
            const filteredPairs = pairs.filter(pair => {
                if (filter === 'all') return true;
                return pair.signal === filter;
            });

            return (
                <div className="flex-1 flex flex-col bg-gray-900 h-full overflow-hidden">
                    <div className="h-16 border-b border-gray-700 flex items-center justify-between px-6 bg-gray-800/50 backdrop-blur-sm sticky top-0 z-30">
                        <div className="flex items-center gap-3">
                            <h2 className="text-xl font-semibold text-gray-100">Market Scanner</h2>
                            <span className="px-2 py-0.5 text-xs font-medium bg-green-500/10 text-green-400 border border-green-500/20 rounded-full animate-pulse">
                                {marketStatus}
                            </span>
                        </div>
                        
                        <div className="flex items-center gap-4">
                            <div className="flex items-center gap-2 bg-gray-900 p-1.5 rounded-lg border border-gray-700">
                                <span className="text-sm text-gray-400 px-1">Filter:</span>
                                <select 
                                    value={filter}
                                    onChange={onFilterChange}
                                    className="bg-transparent border-none text-gray-200 text-sm focus:ring-0 cursor-pointer"
                                >
                                    <option value="all">All Signals</option>
                                    <option value="bullish">Bullish Only</option>
                                    <option value="