/* =========================================
   NEW AND IMPROVED TUTORIAL.CSS
   ========================================= */

/* --- Custom Properties (CSS Variables) for Easy Theming --- */
:root {
    --primary-color: #5A67D8; /* A modern, friendly blue/indigo */
    --primary-color-dark: #434190;
    --text-color-primary: #2d3748;
    --text-color-secondary: #4a5568;
    --text-color-light: #718096;
    --background-color-light: #f7fafc;
    --border-color: #e2e8f0;
    --white-color: #ffffff;
    --code-bg-color: #f8f9fa;
    --shadow-color: rgba(0, 0, 0, 0.08);
}

/* --- Course Sidebar --- */
.course-sidebar {
    background: var(--white-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 25px var(--shadow-color);
    height: fit-content;
    min-width: 300px;
    position: sticky;
    top: 120px;
    border: 1px solid var(--border-color);
    max-height: calc(100vh - 140px); /* Adjusted for padding */
    overflow-y: auto;
}

/* Modern Scrollbar Styling */
.course-sidebar::-webkit-scrollbar {
    width: 8px;
}

.course-sidebar::-webkit-scrollbar-track {
    background: var(--background-color-light);
    border-radius: 4px;
}

.course-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.course-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color-dark);
}

/* --- Sidebar Sections --- */
.course-section {
    margin-bottom: 2rem;
}

.course-section:last-child {
    margin-bottom: 0;
}

.course-section h4 {
    color: var(--text-color-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.course-section ul {
    list-style: none;
    padding-left: 0;
}

.course-section li {
    margin-bottom: 0.25rem;
}

.course-section a {
    color: var(--text-color-secondary);
    text-decoration: none;
    padding: 0.6rem 1rem;
    display: block;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
}

.course-section a:hover {
    background-color: var(--background-color-light);
    color: var(--primary-color);
    transform: translateX(4px);
}

.course-section a.active {
    background-color: var(--primary-color);
    color: var(--white-color);
    font-weight: 600;
}

/* --- Main Tutorial Content --- */
.tutorial-content {
    background: var(--white-color);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 5px 25px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.tutorial-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2.5rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: var(--white-color);
    border-radius: 12px;
}

.tutorial-header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.tutorial-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* --- Lesson Styling --- */
.lesson {
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
}

.lesson:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.lesson h2 {
    color: var(--text-color-primary);
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
}

.lesson h3 {
    color: var(--text-color-primary);
    margin: 2.5rem 0 1.5rem;
    font-size: 1.6rem;
    font-weight: 600;
}

.lesson h4 {
    color: var(--text-color-secondary);
    margin: 2rem 0 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.lesson p {
    color: var(--text-color-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.lesson ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.lesson li {
    color: var(--text-color-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

/* --- Modern Code Block Styling --- */
.lesson pre {
    background: var(--code-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 5px solid var(--primary-color);
    overflow-x: auto;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* --- Example Output Box --- */
.example-output {
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.example-output h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

/* --- Modern & Responsive Table Styling --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 1rem;
    border-radius: 8px;
    overflow: hidden; /* For border-radius to work on child elements */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    background-color: var(--background-color-light);
    color: var(--text-color-primary);
    font-weight: 600;
}
tr:last-child td {
    border-bottom: none;
}
tr:hover {
    background-color: #fdfdff;
}

/* --- Navigation Buttons --- */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--white-color);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(90, 103, 216, 0.3);
}

.nav-btn:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(90, 103, 216, 0.4);
}

/* --- Sidebar Toggle Button (for mobile) --- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 85px;
    left: 20px;
    z-index: 1001;
    background: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--primary-color-dark);
    transform: scale(1.1);
}

.sidebar-toggle i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    .course-sidebar {
        position: static;
        min-width: auto;
        max-height: none;
        margin-bottom: 2rem;
        top: auto;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .course-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        border-right: 1px solid var(--border-color);
        margin-bottom: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    .course-sidebar.active {
        left: 0;
        box-shadow: 0 0 40px rgba(0,0,0,0.2);
    }
    .main-content {
        width: 100%;
        margin-left: 0;
    }
    .tutorial-content {
        padding: 1.5rem;
        margin-top: 80px; /* Space for toggle button */
    }
    .tutorial-header h1 { font-size: 2rem; }
    .lesson h2 { font-size: 1.8rem; }
    .navigation-buttons { flex-direction: column; gap: 1rem; }
    .nav-btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .tutorial-content { padding: 1rem; }
    .tutorial-header { padding: 2rem 1rem; }
    .tutorial-header h1 { font-size: 1.8rem; }
    .lesson h2 { font-size: 1.5rem; }
    .lesson h3 { font-size: 1.3rem; }
    .lesson p { font-size: 1rem; }
}