:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --highlight-color: #e74c3c;
    --background-color: #f8f9fa;
    --sidebar-bg: #2c3e50;
    --text-color: #333;
    --light-text: #f8f9fa;
    --code-bg: #f1f2f6;
    --border-color: #ddd;
}

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

.container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    transition: margin-right 0.3s ease;
}

h1, h2, h3, h4 {
    color: var(--primary-color);
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}

h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 10px;
}

h3 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

code {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--code-bg);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background-color: var(--code-bg);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    border-left: 4px solid var(--accent-color);
}

pre code {
    background-color: transparent;
    padding: 0;
}

.r-code {
    background-color: #f5f5f5;
    color: #24292e;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    overflow-x: auto;
    border-left: 4px solid var(--accent-color);
}

.explanation {
    background-color: #e8f4f8;
    padding: 10px 15px;
    border-radius: 5px;
    margin: 15px 0;
    border-left: 4px solid #2980b9;
}

.explanation h4 {
    margin-top: 0;
    color: #2980b9;
}

.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
}

th, td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

th {
    background-color: var(--accent-color);
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

.sidebar {
    position: fixed;
    top: 20px;
    right: 0;
    width: 300px;
    height: calc(100vh - 40px);
    background-color: var(--sidebar-bg);
    color: var(--light-text);
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 5px 0 0 5px;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.sidebar-toggle:hover {
    background-color: #2980b9;
}

.sidebar h3 {
    color: white;
    margin-top: 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
}

.sidebar li {
    margin-bottom: 10px;
}

.sidebar a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.sidebar a:hover {
    background-color: rgba(255,255,255,0.1);
}

.sidebar .sub-menu {
    padding-left: 20px;
    display: none;
}

.sidebar .menu-item.active .sub-menu {
    display: block;
}

.sidebar .menu-item > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .menu-item > a::after {
    content: '+';
    font-size: 1.2em;
}

.sidebar .menu-item.active > a::after {
    content: '-';
}

.emoji {
    font-style: normal;
    margin-right: 8px;
}

.highlight {
    background-color: #ffffcc;
    padding: 2px;
}

hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    margin: 2rem 0;
}

.exercise-section {
    background-color: #e8f8e8;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #27ae60;
}

.solution-section {
    background-color: #f8e8e8;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #e74c3c;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
}
