File size: 27,883 Bytes
baa17b5
f8cc8a4
baa17b5
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f79b32
271d759
 
 
6f79b32
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f79b32
271d759
 
 
 
 
 
 
 
 
 
 
 
 
6f79b32
271d759
 
 
6f79b32
271d759
 
 
6f79b32
271d759
 
 
 
 
 
 
 
 
6f79b32
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
271d759
14b6e5c
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
14b6e5c
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
14b6e5c
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
14b6e5c
271d759
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
14b6e5c
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6e5c
 
 
baa17b5
271d759
 
 
 
 
 
 
 
baa17b5
271d759
 
f8cc8a4
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
271d759
 
 
 
 
f8cc8a4
271d759
 
 
 
 
 
 
 
 
 
880ba2c
f8cc8a4
271d759
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
880ba2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
271d759
 
 
 
 
 
 
 
 
 
 
 
 
 
f8cc8a4
271d759
 
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
import streamlit as st
import json

# Page configuration
st.set_page_config(
    page_title="M.Sc. CS Syllabus Explorer",
    page_icon="πŸŽ“",
    layout="wide",
    initial_sidebar_state="expanded"
)

# Custom CSS for beautiful UI
st.markdown("""
<style>
    .main {
        padding-top: 2rem;
    }
    
    .stApp {
        background: white;
    }
    
    .main-header {
        background: black;
        padding: 2rem;
        border-radius: 15px;
        text-align: center;
        margin-bottom: 2rem;
        box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    }
    
    .main-header h1 {
        color: white;
        font-size: 2.5rem;
        margin: 0;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    }
    
    .main-header p {
        color: white;
        font-size: 1.2rem;
        margin: 0.5rem 0 0 0;
        opacity: 0.9;
    }
    
    .paper-card {
        background: white;
        padding: 1.5rem;
        border-radius: 15px;
        margin: 1rem 0;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        border-left: 5px solid black;
        transition: transform 0.3s ease;
    }
    
    .paper-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    }
    
    .unit-card {
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 10px;
        margin: 0.5rem 0;
        border-left: 3px solid black;
    }
    
    .topic-item {
        background: #f8f9fa;
        padding: 0.5rem;
        margin: 0.3rem 0;
        border-radius: 8px;
        border-left: 2px solid black;
    }
    
    .sidebar .sidebar-content {
        background: white;
        border-radius: 10px;
        padding: 1rem;
    }
    
    .metric-card {
        background: black;
        color: white;
        padding: 1rem;
        border-radius: 10px;
        text-align: center;
        margin: 0.5rem 0;
    }
    
    .search-box {
        background: white;
        border-radius: 10px;
        padding: 1rem;
        margin: 1rem 0;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
</style>
""", unsafe_allow_html=True)

