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

:root {
    --js-yellow: #F7DF1E;
    --js-black: #000000;
    --js-dark-gray: #323330;
    --js-yellow-darker: #e4ce0d;
    --js-yellow-lighter: #fae94e;
    
    /* Light theme (default) - Yellow background, black text */
    --primary-color: #000000;
    --primary-hover: #323330;
    --secondary-color: #323330;
    --success-color: #0d7c0d;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --text-primary: #000000;
    --text-secondary: #323330;
    --bg-primary: #F7DF1E;
    --bg-secondary: #e4ce0d;
    --bg-tertiary: #d4be0d;
    --border-color: #000000;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.3s ease;
    
    /* Code syntax colors */
    --code-keyword: #C586C0;
    --code-string: #CE9178;
    --code-number: #B5CEA8;
    --code-comment: #6A9955;
    --code-function: #DCDCAA;
    --code-variable: #9CDCFE;
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
}

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

.navbar {
    background-color: var(--js-black);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--js-yellow);
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--js-yellow);
}

.nav-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-btn {
    background: none;
    border: 2px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--js-yellow);
    transition: var(--transition);
}

.nav-btn:hover {
    background-color: var(--js-yellow);
    color: var(--js-black);
    border-color: var(--js-yellow);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.stat-card {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 2px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background-color: var(--bg-tertiary);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: var(--text-secondary);
}

.progress-overview {
    margin: 3rem 0;
}

.progress-overview h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.overall-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 1.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar.small {
    height: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.6s ease;
    border-radius: 9999px;
}

.progress-text {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
}

.modules {
    margin: 3rem 0;
}

.modules h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* Smart grid layout adjustment for uneven items */
.modules-grid > :nth-last-child(1):nth-child(3n + 1) {
    grid-column: 1 / -1;
    max-width: calc(33.333% - 1.333rem);
    margin: 0 auto;
}

.modules-grid > :nth-last-child(2):nth-child(3n + 1),
.modules-grid > :nth-last-child(2):nth-child(3n + 1) ~ * {
    grid-column: span 1;
}

.modules-grid > :nth-last-child(2):nth-child(3n + 1) {
    margin-left: calc(16.666% + 0.666rem);
}

@media (max-width: 1024px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modules-grid > :nth-last-child(1):nth-child(2n + 1) {
        grid-column: 1 / -1;
        max-width: calc(50% - 1rem);
        margin: 0 auto;
    }
    
    .modules-grid > :nth-last-child(2):nth-child(3n + 1),
    .modules-grid > :nth-last-child(2):nth-child(3n + 1) ~ * {
        grid-column: span 1;
        margin-left: 0;
    }
}

.module-card {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.module-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.module-header i {
    font-size: 2rem;
    color: var(--primary-color);
}

.module-header h3 {
    font-size: 1.25rem;
    flex: 1;
}

.module-topics {
    list-style: none;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.module-topics li {
    padding: 0.25rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.module-topics li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.module-footer {
    margin-top: auto;
    padding-top: 1.5rem;
}

.module-progress {
    margin-bottom: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--js-black);
    color: var(--js-yellow);
    border: 2px solid var(--js-black);
}

.btn-primary:hover {
    background-color: var(--js-yellow);
    color: var(--js-black);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    color: var(--bg-primary);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: 2px solid var(--danger-color);
}

.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.btn-warning {
    background-color: var(--js-yellow);
    color: var(--js-black);
    border: 2px solid var(--js-yellow);
}

.btn-warning:hover {
    background-color: var(--js-yellow-darker);
    border-color: var(--js-yellow-darker);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Ensure black text on yellow backgrounds */
[style*="background-color: #F7DF1E"],
[style*="background-color: var(--js-yellow)"],
.bg-yellow {
    color: var(--js-black) !important;
}

/* Fix any buttons with yellow background */
.btn[style*="background-color: #F7DF1E"],
.btn[style*="background-color: var(--js-yellow)"] {
    color: var(--js-black) !important;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .modules-grid > :nth-last-child(1):nth-child(3n + 1),
    .modules-grid > :nth-last-child(2):nth-child(3n + 1),
    .modules-grid > :nth-last-child(2):nth-child(3n + 1) ~ * {
        grid-column: span 1;
        max-width: 100%;
        margin: 0;
    }
    
    .nav-container {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}

.lesson-container {
    max-width: 900px;
    margin: 0 auto;
}

.lesson-header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.lesson-content {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.code-editor {
    margin: 1.5rem 0;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.editor-tabs {
    display: flex;
    gap: 1rem;
}

.editor-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.editor-tab:hover {
    color: var(--text-primary);
}

.editor-tab.active {
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.editor-btn {
    padding: 0.5rem 1rem;
    background-color: var(--js-black);
    color: var(--js-yellow);
    border: 2px solid var(--js-black);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

.editor-btn:hover {
    background-color: var(--js-yellow);
    color: var(--js-black);
}

.editor-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 400px;
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
}

.code-input {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    padding: 1rem;
    border: none;
    background-color: var(--code-bg);
    color: var(--code-text);
    resize: none;
    outline: none;
}

.code-output {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.output-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.exercise-section {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.exercise-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.exercise-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.exercise-content {
    margin-bottom: 1.5rem;
}

.exercise-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.option-btn {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    color: var(--text-primary);
    width: 100%;
}

.option-btn:hover:not(:disabled):not(.correct):not(.incorrect) {
    border-color: var(--primary-color);
    background-color: var(--bg-tertiary);
}

.option-btn.correct {
    border-color: var(--success-color) !important;
    background-color: rgba(16, 185, 129, 0.25) !important;
    color: var(--success-color) !important;
    font-weight: 600;
}

.option-btn.incorrect {
    border-color: var(--danger-color) !important;
    background-color: rgba(239, 68, 68, 0.25) !important;
    color: var(--danger-color) !important;
    font-weight: 600;
}

.option-btn.correct:disabled,
.option-btn.incorrect:disabled {
    opacity: 1;
    cursor: not-allowed;
}

.feedback, .exercise-feedback {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback.show, .exercise-feedback.show {
    display: block;
    opacity: 1;
}

.feedback.success, .exercise-feedback.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.feedback.error, .exercise-feedback.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.hint-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.hint-content {
    background-color: rgba(247, 223, 30, 0.1);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    display: none;
}

.hint-content.show {
    display: block;
}

/* Strong element spacing in content boxes */
.info-box strong,
.warning-box strong,
.concept-card strong,
.real-world-example strong,
.mistake-box strong,
.exercise-header strong,
.summary-box strong {
    display: inline-block;
    margin-top: 0.25rem;
}

/* Heading spacing in content sections */
.content-section > h1:first-child,
.content-section > h2:first-child,
.content-section > h3:first-child,
.exercise-section > h1:first-child,
.exercise-section > h2:first-child,
.exercise-section > h3:first-child {
    margin-top: 1.5rem;
}

/* Ensure consistent spacing for all headings that are first children */
section > h1:first-child,
section > h2:first-child,
section > h3:first-child {
    margin-top: 1.5rem;
}