/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-sidebar: #1e293b;
    --bg-sidebar-secondary: #334155;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-sidebar: #e2e8f0;
    --text-sidebar-secondary: #cbd5e1;
    
    /* Border Colors */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Spacing */
    --sidebar-width: 320px;
    --header-height: 60px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-medium: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Base Typography */
body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--bg-sidebar);
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-medium);
    box-shadow: var(--shadow-lg);
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-sidebar);
    border-radius: 1px;
    transition: var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-sidebar-secondary);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-medium);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition-medium);
}

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

.sidebar-header h2 {
    color: var(--text-sidebar);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-header p {
    color: var(--text-sidebar-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

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

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

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--bg-sidebar-secondary);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-medium);
}

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

.nav-menu > li {
    margin-bottom: 4px;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: var(--text-sidebar-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--text-sidebar);
    background: var(--bg-sidebar-secondary);
    border-left-color: var(--primary-color);
}

.nav-link.active {
    color: var(--text-sidebar);
    background: var(--bg-sidebar-secondary);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.nav-section {
    margin: 16px 0;
}

.nav-section-title {
    display: block;
    padding: 8px 20px;
    color: var(--text-sidebar);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.nav-submenu .nav-link {
    padding: 8px 20px 8px 40px;
    font-size: 13px;
    color: var(--text-sidebar-secondary);
}

.nav-submenu .nav-link:hover,
.nav-submenu .nav-link.active {
    color: var(--text-sidebar);
    background: var(--bg-sidebar-secondary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--bg-sidebar-secondary);
}

.github-link {
    display: block;
    padding: 12px 16px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: var(--transition-fast);
}

.github-link:hover {
    background: var(--primary-dark);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Section Headers */
.section-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-light);
}

.section-header h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.section-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Content Cards and Sections */
.intro-card {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 32px;
    border: 1px solid var(--border-light);
}

.intro-card h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.intro-card p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.highlight-box {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
}

.highlight-box h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.highlight-box p {
    font-size: 16px;
    line-height: 1.6;
    opacity: 0.95;
}

.highlight-box code {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 14px;
}

/* Problem-Solution Layout */
.problem-solution {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.problem, .solution {
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.problem {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border-color: #fca5a5;
}

.solution {
    background: linear-gradient(135deg, #f0fdf4, #bbf7d0);
    border-color: #86efac;
}

.problem h3, .solution h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.problem h3 {
    color: #dc2626;
}

.solution h3 {
    color: #16a34a;
}

.problem p, .solution p {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.problem ul, .solution ul {
    list-style: none;
    padding-left: 0;
}

.problem li, .solution li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.problem li::before {
    content: "•";
    color: #dc2626;
    position: absolute;
    left: 0;
}

.solution li::before {
    content: "•";
    color: #16a34a;
    position: absolute;
    left: 0;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.feature-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    transition: var(--transition-medium);
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.feature-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Journey Note */
.journey-note {
    background: var(--bg-tertiary);
    padding: 24px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
    margin-bottom: 32px;
}

.journey-note h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.journey-note p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Navigation Hint */
.navigation-hint {
    text-align: center;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px dashed var(--border-medium);
}

.navigation-hint p {
    color: var(--text-secondary);
    font-style: italic;
}

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--text-secondary);
    font-size: 16px;
}

.loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Content Styles for Markdown */
.content-body h1, .content-body h2, .content-body h3, .content-body h4, .content-body h5, .content-body h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 16px;
    line-height: 1.3;
}

.content-body h1 { font-size: 32px; }
.content-body h2 { font-size: 24px; }
.content-body h3 { font-size: 20px; }
.content-body h4 { font-size: 18px; }
.content-body h5 { font-size: 16px; }
.content-body h6 { font-size: 14px; }

.content-body p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.content-body ul, .content-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.content-body li {
    margin-bottom: 4px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.content-body code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
}

.content-body pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.content-body pre code {
    background: none;
    padding: 0;
    font-size: 14px;
}

.content-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.content-body th, .content-body td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.content-body th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.content-body td {
    color: var(--text-secondary);
}

.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: var(--shadow-md);
}

.content-body a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.content-body a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Overlay for Mobile */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: var(--transition-medium);
}

.overlay.active {
    opacity: 1;
}

/* Dark Mode Styles */
body.dark-mode, :root.dark-mode {
    --bg-primary: #18181b;
    --bg-secondary: #23232a;
    --bg-tertiary: #1e1e24;
    --bg-sidebar: #111827;
    --bg-sidebar-secondary: #1f2937;
    --primary-color: #60a5fa;
    --primary-dark: #2563eb;
    --secondary-color: #94a3b8;
    --accent-color: #fbbf24;
    --success-color: #22d3ee;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --text-primary: #f3f4f6;
    --text-secondary: #cbd5e1;
    --text-light: #64748b;
    --text-sidebar: #f3f4f6;
    --text-sidebar-secondary: #94a3b8;
    --border-light: #334155;
    --border-medium: #64748b;
    --border-dark: #1e293b;
}

.dark-mode-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-sidebar);
    margin-left: 8px;
    transition: color 0.2s;
}

body.dark-mode .dark-mode-toggle {
    color: var(--accent-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 280px;
    }
    
    .sidebar {
        width: 280px;
    }
    
    :root {
        --sidebar-width: 280px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 20px 16px;
        padding-top: 80px;
    }
    
    .section-header h1 {
        font-size: 28px;
    }
    
    .section-subtitle {
        font-size: 16px;
    }
    
    .problem-solution {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .overlay {
        display: block;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 16px 12px;
        padding-top: 80px;
    }
    
    .intro-card, .highlight-box, .journey-note {
        padding: 20px;
    }
    
    .problem, .solution {
        padding: 16px;
    }
    
    .feature-card {
        padding: 16px;
    }
    
    .section-header h1 {
        font-size: 24px;
    }
}