# Syllabus data structure
syllabus_data = {
    "Programming in Java": {
        "UNIT-I": {
            "Introduction": [
                "History and features of Java",
                "Difference between C, C++ & JAVA",
                "JAVA and Internet, WWW, Web Browsers",
                "Java support system, Java Environment",
                "JDK, JVM, Byte code"
            ],
            "Java Programming Basics": [
                "Structure of Java program",
                "JAVA tokens and Statements",
                "Constants & Variables",
                "Data types",
                "Operators",
                "Command line arguments"
            ],
            "Java Statements & Arrays": [
                "if and switch statement",
                "while, do-while and for loops",
                "Introduction to arrays, types of arrays, new operator",
                "Strings, String class & its methods",
                "Vectors"
            ],
            "Classes & Objects": [
                "Specifying classes",
                "Methods and fields",
                "Creating objects",
                "Passing objects to methods, returning objects",
                "Static fields & methods",
                "Constructors",
                "Garbage collection",
                "Overloading methods & constructors",
                "this keyword"
            ]
        },
        "UNIT-II": {
            "Inheritance": [
                "Specifying sub class",
                "Types of inheritance",
                "Visibility control: public, private, protected, package",
                "super keyword",
                "Overriding methods",
                "Dynamic method dispatch",
                "Abstract methods and classes",
                "final methods & classes"
            ],
            "Packages & Interfaces": [
                "Introduction to packages, naming conventions",
                "package statement, creating packages",
                "import statement, accessing package",
                "Use of CLASSPATH, adding class to package, hiding classes",
                "Interface, implementing interfaces, multiple interfaces"
            ],
            "Multithreading": [
                "Creation threads",
                "Extending Thread class, implements Runnable interface",
                "Stopping and blocking thread",
                "Thread life cycle",
                "Thread priorities & Thread synchronization",
                "Using Thread methods"
            ]
        },
        "UNIT-III": {
            "Exception Handling": [
                "Managing errors, types of errors, exceptions",
                "Syntax of exception handling code: try, catch, throw, throws and finally statements",
                "Multiple catch & nested try statements"
            ],
            "Java Input Output": [
                "Java I/O package",
                "Byte/Character Stream",
                "Buffered reader / writer",
                "File reader / writer",
                "File Sequential / Random",
                "Reading numeric, character & strings data from keyboard"
            ],
            "Applet Programming": [
                "Applet Vs. Application",
                "Creating applets, life cycle",
                "Local & remote applets",
                "<APPLET> tag & its attributes",
                "Adding applet to HTML file, Running applet"
            ]
        },
        "UNIT-IV": {
            "Abstract Windows Toolkit (AWT)": [
                "Components and Graphics",
                "Containers, Frames and Panels",
                "Layout Managers: Border layout, Flow layout, Grid layout, Card layout",
                "AWT components",
                "Event delegation Model: Event source and handler, Event categories, Listeners, Interfaces",
                "Controls: text box, radio buttons, checkboxes, lists, choice, command buttons, text area etc."
            ],
            "JDBC (Java Database Connectivity)": [
                "Types of JDBC drivers",
                "Writing JDBC applications",
                "Types of statement objects: Statement, PreparedStatement and CallableStatement",
                "Types of resultset",
                "Inserting and updating records",
                "JDBC and AWT"
            ]
        },
        "UNIT-V": {
            "Networking with Java": [
                "Networking basics, Sockets, port",
                "Internet addressing",
                "java.net – networking classes and interfaces",
                "Implementing TCP/IP based Server and Client"
            ],
            "Servlets": [
                "Introduction Servlet API Overview",
                "Writing and running Simple Servlet, Servlet Life cycle",
                "Generic Servlet, HTTPServlet",
                "ServletConfig, ServletContest",
                "Writing Servlet to handle Get and Post methods"
            ]
        }
    },
    "Computer Graphics": {
        "UNIT-I": {
            "Graphics Systems Overview": [
                "Introduction of computer Graphics and its applications",
                "Overview of Graphics systems"
            ],
            "Video Display Devices": [
                "Raster scan display, Raster scan systems, video controller, Raster scan display processor",
                "Random scan display, random scan systems",
                "Color CRT monitor",
                "Flat panel display"
            ],
            "Interactive Input Devices": [
                "Logical classification of input devices",
                "Keyboard, mouse, Trackball and spaceball, Joysticks, Image scanner, Light pens"
            ],
            "Graphics Foundations": [
                "Graphics software",
                "Coordinates representations",
                "Graphics functions"
            ]
        },
        "UNIT-II": {
            "Drawing Algorithms": [
                "Line drawing algorithms: DDA, Bresenham's",
                "Circle generating: Mid-point circle algorithm",
                "Ellipse generating: Polynomials",
                "Scan-line polygon fill",
                "Boundary fill"
            ]
        },
        "UNIT-III": {
            "2D Transformations": [
                "Basic transformations: Translation, Rotation, Scaling",
                "Matrix representations & homogeneous co-ordinates",
                "Composite transformations: Reflection"
            ],
            "2D Viewing and Clipping": [
                "Two dimensional viewing",
                "Two dimensional clipping: Line, Polygon, Curve, Text"
            ],
            "3D Graphics": [
                "3D-transformation, Projection, Viewing, Clipping"
            ]
        },
        "UNIT-IV": {
            "Spline Representation": [
                "Cubic spline",
                "Bezier curve, Bezier surfaces",
                "Beta spline",
                "B-spline surfaces, B-spline curve"
            ],
            "Hidden Surface Removal": [
                "Hidden surfaces",
                "Hidden lines",
                "Z-buffer"
            ]
        },
        "UNIT-V": {
            "Fractals Geometry": [
                "Fractal generation procedure",
                "Classification of Fractal",
                "Fractal dimension",
                "Fractal construction methods"
            ],
            "Color and Shading": [
                "Color models: XYZ, RGB, YIQ, CMY & HSV",
                "Shading algorithms",
                "Shading model",
                "Illumination model",
                "Gouraud shading",
                "Phong shading"
            ]
        }
    },
    "LINUX": {
        "UNIT-I": {
            "Introduction to Unix/Linux": [
                "Introduction to Multi-user System",
                "Emergency and history of Unix",
                "Feature and benefits, Versions of Unix"
            ],
            "System Structure": [
                "Hardware requirements",
                "Kernel and its function",
                "Introduction to System calls and Shell"
            ],
            "File System": [
                "Feature of Unix File System",
                "Concept of i-node table, links",
                "Commonly used commands (who, pwd, cd, mkdir, rm, ls, mv, lp, chmod, cp, grep, sed, awk, pr, lex, yacc, make)",
                "Getting started (login / logout)",
                "File system management, file operation, system calls, buffer cache"
            ],
            "Vi Editor": [
                "Intro to text processing",
                "Command and edit mode, invoking vi",
                "Command structure, deleting and inserting line",
                "Deleting and replacing character, searching strings, yanking",
                "Running shell command, command macros",
                "Set windows, set auto indent, set number, intro to exrc file"
            ]
        },
        "UNIT-II": {
            "Shell Programming": [
                "Introduction to shell feature, wild card characters",
                "I/O redirections, standard error redirection",
                "System and user created shell variables, profile files",
                "Pipes/tee, background processing",
                "Command line arguments, command substitution, read statement",
                "Conditional execution of commands",
                "Special shell variables ($#, #?, $* etc.)",
                "Shift commands",
                "Loops and decision making: for, while and until",
                "Choice making using case...esac",
                "Decision making if...fi",
                "Using test, string comparison, numerical comparison, logical operation, using expr"
            ]
        },
        "UNIT-III": {
            "Advanced Shell": [
                "Features, changing the login shell",
                "cshrc, login, logout files",
                "Setting environment variables",
                "History and alias mechanism",
                "Command line arguments",
                "Redirection/appending safely, noclobber, noglob, ignore eof",
                "Directory stacks (pushd, popd)",
                "Feature of other shell (rsh, vsh)"
            ],
            "Process Control": [
                "Process management, process states and transition",
                "Regions and control of process",
                "Sleep and waking",
                "Process creation, process killing",
                "Signals",
                "System boot and init process",
                "Traps",
                "Setting process priorities"
            ]
        },
        "UNIT-IV": {
            "Inter-process Communication": [
                "I/O Sub system, terminal drives, disk drives",
                "Messages, shared memory, semaphores",
                "Memory management, swapping, demand paging"
            ],
            "System Calls and Unix-C Interface": [
                "File handling calls: access(), open(), create(), read(), write(), close(), fseek()",
                "Process control system calls: kill(), exec(), fork(), wait(), signal(), exit()",
                "Comparing stdio library and calls"
            ]
        },
        "UNIT-V": {
            "System Administration": [
                "Process and Scheduling",
                "Security",
                "Basic System Administration: Adding a User, User Passwords, Delete of a User, Adding a Group, Deleting a Group, Super User, Startup and Shutdown",
                "Advanced System Administration: Managing Disk Space, Backup and Restore, Managing System Services"
            ],
            "Xwindows": [
                "Introduction to Xwindows concept"
            ]
        }
    },
    "Image Processing": {
        "UNIT-I": {
            "Digital Image Fundamentals": [
                "Introduction",
                "An image model",
                "Sampling & quantization",
                "Basic relationships between Pixels",
                "Imaging geometry"
            ]
        },
        "UNIT-II": {
            "Image Transforms": [
                "Properties of 2 – D Fourier transform",
                "FFT algorithm and other separable image transforms",
                "Walsh transforms",
                "Hadamard, Cosine, Haar, Slant transforms, KL transforms and their properties"
            ]
        },
        "UNIT-III": {
            "Image Enhancement": [
                "Background",
                "Enhancement by point processing, histogram processing",
                "Spatial filtering and enhancement in frequency domain",
                "Color image processing"
            ],
            "Image Filtering and Restoration": [
                "Degradation model",
                "Diagnolisation of circulant and block circulate matrices",
                "Algebraic approach to restoration",
                "Inverse filtering, least mean squares and interactive restoration",
                "Geometric transformations"
            ]
        },
        "UNIT-IV": {
            "Image Compression": [
                "Fundamentals",
                "Image compression modes",
                "Error free compression, lossy compression",
                "Image compression standards"
            ],
            "Image Segmentation": [
                "Detection of discontinuities, edge linking and boundary detection",
                "Thresholding",
                "Region – oriented segmentation",
                "Use of motion in segmentation"
            ]
        },
        "UNIT-V": {
            "Representation and Description": [
                "Various schemes for representation",
                "Boundary descriptors",
                "Regional descriptors"
            ],
            "Image Reconstruction": [
                "Image reconstruction from Projections",
                "Radon Transforms",
                "Convolution/Filter back – Project Algorithms"
            ]
        }
    },
    "Object Oriented Analysis And Design": {
        "UNIT-I": {
            "Introduction to OOAD": [
                "Two views of software Developments: SSAD and OOAD",
                "Why Object –Orientation?",
                "Object and classes",
                "Abstraction and encapsulation",
                "Methods and Message",
                "Interfaces",
                "Inheritance and Polymorphism",
                "Access Control",
                "The Business case for OO Developments"
            ],
            "Object Oriented Methodologies": [
                "Object Oriented Design – Booch",
                "Object Modeling Techniques – Rumbaugh",
                "Object – Oriented Analysis – Coad-Yourdan",
                "Object – Oriented Software Engineering – Ivar Jacobson"
            ]
        },
        "UNIT-II": {
            "Unified Approach": [
                "Diagramming and Notational Techniques using the UML",
                "UML Notation",
                "Analysis Diagramming Techniques (Introduction to all ten diagrams)",
                "Design Diagramming Techniques",
                "Generalization/Specialization, Aggregation and composition, Association, Cardinality, Navigability, Icons, relationships and adornments"
            ],
            "Development Process": [
                "Rational Unified Process",
                "Four Major phases: Inception, Elaboration, Construction, Transition"
            ],
            "Requirements Engineering": [
                "Problem analysis, Understanding Stockholders need",
                "Type of requirements",
                "Use-case Model: Writing Requirements"
            ]
        },
        "UNIT-III": {
            "Analysis Phase": [
                "Behavioral Analysis",
                "Domain Analysis or Business Object Analysis",
                "Use-case Driven Object Oriented analysis: The UML approach",
                "Develop use-case Model",
                "Use-case Description",
                "Documentation, Activity Diagram",
                "Identify the classes"
            ],
            "Class Identification Approaches": [
                "'Noun Phrase' approach",
                "'Conman Class Pattern' approach",
                "'CRC' approach",
                "Use case Driven Approach"
            ],
            "Relationships": [
                "Containment and Composition, Aggregation, Inheritance",
                "SubTypes and IS-A Hierarchies",
                "Association and Link Relationships",
                "Diagramming System Events"
            ]
        },
        "UNIT-IV": {
            "Design Phases": [
                "Translating Analysis Concept into Design",
                "Optimizing classes and Objects: The Multi-tiered Architecture View",
                "Mapping System functions to objects",
                "Object to Object Visibility",
                "Collaboration Diagram",
                "Sequential Diagram",
                "Specification Class Diagram",
                "Specifying Object Interfaces",
                "Designing the Data Access layer",
                "Design User Interface layer",
                "Designing System Interfaces, Controls and Security"
            ]
        },
        "UNIT-V": {
            "Design Refinement": [
                "Designing for Extensibility",
                "Design for reusability",
                "Portioning class space",
                "Checking Completeness and correctness"
            ],
            "Database Issues": [
                "The Cood Data Management Domain",
                "Object Persistence",
                "Object-oriented Database Management System",
                "Object-Oriented verses Relational Database",
                "Mapping object to Relational Data structure"
            ],
            "Testing": [
                "Introduction to Testing Strategies",
                "Impact of Object Orientation on Testing",
                "Testing Business Process",
                "Design Matrix",
                "Discovering reusable pattern"
            ]
        }
    }
}

