* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --text-dark: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    line-height: 1.8;
    min-height: 100vh;
}

/* ===== LAYOUT ===== */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 2px 0 20px rgba(102, 126, 234, 0.15);
    overflow-y: auto;
    position: fixed;
    height: 100vh;
    padding: 0;
    scroll-behavior: smooth;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2, #667eea);
}

.sidebar-header {
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.sidebar-header h2 {
    font-size: 1.4em;
    color: white;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header p {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.sidebar-nav {
    list-style: none;
    padding: 15px 0;
}

.sidebar-nav .nav-category {
    padding: 15px 20px 10px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-nav .nav-category:hover {
    padding-left: 22px;
    color: var(--secondary-color);
}

.sidebar-nav .nav-category::before {
    content: '';
    width: 3px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
}

.sidebar-nav .nav-item {
    padding: 0;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    border-left: 4px solid transparent;
    border-radius: 8px;
    margin: 4px 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95em;
    font-weight: 500;
    position: relative;
}

.sidebar-nav .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 8px 8px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-nav .nav-link:hover {
    background: rgba(102, 126, 234, 0.08);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    padding-left: 24px;
    transform: translateX(4px);
}

.sidebar-nav .nav-link:hover::before {
    opacity: 1;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.12), transparent);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: inset -2px 0 8px rgba(102, 126, 234, 0.1);
}

.sidebar-nav .nav-link.active::before {
    opacity: 1;
}

/* Sidebar Scrollbar indicator */
.sidebar::after {
    content: '';
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    pointer-events: none;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 40px 30px;
}

/* ===== HEADER ===== */
.page-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.page-header h1 {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.1em;
    color: var(--text-light);
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 40px;
    font-size: 2.5em;
}

h2 {
    font-size: 1.8em;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

h3 {
    font-size: 1.4em;
    color: var(--text-dark);
    margin-top: 25px;
    margin-bottom: 15px;
}

h4 {
    font-size: 1.1em;
    color: var(--text-dark);
    margin-top: 15px;
    margin-bottom: 10px;
}

p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: var(--text-dark);
}

/* ===== CONTENT SECTIONS ===== */
.lesson-section,
section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lesson-section:hover,
section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ===== NOTES SECTION ===== */
.notes-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.notes-box h4 {
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

.notes-box p {
    color: #78350f;
    margin: 0;
}

/* ===== EXAMPLE SECTION ===== */
.example-box {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.example-box h4 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

/* ===== CODE SECTION ===== */
.code-box {
    background: #1e293b;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    overflow-x: auto;
}

code {
    font-family: 'Courier New', 'Courier', monospace;
    color: #e2e8f0;
    font-size: 0.95em;
    line-height: 1.6;
}

.code-box code {
    display: block;
}

pre {
    margin: 0;
}

/* ===== OUTPUT SECTION ===== */
.output-box {
    background: #f0fdf4;
    border-left: 4px solid var(--success-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.output-box h4 {
    color: #166534;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

.output-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

/* ===== PRACTICE ASSIGNMENTS ===== */
.assignments-section {
    background: linear-gradient(135deg, #f093fb15, #667eea15);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    border: 2px solid var(--border-color);
}

.assignments-section h2 {
    color: var(--secondary-color);
}

.assignment-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.assignment-card h4 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.assignment-card .difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 10px;
}

.difficulty.easy {
    background: #d1fae5;
    color: #065f46;
}

.difficulty.medium {
    background: #fef3c7;
    color: #92400e;
}

.difficulty.hard {
    background: #fee2e2;
    color: #991b1b;
}

.assignment-card ul,
.assignment-card ol {
    margin: 15px 0;
    padding-left: 20px;
}

.assignment-card li {
    margin: 8px 0;
    line-height: 1.6;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: var(--bg-light);
}

/* ===== LISTS ===== */
ul,
ol {
    margin: 15px 0;
    padding-left: 30px;
}

li {
    margin: 8px 0;
    line-height: 1.8;
}

/* ===== BUTTONS ===== */
button,
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    background: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
}

/* ===== FORMS ===== */
label {
    display: block;
    margin: 15px 0 8px;
    font-weight: 600;
    color: var(--text-dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1em;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== FOOTER ===== */
footer {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== UTILITIES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-primary {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px;
    }

    .page-header {
        padding: 25px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
        box-shadow: 2px 0 25px rgba(102, 126, 234, 0.2);
    }

    .sidebar-header {
        padding: 25px 18px;
    }

    .sidebar-header h2 {
        font-size: 1.3em;
    }

    .main-content {
        margin-left: 240px;
        padding: 30px 20px;
    }

    .page-header h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.4em;
    }

    .sidebar-nav .nav-link {
        padding: 11px 16px;
        font-size: 0.92em;
    }

    .sidebar-nav .nav-link:hover {
        padding-left: 22px;
    }

    /* Responsive Tables */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }

    .main-content {
        margin-left: 260px;
    }
}

@media (max-width: 850px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        padding: 25px 18px;
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 30px rgba(0, 0, 0, 0.3);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 20px 15px;
    }

    .sidebar-header h2 {
        font-size: 1.2em;
    }

    .sidebar-nav .nav-category {
        padding: 12px 15px 8px;
        font-size: 0.7em;
    }

    .sidebar-nav .nav-link {
        padding: 10px 15px;
        font-size: 0.9em;
        margin: 2px 4px;
    }

    .sidebar-nav .nav-link:hover {
        padding-left: 20px;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        width: 100%;
    }

    .page-header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.2em;
    }

    h3 {
        font-size: 1.1em;
    }

    /* Mobile menu toggle button */
    .menu-toggle {
        display: flex;
        position: fixed;
        bottom: 30px;
        right: 30px;
        width: 50px;
        height: 50px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        z-index: 999;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 24px;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        transition: all 0.3s ease;
    }

    .menu-toggle:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    }

    .menu-toggle:active {
        transform: scale(0.95);
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 15px 12px;
    }

    .page-header h1 {
        font-size: 1.3em;
    }

    .page-header p {
        font-size: 0.95em;
    }

    h2 {
        font-size: 1.1em;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    h3 {
        font-size: 1em;
    }

    .main-content {
        padding: 12px;
    }

    .lesson-section {
        padding: 18px;
        margin-bottom: 18px;
    }
}

/* Scroll to Top Button Styling */
.scroll-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    z-index: 998;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    justify-content: center;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

.scroll-to-top.show {
    display: flex;
}

.highlight {
    color: yellow;
}

.container {
    background: #e8eef7;
    padding: 15px;
    border: 2px dashed #667eea;
    border-radius: 8px;
    margin: 8px 0;
}

.demo {
    padding: 12px;
    background: #fafafa;
    border-radius: 8px;
    margin: 12px 0;
}

.box {
    background: #f0f0f0;
    padding: 10px;
    margin: 5px 0;
    border-left: 4px solid #667eea;
}