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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #fafafa;
    color: #1a1a2e;
    line-height: 1.7;
}

/* ── Navbar ───────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
}

.brand-value { color: #0281ff; }
.brand-ati { color: #6c3ce0; }

.navbar-tagline {
    color: #6b7280;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* ── Main Layout ──────────────────────────────────────────────────── */
.main-layout {
    display: flex;
    min-height: calc(100vh - 140px);
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid #e5e7eb;
    padding: 1.5rem 0;
    overflow-y: auto;
    max-height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    background: #fff;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
}

.sidebar-category { border-bottom: 1px solid #f3f4f6; }

.category-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: #1a1a2e;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    transition: background 0.15s;
}

.category-toggle:hover { background: #f9fafb; }

.category-count {
    background: #eff6ff;
    color: #0281ff;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.category-problems {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-category.open .category-problems {
    max-height: 1000px;
}

.problem-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem 0.5rem 2rem;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.15s;
}

.problem-link:hover { color: #1a1a2e; background: #f9fafb; }
.problem-link.active { color: #0281ff; background: #eff6ff; border-left: 2px solid #0281ff; }

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.difficulty-easy { background: #10b981; }
.difficulty-medium { background: #f59e0b; }
.difficulty-hard { background: #ef4444; }

/* ── Content ──────────────────────────────────────────────────────── */
.algorithm_content {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 900px;
}

.algorithm_content h2, .algorithm_content h3 {
    color: #1a1a2e;
    margin-bottom: 1rem;
    font-weight: 600;
}

.algorithm_content h2 { font-size: 1.75rem; }
.algorithm_content h3 { font-size: 1.3rem; color: #0281ff; }

.algorithm_content p {
    margin-bottom: 1rem;
    color: #374151;
}

.algorithm_content ol, .algorithm_content ul {
    margin: 0.5rem 0 1.5rem 1.5rem;
    color: #374151;
}

.algorithm_content li { margin-bottom: 0.5rem; }

/* Content section headers from existing solutions */
.content_section_header {
    color: #0281ff;
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.summary_of_problem { color: #d1d5db; }

.time_space {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Code blocks */
pre code, .algorithm_content pre {
    font-family: 'JetBrains Mono', monospace;
    background: #fffde9;
    border: 1px solid #e5e1a8;
    border-radius: 8px;
    display: block;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    color: #0257ff;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    width: fit-content;
    max-width: 100%;
}

.inlineCode, code {
    font-family: 'JetBrains Mono', monospace;
    color: #0257ff;
    background: #eff6ff;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Problem breakdown steps */
.problem_breakdown_steps { margin-left: 1.5rem; }
.problem_breakdown_steps li { margin-bottom: 0.75rem; }

.sample_code_problem_breakdown {
    list-style: none;
    margin: 0.5rem 0;
}

.sample_code_problem_breakdown li {
    font-family: 'JetBrains Mono', monospace;
    color: #0257ff;
    background: #fffde9;
    border: 1px solid #e5e1a8;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    width: fit-content;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    background: #fff;
}

.nav-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.75rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: #f3f4f6;
    color: #1a1a2e;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-btn:hover { background: #e5e7eb; color: #0281ff; }

.problem-counter {
    color: #6b7280;
    font-size: 0.8rem;
}

.footer-credit {
    text-align: center;
    color: #9ca3af;
    font-size: 0.75rem;
}

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

    .sidebar {
        width: 100%;
        min-width: 100%;
        max-height: none;
        position: static;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .algorithm_content {
        padding: 1.5rem 1rem;
    }

    .nav-buttons { gap: 0.75rem; }
    .problem-counter { display: none; }
}