def main():
    # Header
    st.markdown("""
    <div class="main-header">
        <h1>πŸŽ“ M.Sc. Computer Science</h1>
        <p>Third Semester Syllabus Explorer</p>
    </div>
    """, unsafe_allow_html=True)

    # Sidebar
    st.sidebar.title("πŸ“š Navigation")
    
    # Search functionality
    search_term = st.sidebar.text_input("πŸ” Search Topics", placeholder="Enter topic to search...")
    
    # Paper selection
    selected_paper = st.sidebar.selectbox(
        "Select Paper",
        ["All Papers"] + list(syllabus_data.keys()),
        index=0
    )
    
    # Unit filter
    if selected_paper != "All Papers":
        units = list(syllabus_data[selected_paper].keys())
        selected_unit = st.sidebar.selectbox(
            "Select Unit",
            ["All Units"] + units,
            index=0
        )
    else:
        selected_unit = "All Units"
    
    # Statistics
    st.sidebar.markdown("### πŸ“Š Quick Stats")
    total_papers = len(syllabus_data)
    total_units = sum(len(paper_data) for paper_data in syllabus_data.values())
    total_topics = sum(
        len(unit_data) 
        for paper_data in syllabus_data.values() 
        for unit_data in paper_data.values()
    )
    
    col1, col2, col3 = st.sidebar.columns(3)
    with col1:
        st.markdown(f"""
        <div class="metric-card">
            <h3>{total_papers}</h3>
            <p>Papers</p>
        </div>
        """, unsafe_allow_html=True)
    with col2:
        st.markdown(f"""
        <div class="metric-card">
            <h3>{total_units}</h3>
            <p>Units</p>
        </div>
        """, unsafe_allow_html=True)
    with col3:
        st.markdown(f"""
        <div class="metric-card">
            <h3>{total_topics}</h3>
            <p>Topics</p>
        </div>
        """, unsafe_allow_html=True)

    # Main content area
    if selected_paper == "All Papers":
        display_all_papers(search_term)
    else:
        display_single_paper(selected_paper, selected_unit, search_term)

