:root {
    --primary: #2563eb;
    --text: #1f2937;
    --bg: #ffffff;
    --sidebar-width: 300px;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    background: #f8fafc;
}

/* Layout principal */
.content-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Bannière */
.course-banner {
    background: linear-gradient(to right, var(--primary), #4f46e5);
    color: white;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.course-meta {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

/* Conteneur principal */
.main-wrapper {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
}

/* Contenu principal */
.markdown-container {
    flex: 1;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    min-width: 0;
}

/* Barre latérale */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    height: calc(100vh - 200px);
    overflow-y: auto;
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Table des matières */
.toc-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.reading-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.progress-bar-wrapper {
    flex: 1;
    background: #e5e7eb;
    height: 6px;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    min-width: 4rem;
    text-align: right;
    font-size: 0.875rem;
    color: #6b7280;
}

.toc {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-item {
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
    font-size: 0.95rem;
}

.toc-item:hover {
    background: #f1f5f9;
}

.toc-item.active {
    background: #e0e7ff;
    color: var(--primary);
}

.level-1 { font-weight: 600; }
.level-2 { padding-left: 1.5rem; }

/* Code blocks */
.code-block {
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #2d3748;
    color: white;
}

.code-copy-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
        position: relative;
        top: 0;
        order: -1;
    }
}

@media (max-width: 640px) {
    .course-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}