:root {
    --primary-color: #6B2FBA;
    --secondary-color: #9C5FFF;
    --accent-color: #00A5E3;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --success-color: #5cb85c;
    --error-color: #d9534f;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
}

/* Header and Logo */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    width: 60px;
    height: 60px;
    position: relative;
    margin-right: 15px;
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

.logo-inner {
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    color: white;
    font-weight: bold;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    position: relative;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.search-box input {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 30px 0 0 30px;
    font-size: 1rem;
    width: 250px;
    outline: none;
}

.search-box button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0 30px 30px 0;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.search-box button:hover {
    background-color: #0086b3;
}

/* Navigation */
nav {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

nav ul {
    display: flex;
    list-style: none;
    max-width: 1200px;
    margin: 0 auto;
}

nav a {
    display: block;
    padding: 1rem 2rem;
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: color 0.3s, border-bottom 0.3s;
    border-bottom: 3px solid transparent;
}

nav a.active, nav a:hover {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

section {
    display: none;
    padding: 2rem 0;
}

section.active-section {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

/* Feature Boxes on Home Page */
.feature-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-box {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}

.button:hover {
    background-color: var(--secondary-color);
}

/* Topics and Examples */
.topic {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.example-box {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

pre {
    background-color: #272822;
    color: #f8f8f2;
    padding: 1rem;
    overflow-x: auto;
    border-radius: 5px;
    font-family: 'Consolas', 'Monaco', monospace;
}

code {
    font-family: 'Consolas', 'Monaco', monospace;
}

.explanation {
    background-color: white;
    border-left: 4px solid var(--accent-color);
    padding: 1rem;
    margin-top: 1rem;
}

.explanation ul {
    padding-left: 1.5rem;
}

.explanation li {
    margin-bottom: 0.5rem;
}

.explanation code {
    background-color: #f1f1f1;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    color: var(--primary-color);
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 1rem;
        height: auto;
    }
    
    .logo-container {
        margin-bottom: 1rem;
    }
    
    .search-box {
        width: 100%;
        margin-left: 0;
        margin-top: 1rem;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .page-container {
        margin-top: 120px; /* Adjust for taller header on mobile */
        min-height: calc(100vh - 120px);
    }
    
    .sidebar {
        top: 120px; /* Adjust for taller header on mobile */
        height: calc(100% - 120px);
    }
    
    .sidebar-toggle {
        top: 15px; /* Keep it at the top within header on mobile */
        right: 20px;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav a {
        width: 100%;
        text-align: center;
    }
    
    .feature-boxes {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Navigation */
.page-container {
    display: flex;
    min-height: calc(100vh - 70px);
    margin-top: 70px;
}

.sidebar {
    width: 250px;
    background-color: white;
    position: fixed;
    top: 80px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 900;
    display: block; /* Ensure sidebar is visible by default */
}

.sidebar-content {
    padding: 1rem;
}

.sidebar h3 {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    border-bottom: 1px solid #ddd;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin: 0.2rem 0;
}

.sidebar ul li a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--dark-color);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 0.2s, color 0.2s, border-left 0.2s;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background-color: rgba(107, 47, 186, 0.1);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.sidebar-toggle {
    position: fixed;
    right: 20px; /* Position at right side of header instead of left side of sidebar */
    left: auto; /* Remove the left positioning */
    top: 15px; /* Position within header height */
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1001; /* Higher than header to ensure it's clickable */
    transition: background-color 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: var(--secondary-color);
}

.sidebar-toggle i {
    font-size: 1.2rem;
    color: white; /* Change icon color to white */
}

.content-wrapper {
    flex: 1;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
    padding-top: 20px;
}

.sidebar-collapsed .sidebar {
    left: -280px;
}

.sidebar-collapsed .sidebar-toggle {
    left: 20px;
}

.sidebar-collapsed .content-wrapper {
    margin-left: 0;
}

.category-section {
    display: none;
}

.category-section.active-section {
    display: block;
}

/* Topic Navigation */
.topic-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.topic-nav a {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.2s;
}

.topic-nav a:hover {
    transform: translateX(5px);
}

.topic-nav a.prev:hover {
    transform: translateX(-5px);
}

.topic-nav i {
    margin: 0 0.5rem;
}

/* Expand main content for mobile */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 250px;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .content-wrapper {
        margin-left: 0;
    }
    
    /* Show sidebar when toggle is clicked */
    .page-container:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
    }
}

/* Header logo link */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.logo-link:hover {
    opacity: 0.9;
}

.logo-link h1 {
    margin: 0 0 0 15px;
}

/* Home button in sidebar */
.home-button {
    margin: 0 0 20px 0;
    padding: 0 1rem;
}

.home-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.home-link:hover {
    background-color: var(--secondary-color);
}

.home-link i {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Adjust responsive styles */
@media (max-width: 768px) {
    .logo-link {
        flex-direction: column;
        align-items: center;
    }
    
    .logo-link h1 {
        margin: 10px 0 0 0;
        font-size: 1.5rem;
    }
    
    /* Other existing mobile styles */
}

/* Quiz Styles */
.quiz-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-top: 1rem;
}

.quiz-question {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.quiz-question:last-child {
    margin-bottom: 1rem;
    border-bottom: none;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    margin: 1rem 0;
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    margin: 0.3rem 0;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quiz-option:hover {
    background-color: #f0f0f0;
}

.quiz-option input {
    margin-right: 1rem;
}

.quiz-feedback {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 5px;
}

.quiz-feedback.correct {
    display: block;
    background-color: rgba(92, 184, 92, 0.1);
    border: 1px solid #5cb85c;
    color: #3d8b3d;
}

.quiz-feedback.incorrect {
    display: block;
    background-color: rgba(217, 83, 79, 0.1);
    border: 1px solid #d9534f;
    color: #b52b27;
}

.check-answers-btn {
    display: block;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.check-answers-btn:hover {
    background-color: var(--secondary-color);
}

/* Course Styles */
.course-progress {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.progress-bar {
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-weight: bold;
    color: var(--dark-color);
}

.course-exercises {
    margin-top: 2rem;
}

.exercise-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.exercise-header h4 {
    margin: 0;
}

.status {
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    background-color: #f0f0f0;
}

.status.completed {
    background-color: #5cb85c;
    color: white;
}

.status.in-progress {
    background-color: #f0ad4e;
    color: white;
}

.exercise-content {
    padding: 1.5rem;
}

.exercise-description {
    margin-bottom: 1rem;
}

.code-editor {
    position: relative;
    margin: 1.5rem 0;
    height: auto;
}

.code-editor pre {
    background-color: #272822;
    padding: 1rem;
    border-radius: 5px;
    display: none;
}

.code-input {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    line-height: 1.5;
    font-size: 14px;
    padding: 12px;
    resize: vertical;
    min-height: 200px;
    max-height: 400px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #272822;
    color: #f8f8f2;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
    outline: none;
}

.code-input:focus {
    outline: none;
    border-color: #6b2fba;
    box-shadow: 0 0 0 2px rgba(107, 47, 186, 0.2);
}

.editor-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.run-code-btn, .reset-code-btn, .submit-code-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 8px;
    margin-top: 10px;
}

.run-code-btn {
    background-color: #5cb85c;
}

.reset-code-btn {
    background-color: #f0ad4e;
}

.submit-code-btn {
    background-color: #337ab7;
}

.run-code-btn:hover, .submit-code-btn:hover {
    opacity: 0.9;
}

.reset-code-btn:hover {
    background-color: #e0e0e0;
}

.code-output {
    background-color: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1rem;
}

.output-display {
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    padding: 12px;
    border-radius: 4px;
    margin-top: 10px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}

.exercise-hint {
    margin-top: 1.5rem;
}

.exercise-hint details {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.exercise-hint summary {
    cursor: pointer;
    color: #6b2fba;
    font-weight: bold;
}

.exercise-hint details[open] summary {
    margin-bottom: 10px;
}

.exercise-card.locked .exercise-header {
    background-color: #f0f0f0;
}

.exercise-card.locked .status {
    background-color: #ccc;
}

.exercise-card.locked .exercise-description,
.exercise-card.locked .code-editor,
.exercise-card.locked .code-output,
.exercise-card.locked .exercise-hint {
    display: none;
}

.locked-message {
    text-align: center;
    padding: 2rem;
    color: #777;
}

.locked-message i {
    margin-right: 0.5rem;
}

/* Code Challenges */
.challenge-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.challenge-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.challenge-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.challenge-card.completed {
    border-left: 5px solid #5cb85c;
}

.challenge-card h3 {
    color: #6b2fba;
    margin-top: 0;
}

.challenge-editor {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.start-challenge-btn {
    background-color: #6b2fba;
}

.check-challenge-btn {
    background-color: #337ab7;
}

.start-challenge-btn:hover,
.check-challenge-btn:hover {
    opacity: 0.9;
}

/* Challenge hint styling */
.challenge-hint details {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.challenge-hint summary {
    cursor: pointer;
    color: #6b2fba;
    font-weight: bold;
}

.challenge-hint details[open] summary {
    margin-bottom: 10px;
}

/* Progress animation */
@keyframes progress-fill {
    0% { width: 0%; }
    100% { width: var(--target-width); }
}

.progress-fill {
    animation: progress-fill 1s ease-out forwards;
}

/* Responsive styles for course and quiz sections */
@media (max-width: 768px) {
    .challenge-list {
        grid-template-columns: 1fr;
    }
    
    .code-input {
        min-height: 150px;
    }
    
    .editor-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .editor-buttons button {
        width: 100%;
    }
}

/* Hide the sidebar toggle button */
.sidebar-toggle {
    display: none !important;
}

/* Ensure sidebar is always visible on desktop */
@media (min-width: 992px) {
    .page-container {
        grid-template-columns: 250px 1fr !important;
    }
    
    .page-container.sidebar-collapsed {
        grid-template-columns: 250px 1fr !important;
    }
    
    .sidebar {
        display: block !important;
        left: 0 !important;
    }
}