def display_all_papers(search_term=""):
    """Display all papers with search functionality"""
    st.markdown("## πŸ“– All Papers Overview")
    
    for paper_name, paper_data in syllabus_data.items():
        # Check if paper matches search
        if search_term and not matches_search(paper_name, paper_data, search_term):
            continue
            
        with st.expander(f"πŸ“„ {paper_name}", expanded=False):
            display_paper_content_no_expander(paper_data, search_term)

def display_single_paper(paper_name, selected_unit="All Units", search_term=""):
    """Display a single paper with optional unit filtering"""
    st.markdown(f"## πŸ“„ {paper_name}")
    
    paper_data = syllabus_data[paper_name]
    
    if selected_unit == "All Units":
        display_paper_content(paper_data, search_term)
    else:
        if selected_unit in paper_data:
            unit_data = {selected_unit: paper_data[selected_unit]}
            display_paper_content(unit_data, search_term)

def display_paper_content_no_expander(paper_data, search_term=""):
    """Display content of a paper without nested expanders"""
    for unit_name, unit_data in paper_data.items():
        # Check if unit matches search
        if search_term and not matches_search_unit(unit_name, unit_data, search_term):
            continue
            
        st.markdown(f"""
        <div class="unit-card">
            <h3>πŸ“š {unit_name}</h3>
        </div>
        """, unsafe_allow_html=True)
        
        for topic_name, topic_items in unit_data.items():
            # Check if topic matches search
            if search_term and not matches_search_topic(topic_name, topic_items, search_term):
                continue
                
            st.markdown(f"**πŸ“– {topic_name}**")
            for item in topic_items:
                # Highlight search terms
                if search_term and search_term.lower() in item.lower():
                    highlighted_item = item.replace(
                        search_term, 
                        f"**{search_term}**"
                    )
                    st.markdown(f"""
                    <div class="topic-item">
                        β€’ {highlighted_item}
                    </div>
                    """, unsafe_allow_html=True)
                else:
                    st.markdown(f"""
                    <div class="topic-item">
                        β€’ {item}
                    </div>
                    """, unsafe_allow_html=True)
