* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 50%, #e0f7fa 100%);
    color: #2d2d2d;
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation Bar */
.navbar {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    color: #fff;
    font-size: 1.5em;
    font-weight: bold;
    padding: 20px 0;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 25px 20px;
    transition: background 0.3s;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    border-bottom: 3px solid #fff;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: 0.3s;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #64b5f6 0%, #42a5f5 100%);
    padding: 40px 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

header h1 {
    color: #fff;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: #f0f0f0;
    font-size: 1.2em;
}

/* Content Sections */
.content-section {
    background: #fff;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.content-section h2 {
    color: #0d47a1;
    margin-bottom: 20px;
    font-size: 2em;
}

.content-section h3 {
    color: #1565c0;
    margin: 25px 0 15px 0;
    font-size: 1.5em;
}

/* Topic Cards */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.topic-card {
    background: #fff;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
    border-left: 5px solid #42a5f5;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.topic-card h3 {
    color: #0d47a1;
    margin: 0 0 15px 0;
    font-size: 1.6em;
}

.topic-card p {
    color: #555;
    margin-bottom: 10px;
}

.topic-card .topics-list {
    list-style: none;
    margin-top: 15px;
    padding-left: 0;
}

.topic-card .topics-list li {
    padding: 5px 0;
    color: #666;
}

.topic-card .topics-list li:before {
    content: "→ ";
    color: #42a5f5;
    font-weight: bold;
}

/* Buttons */
button, .btn {
    background: #42a5f5;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover {
    background: #1976d2;
}

/* Visual Elements */
.visual-section {
    background: #fff;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #42a5f5;
}

.visual-section h4 {
    color: #0d47a1;
    margin-bottom: 15px;
}

.graph-container {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
}

/* Quiz Boxes */
.quiz-box {
    background: #fff9c4;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #fbc02d;
}

.quiz-box h4 {
    color: #f57f17;
    margin-bottom: 15px;
}

.quiz-question {
    margin: 15px 0;
    padding: 15px;
    background: #fff;
}

.quiz-options {
    margin: 10px 0;
}

.quiz-option {
    padding: 10px;
    margin: 8px 0;
    background: #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.quiz-option:hover {
    background: #e0e0e0;
}

.quiz-option.selected {
    background: #e3f2fd;
    border-left-color: #42a5f5;
}

.quiz-option.correct {
    background: #c8e6c9;
    border-left-color: #4caf50;
}

.quiz-option.incorrect {
    background: #ffcdd2;
    border-left-color: #f44336;
}

.quiz-explanation {
    display: none;
    margin-top: 10px;
    padding: 15px;
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.quiz-explanation.show {
    display: block;
}

/* Practice Tips */
.practice-tip {
    background: #d1fae5;
    padding: 15px;
    margin: 15px 0;
    border-left: 3px solid #10b981;
}

.practice-tip h4 {
    color: #065f46;
    margin-bottom: 8px;
}

/* Warning Boxes */
.warning-box {
    background: #ffe6e6;
    padding: 15px;
    margin: 15px 0;
    border-left: 3px solid #ef4444;
}

.warning-box h4 {
    color: #991b1b;
    margin-bottom: 8px;
}

/* Key Concepts */
.key-concepts {
    background: #e6f7ff;
    padding: 15px;
    margin: 15px 0;
}

.key-concepts h4 {
    color: #4a7ba7;
    margin-bottom: 10px;
}

.key-concepts ul {
    margin-left: 20px;
}

.key-concepts li {
    margin: 8px 0;
}

/* Video Recommendations */
.video-recommendations {
    background: #fff4e6;
    padding: 15px;
    margin: 15px 0;
}

.video-recommendations h4 {
    color: #d97706;
    margin-bottom: 10px;
}

.video-link {
    display: block;
    color: #2563eb;
    text-decoration: none;
    margin: 8px 0;
    padding: 8px;
    background: #fff;
    transition: background 0.2s;
}

.video-link:hover {
    background: #fffbeb;
    text-decoration: underline;
}

/* Trace Exercises */
.trace-exercise {
    background: #fce4ec;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #e91e63;
}

.trace-exercise h4 {
    color: #880e4f;
    margin-bottom: 15px;
}

.trace-step {
    background: #fff;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid #ddd;
}

.trace-step-header {
    font-weight: bold;
    color: #0d47a1;
    margin-bottom: 8px;
}

/* Self-Check */
.self-check {
    background: #f3e5f5;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #9c27b0;
}

.self-check h4 {
    color: #6a1b9a;
    margin-bottom: 15px;
}

/* Show Answer Buttons */
.show-answer-btn {
    background: #66bb6a;
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.show-answer-btn:hover {
    background: #4caf50;
}

.hidden-answer {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.hidden-answer.revealed {
    display: block;
}

/* Tables */
.complexity-table, .comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.complexity-table th,
.complexity-table td,
.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.complexity-table th,
.comparison-table th {
    background: #42a5f5;
    color: #fff;
}

.complexity-table tr:nth-child(even),
.comparison-table tr:nth-child(even) {
    background: #f9f9f9;
}

/* SVG Styles */
svg text {
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
}

/* Graph Legend */
.graph-legend {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border: 1px solid #333;
}

/* Formula */
.formula {
    background: #f0f9ff;
    padding: 10px 15px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    border-left: 3px solid #0284c7;
}

code {
    background: #f4f4f4;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    color: #c7254e;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .nav-menu.active {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-link {
        padding: 15px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .topic-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.8em;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    background: #fff;
    margin-top: 40px;
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.1);
}
