:root {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --sidebar-bg: #f8f9fa;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --accent: #0969da;
    --accent-soft: rgba(9, 105, 218, 0.1);
    --border: #d0d7de;
    --code-bg: #f6f8fa;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --sidebar-width: 300px;
    --success: #2ea043;
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --sidebar-bg: #010409;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-soft: rgba(88, 166, 255, 0.15);
    --border: #30363d;
    --code-bg: #010409;
    --shadow: 0 10px 20px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Reading Progress Bar */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--accent);
    width: 0%;
    z-index: 1000;
    transition: width 0.1s ease;
}

/* Sidebar */
aside {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    overflow-y: auto;
    padding: 20px 0;
    z-index: 100;
    scrollbar-width: thin;
}

.sidebar-header {
    padding: 0 24px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

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

.nav-group-title {
    padding: 0 24px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

aside ul li a {
    display: block;
    padding: 8px 24px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    border-left: 4px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

aside ul li a:hover {
    background-color: var(--bg-secondary);
    color: var(--accent);
}

aside ul li a.active {
    background-color: var(--accent-soft);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}

/* Main Content */
main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 60px 80px;
    max-width: 1100px;
    min-width: 0;
}

#content {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography Enhancements */
h1 { font-size: 2.75rem; font-weight: 800; margin-bottom: 1.5rem; letter-spacing: -0.03em; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h2 { font-size: 1.75rem; font-weight: 700; margin: 2.5rem 0 1rem; letter-spacing: -0.02em; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.35rem; font-weight: 600; margin: 1.8rem 0 0.8rem; }
p { margin-bottom: 1.2rem; font-size: 1.05rem; color: var(--text-primary); opacity: 0.9; }

/* Feature: Code Blocks with Copy Button */
.code-container {
    position: relative;
    margin: 2rem 0;
}

pre {
    background-color: var(--code-bg) !important;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.code-container:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Feature: Info & Alert Boxes */
.info-box {
    background-color: var(--accent-soft);
    border-left: 5px solid var(--accent);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.info-box strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

/* Theme Toggle */
#theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 200;
    transition: transform 0.2s;
}

#theme-toggle:active { transform: scale(0.95); }

/* Mobile Menu */
@media (max-width: 992px) {
    aside { transform: translateX(-100%); width: 280px; }
    aside.open { transform: translateX(0); }
    main { margin-left: 0; padding: 40px 24px; }
}