def display_paper_content(paper_data, search_term=""):
    """Display content of a paper"""
    for unit_name, unit_data in paper_data.items():
        # Check if unit matches search
        if search_term and not matches_search_unit(unit_name, unit_data, search_term):
            continue
            
        st.markdown(f"""
        <div class="unit-card">
            <h3>πŸ“š {unit_name}</h3>
        </div>
        """, unsafe_allow_html=True)
        
        for topic_name, topic_items in unit_data.items():
            # Check if topic matches search
            if search_term and not matches_search_topic(topic_name, topic_items, search_term):
                continue
                
            with st.expander(f"πŸ“– {topic_name}", expanded=False):
                for item in topic_items:
                    # Highlight search terms
                    if search_term and search_term.lower() in item.lower():
                        highlighted_item = item.replace(
                            search_term, 
                            f"**{search_term}**"
                        )
                        st.markdown(f"""
                        <div class="topic-item">
                            β€’ {highlighted_item}
                        </div>
                        """, unsafe_allow_html=True)
                    else:
                        st.markdown(f"""
                        <div class="topic-item">
                            β€’ {item}
                        </div>
                        """, unsafe_allow_html=True)

def matches_search(paper_name, paper_data, search_term):
    """Check if paper matches search term"""
    search_term = search_term.lower()
    
    # Check paper name
    if search_term in paper_name.lower():
        return True
    
    # Check unit and topic content
    for unit_data in paper_data.values():
        if matches_search_unit("", unit_data, search_term):
            return True
    
    return False

def matches_search_unit(unit_name, unit_data, search_term):
    """Check if unit matches search term"""
    search_term = search_term.lower()
    
    # Check unit name
    if search_term in unit_name.lower():
        return True
    
    # Check topics
    for topic_name, topic_items in unit_data.items():
        if matches_search_topic(topic_name, topic_items, search_term):
            return True
    
    return False

def matches_search_topic(topic_name, topic_items, search_term):
    """Check if topic matches search term"""
    search_term = search_term.lower()
    
    # Check topic name
    if search_term in topic_name.lower():
        return True
    
    # Check topic items
    for item in topic_items:
        if search_term in item.lower():
            return True
    
    return False

if __name__ == "__main__":
    main()