:root {
    --primary-color: #4A90E2; /* A nice, friendly blue */
    --secondary-color: #50E3C2; /* A vibrant teal/mint for accents */
    --dark-color: #333;
    --light-color: #f4f4f4;
    --white-color: #fff;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--white-color);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: var(--white-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo img {
    height: 50px;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin: 0 15px;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 600;
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 5px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 15px;
}

#language-selector {
    padding: 8px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    background-color: var(--white-color);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-success {
    background-color: var(--secondary-color);
    color: var(--white-color);
}

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

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.9rem;
}

/* Helper Classes */
.hidden {
    display: none !important;
}

/* User Profile */
#user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

#username-display {
    font-weight: 600;
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 5%;
    min-height: 80vh;
    background: linear-gradient(135deg, #f9f9ff, #eef4ff);
    overflow: hidden;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    padding-right: 2rem;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 2rem;
}

.hero-image {
    flex: 1;
    text-align: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
}

/* Courses Section */
.courses-section {
    padding: 4rem 5%;
    text-align: center;
}

.courses-section h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.grade-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.grade-card {
    background: var(--white-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.grade-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.2);
}

.grade-card img {
    height: 80px;
    margin-bottom: 1rem;
}

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

.grade-card p {
    color: #777;
}

/* Part Card (reusing grade-card style) */
.part-card {
    background: var(--white-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border-top: 5px solid var(--secondary-color);
}

.part-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(80, 227, 194, 0.2);
    border-top-color: var(--primary-color);
}

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

.part-card p {
    color: #777;
}

/* Course List Section */
.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem auto;
    text-align: left;
}

.course-item {
    background: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    border-left: 5px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.course-item h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.course-item p {
    color: #666;
    margin-bottom: 1rem;
}

.course-item .btn {
    width: 100%;
}

/* Course Content Section */
#course-content-body {
    background: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto 2rem auto;
    text-align: left;
}

.video-placeholder {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #222;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-placeholder::before {
    content: '►';
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: color 0.3s ease;
}

.video-placeholder:hover::before {
    color: var(--white-color);
}

#course-content-body p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #555;
}

/* Test Section */
#test-body {
    background: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto 2rem auto;
    text-align: left;
}

.test-question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.test-options {
    list-style: none;
    padding: 0;
    margin: 0;
}

.test-options li {
    margin-bottom: 1rem;
}

.test-options label {
    display: block;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.test-options label:hover {
    background: #f9f9f9;
    border-color: var(--primary-color);
}

.test-options input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.test-options input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

.fill-in-the-blank input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
}

.test-actions {
    margin-top: 1rem;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--white-color);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: translateY(0);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-content h2 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 1.5rem;
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#auth-form input {
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
}

#auth-form .btn {
    padding: 12px;
    font-size: 1.1rem;
}

/* Footer */
footer {
    background: var(--dark-color);
    color: var(--light-color);
    padding: 2rem 5%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    list-style: none;
    display: flex;
    gap: 20px;
    padding-left: 0;
}

.footer-links a {
    color: var(--light-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--secondary-color);
}

/* Interactive Content Styles */
.interactive-container {
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    margin-top: 1.5rem;
}

.interactive-container h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Fraction Game */
.fraction-game {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 2rem;
    padding: 2rem 0;
}

.fraction-card {
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
}

.fraction-card:hover {
    background: #eef4ff;
    border-color: var(--primary-color);
}

.fraction-card .numerator, .fraction-card .denominator {
    display: block;
    padding: 0 1rem;
}

.fraction-card .divider {
    border-bottom: 4px solid var(--dark-color);
}

#fraction-feedback {
    margin-top: 1rem;
    font-weight: 600;
    height: 24px;
    text-align: center;
}

/* Code Challenge */
.code-challenge textarea {
    width: 100%;
    min-height: 150px;
    background: #2d2d2d;
    color: #f8f8f2;
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.code-challenge .run-btn {
    margin-right: 10px;
}

.code-challenge pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    min-height: 50px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Calculus Demo */
.calculus-demo .slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.calculus-demo input[type="range"] {
    flex-grow: 1;
    max-width: 400px;
}

.calculus-demo #slider-value {
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
    background-color: #eee;
    padding: 5px 10px;
    border-radius: 4px;
}

#course-content-body p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #555;
}

/* About Section */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    line-height: 1.8;
}

.about-content p {
    margin-bottom: 1.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--white-color);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: translateY(0);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-content h2 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 1.5rem;
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#auth-form input {
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
}

