:root {
    --bg-page: #f4f7f9;
    --bg-surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #0ea5e9;
    --accent-hover: #0284c7;
    --border-light: #e2e8f0;
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.site-header {
    background-color: var(--bg-surface);
    padding: 24px 40px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.site-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.site-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.layout-container {
    display: flex;
    max-width: 1280px;
    margin: 40px auto;
    padding: 0 24px;
    gap: 40px;
    align-items: flex-start;
}

.sidebar {
    flex: 0 0 260px;
    background-color: transparent;
    
    position: sticky;
    top: 40px;
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    overflow-y: auto !important;
    padding-right: 12px;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.sidebar h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.nav-list { 
    list-style: none; 
}

.course-group { 
    margin-bottom: 24px; 
}

.course-title {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    user-select: none;
    cursor: pointer;
    width: 100%;
}

.course-title span {
    display: inline-block;
}

.toggle-icon {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    display: inline-block;
    flex-shrink: 0;
}

.week-list {
    list-style: none;
    border-left: 2px solid var(--border-light);
    margin-left: 4px;
}

.week-list.collapsed {
    display: none !important;
}

.course-group.open .toggle-icon {
    transform: rotate(90deg);
    color: var(--accent-color);
}

.week-list li { 
    margin-bottom: 4px; 
}

.week-list a {
    text-decoration: none;
    color: var(--text-secondary);
    display: block;
    padding: 8px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.week-list a:hover {
    color: var(--accent-color);
    background-color: rgba(14, 165, 233, 0.05);
}

.week-list a.active {
    color: var(--accent-color);
    font-weight: 600;
    background-color: rgba(14, 165, 233, 0.08);
    position: relative;
}

.week-list a.active::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: var(--accent-color);
}

.content-area {
    flex: 1;
    background-color: var(--bg-surface);
    padding: 40px 48px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.content-header h2 { 
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.btn-download {
    background-color: var(--accent-color);
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2);
}

.btn-download:hover { 
    background-color: var(--accent-hover); 
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(14, 165, 233, 0.3);
}

.lesson-block {
    margin-bottom: 40px;
}

.lesson-block h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.lesson-block h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 16px;
    font-weight: 600;
}

.lesson-block p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.code-block {
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 20px;
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9rem;
    margin: 20px 0;
    white-space: pre-wrap;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.output-block {
    background-color: #f8fafc;
    border-left: 4px solid var(--border-light);
    padding: 16px 20px;
    margin: 20px 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --- Clean Data Table Architectures --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.9rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

table th {
    background-color: #f8fafc;
    color: var(--text-primary);
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border-light);
}

table td {
    padding: 12px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

table tbody tr:nth-child(even) {
    background-color: rgba(248, 250, 252, 0.5);
}

.font-mono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.font-semibold {
    font-weight: 600;
}

.more-info {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 20px 0;
    transition: all 0.2s ease;
}

.more-info:hover {
    border-color: var(--accent-color);
}

.more-info summary {
    font-weight: 600;
    color: var(--accent-color);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
}

.more-info summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 10px;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.more-info[open] summary::before {
    transform: rotate(90deg);
}

.more-info p {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding-left: 20px;
    border-left: 2px solid var(--border-light);
}

.more-info ul, 
.more-info ol {
    padding-left: 24px !important;
    margin-top: 8px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.more-info li {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

@media print {
    details {
        display: block !important;
        border: 1px solid #ddd;
        padding: 10px;
        margin-top: 10px;
    }
    summary {
        display: block;
        font-weight: bold;
        margin-bottom: 5px;
    }
    summary::before {
        display: none;
    }
}

@media screen and (max-width: 768px) {
    .layout-container {
        flex-direction: column;
        min-height: auto;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none !important;
        border-bottom: 1px solid var(--accent-color) !important;
        padding: 20px;
        position: relative;
        top: 0;
        height: auto;
        max-height: none;
        overflow-y: visible;
    }

    .content-area {
        width: 100%;
        padding: 24px 16px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-download {
        width: 100%;
        text-align: center;
    }
}

.site-footer {
    max-width: 1280px;
    margin: 20px auto 40px auto;
    padding: 0 24px;
    text-align: center;
}

.site-footer p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
    line-height: 1.5;
    letter-spacing: 0.2px;
}

.bmc-blurb {
    font-size: 0.7rem !important;
    opacity: 0.85;
    margin-top: 4px;
    margin-bottom: 2px;
}
