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

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
    --dark: #2d3748;
    --light: #f7fafc;
    --gray: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
}

.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 150px);
}

.sidebar {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.topic-list {
    list-style: none;
}

.topic-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--light);
}

.topic-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.topic-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
}

.topic-item.completed::after {
    content: '✓';
    margin-left: auto;
    font-weight: bold;
    color: var(--success-color);
}

.topic-item.active.completed::after {
    color: white;
}

.topic-icon {
    font-size: 1.25rem;
}

.content {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.lesson-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.lesson-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--gray);
    margin-bottom: 2rem;
}

.lesson-description p {
    margin-bottom: 1rem;
}

.lesson-description ul, .lesson-description ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.lesson-description li {
    margin-bottom: 0.5rem;
}

.code-example {
    margin: 2rem 0;
}

.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.code-block::before {
    content: attr(data-lang);
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
}

.code-block pre {
    margin: 0;
}

.try-it-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.interactive-demo {
    margin: 2rem 0;
}

.demo-box {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    background: var(--light);
    margin: 1rem 0;
}

.demo-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.quiz-section {
    margin-top: 3rem;
    padding: 2rem;
    background: #f0f4ff;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.quiz-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.quiz-question {
    margin-bottom: 2rem;
}

.quiz-question h4 {
    margin-bottom: 1rem;
    color: var(--dark);
}

.quiz-options {
    list-style: none;
}

.quiz-option {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-option:hover {
    border-color: var(--primary-color);
    background: #f7f9fc;
}

.quiz-option.selected {
    border-color: var(--primary-color);
    background: #e6efff;
}

.quiz-option.correct {
    border-color: var(--success-color);
    background: #c6f6d5;
}

.quiz-option.incorrect {
    border-color: var(--danger-color);
    background: #fed7d7;
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.quiz-feedback.correct {
    background: #c6f6d5;
    color: #22543d;
}

.quiz-feedback.incorrect {
    background: #fed7d7;
    color: #742a2a;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: #edf2f7;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.code-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 2rem;
}

.code-editor-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--dark);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-btn:hover {
    background: var(--light);
    color: var(--dark);
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.5rem;
    flex: 1;
    overflow: hidden;
}

.editor-pane, .preview-pane {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.editor-tabs {
    display: flex;
    background: var(--light);
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--gray);
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.code-input {
    flex: 1;
    padding: 1rem;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: none;
    display: none;
    background: #1e293b;
    color: #e2e8f0;
}

.code-input.active {
    display: block;
}

.code-input:focus {
    outline: none;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--light);
    border-bottom: 2px solid var(--border-color);
}

#preview {
    flex: 1;
    border: none;
    background: white;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .editor-container {
        grid-template-columns: 1fr;
    }

    .preview-pane {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .progress-bar {
        order: 3;
        width: 100%;
    }

    .content {
        padding: 1.5rem;
    }

    .navigation-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