#auth-form .btn {
    padding: 12px;
    font-size: 1.1rem;
}

/* Footer */
footer {
    background: var(--dark-color);
    color: var(--light-color);
    padding: 2rem 5%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    list-style: none;
    display: flex;
    gap: 20px;
    padding-left: 0;
}

.footer-links a {
    color: var(--light-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 992px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 2rem;
    }

    .hero-content {
        padding-right: 0;
        margin-bottom: 2rem;
    }

    .hero-content h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-auth {
       display: none; /* Simple hiding for now, could be a hamburger menu */
    }

    .navbar {
        justify-content: center;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Course Navigation */
.course-navigation {
    margin-top: 2rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

#course-progress {
    font-weight: 600;
    color: #555;
}

/* New Interactive Content Styles */

/* Block Coding Adventure */
.block-coding-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.block-coding-main {
    flex: 2;
    min-width: 300px;
}
.block-coding-sidebar {
    flex: 1;
    min-width: 200px;
}
.block-grid {
    display: grid;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: #f9f9f9;
}
.grid-cell {
    width: 100%;
    padding-bottom: 100%; /* Creates square cells */
    position: relative;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
.grid-cell:nth-child(5n) { border-right: none; }
.grid-cell:nth-last-child(-n+5) { border-bottom: none; }

.grid-char, .grid-goal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
}
.grid-char { content: '🤖'; }
.grid-goal { content: '⭐'; }

.toolbox h4, .script-area h4 {
    margin-bottom: 0.5rem;
}

.toolbox {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.code-block {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: background-color 0.2s;
}
.code-block:hover {
    background-color: #3a7ac8;
}

.script-area {
    margin-top: 1rem;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 1rem;
    min-height: 150px;
}

.script-area .code-block {
    background-color: var(--secondary-color);
}
.script-area .code-block:hover {
    background-color: #40b8a0;
}

/* Puzzle Challenge */
.puzzle-container {
    max-width: 500px;
    margin: 1rem auto;
}
.puzzle-input {
    width: 100%;
    padding: 12px;
    font-size: 1.2rem;
    border-radius: var(--border-radius);
    border: 1px solid #ccc;
    text-align: center;
    margin-bottom: 1rem;
}
#puzzle-feedback {
    height: 24px;
    font-weight: 600;
}

/* Simulation Configurator */
.sim-config-container, .trig-container, .recursion-container, .algo-viz-container, .api-sim-container {
    background: #f9faff;
    border: 1px solid #eef4ff;
    padding: 1.5rem;
    border-radius: var(--border-radius);
}
.sim-controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}
#sim-canvas {
    display: block;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Trigonometry Calculator */
#trig-canvas {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    display: block;
    margin: 0 auto 1rem auto;
}

/* Recursion Visualizer */
.call-stack {
    display: flex;
    flex-direction: column-reverse;
    gap: 5px;
    background: #f4f4f4;
    padding: 1rem;
    border-radius: var(--border-radius);
    min-height: 200px;
    width: 80%;
    margin: 1rem auto;
}
.stack-frame {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    border-left: 5px solid var(--secondary-color);
}
.stack-frame.resolving {
    border-left-color: var(--primary-color);
    opacity: 0.7;
}

/* Algorithm Visualizer */
.viz-array {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 1rem 0;
    min-height: 60px;
}
.viz-element {
    width: 50px;
    height: 50px;
    background: #eee;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}
.viz-element.checking {
    background-color: #ffeaa7;
    border-color: #fdcb6e;
    transform: translateY(-10px);
}
.viz-element.found {
    background-color: var(--secondary-color);
    border-color: #00b894;
    color: white;
}

/* API Simulator */
.api-output {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: var(--border-radius);
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
}

/* Pictograph Viewer */
.pictograph-container {
    font-size: 1.2rem;
    padding: 1.5rem;
}
.pictograph-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}
.pictograph-label {
    font-weight: 600;
    width: 100px;
    flex-shrink: 0;
}
.pictograph-symbols {
    font-size: 1.8rem;
    letter-spacing: 0.5rem;
}

.test-challenge-container {
    margin: 3rem auto 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), #3a7ac8);
    color: var(--white-color);
    border-radius: var(--border-radius);
    max-width: 800px;
    text-align: center;
    box-shadow: var(--box-shadow);
}

.test-challenge-container h3 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.test-challenge-container p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    opacity: 0.9;
}