.blog-container {
    display: flex;
    height: calc(100vh - 40vh);
    margin-top: 10px;
    position: relative;
}

.file-tree-panel {
    width: 280px;
    min-width: 220px;
    max-width: 750px;
    background-color: #f6f8fa;
    border-right: 1px solid #e1e4e8;
    overflow: hidden;
    /* Header is fixed; scroll is inside */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

/* ─── Project Root Header inside the tree panel ──────────── */
.file-tree-header {
    padding: 8px 12px;
    border-bottom: 1px solid #d1d5da;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    color: #cdd6f4;
    flex-shrink: 0;
}

.file-tree-header .btn-link {
    color: #a6adc8 !important;
}

.file-tree-header .btn-link:hover {
    color: #cdd6f4 !important;
}

/* ─── Filter input in header ─────────────────────────────── */
.file-tree-filter-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 6px;
}

.file-tree-filter-wrap .filter-icon {
    position: absolute;
    left: 8px;
    font-size: 0.72rem;
    color: #8c959f;
    pointer-events: none;
}

.file-tree-filter-input {
    width: 100%;
    padding: 4px 22px 4px 24px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #f0f6fc;
    outline: none;
    transition: all 0.2s ease;
}

.file-tree-filter-input::placeholder {
    color: #8c959f;
}

.file-tree-filter-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.file-tree-filter-wrap .btn-clear-search {
    position: absolute;
    right: 4px;
    background: transparent;
    border: none;
    color: #8c959f;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
}

.file-tree-filter-wrap .btn-clear-search:hover {
    color: #f0f6fc;
}

/* ─── Draggable Resizer ──────────────────────────────────── */
.file-tree-resizer {
    width: 5px;
    cursor: col-resize;
    background: #e1e4e8;
    flex-shrink: 0;
    position: relative;
    /* z-index: 10; */
    transition: background 0.15s ease;
}

.file-tree-resizer:hover,
.file-tree-resizer.is-resizing {
    background: #0366d6;
}

/* ─── Scrollable area below the header ───────────────────── */
.file-tree-content-scroll {
    flex: 1;
    overflow-x: auto !important;
    overflow-y: auto !important;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: #c1c9d2 transparent;
}

.file-tree-content-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.file-tree-content-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.file-tree-content-scroll::-webkit-scrollbar-thumb {
    background: #c1c9d2;
    border-radius: 3px;
}

.file-tree-content-scroll::-webkit-scrollbar-thumb:hover {
    background: #8c959f;
}

#dynamicFileTree {
    min-width: 100%;
    width: max-content;
}

.code-viewer-panel {
    flex-grow: 1;
    overflow: hidden;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.code-header {
    padding: 12px 15px;
    border-bottom: 1px solid #e1e4e8;
    background-color: #f6f8fa;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-info-bar {
    padding: 8px 15px;
    background-color: #fffbdd;
    border-bottom: 1px solid #e1e4e8;
    font-size: 0.9rem;
    color: #735c0f;
}

.code-content {
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow: auto;
}

pre {
    margin: 0;
    height: 100%;
    display: block;
    white-space: pre-wrap !important;
    word-break: break-all;
}

code {
    display: block;
    padding: 15px !important;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
    min-width: 0;
    white-space: pre-wrap !important;
}

.tree-element {
    /* Indentation managed cleanly by .folder-content */
}

.tree-item {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 13px;
    margin-bottom: 2px;
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tree-item:hover {
    background-color: #e1e4e8;
}

.tree-item.active {
    background-color: #0366d6;
    color: white;
}

.tree-item.active .badge {
    background-color: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

.folder-icon,
.file-icon {
    margin-right: 7px;
    width: 16px;
    display: inline-block;
    text-align: center;
    flex-shrink: 0;
}

.folder-content {
    padding-left: 12px;
    margin-left: 7px;
    border-left: 1px dashed #d0d7de;
    display: none;
}

.folder-content.open {
    display: block;
}

.responsive-tree-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.topic-badge {
    background-color: #e1ecf4;
    color: #39739d;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: inline-block;
}

@media (max-width: 991.98px) {

    /* Global Font Reductions for Blog Detail */
    body {
        font-size: 0.8rem;
    }

    h1.h2 {
        font-size: 1.2rem !important;
    }

    h3 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 0.9rem;
    }

    p,
    .text-muted {
        font-size: 0.8rem !important;
    }

    .file-tree-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: 75vh;
        width: 100%;
        z-index: 2000;
        border-right: none;
        border-top: 1px solid #e1e4e8;
        transform: translateY(calc(100% - 60px));
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
        border-radius: 20px 20px 0 0;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: #ffffff;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    .file-tree-panel::before {
        content: "";
        width: 40px;
        height: 4px;
        background-color: #e1e4e8;
        border-radius: 2px;
        margin: 12px auto;
        display: block;
        flex-shrink: 0;
    }

    .file-tree-panel.open {
        transform: translateY(0);
    }

    .file-tree-content-scroll {
        flex-grow: 1;
        overflow-x: auto !important;
        overflow-y: auto !important;
        padding: 10px 15px 30px;
    }

    .file-tree-resizer {
        display: none !important;
    }

    .tree-item {
        font-size: 0.8rem;
    }

    .responsive-tree-toggle {
        display: none;
    }

    .blog-container {
        height: auto;
        min-height: 400px;
        max-height: none;
    }

    .code-header {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    code {
        font-size: 10px;
        padding: 10px !important;
    }

    .topic-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }



    .file-info-bar {
        font-size: 0.7rem;
        padding: 4px 12px;
    }

    #readmeContent {
        font-size: 0.8rem !important;
    }

    /* Like & Comments Mobile Minimization */
    #likeBtn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    #likeCountBadge {
        font-size: 0.7rem;
    }

    .comment-card .card-body {
        padding: 0.75rem !important;
    }

    .comment-card h6 {
        font-size: 0.85rem !important;
    }

    .comment-content {
        font-size: 0.8rem !important;
    }

    .comment-card .btn-link {
        font-size: 0.75rem !important;
    }

    .comment-card small {
        font-size: 0.7rem !important;
    }

    #commentInput,
    #editCommentText,
    #replyText {
        font-size: 0.8rem;
    }

    .btn-primary.px-4 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .comment-wrapper .comment-wrapper {
        margin-left: 12px !important;
    }

    .comment-wrapper .comment-wrapper::before {
        left: -8px;
    }
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.show {
    display: block;
    opacity: 1;
}

/* Typography improvements */
#readmeContent {
    line-height: 1.6;
    color: #24292e;
    font-size: 1rem;
}

#readmeContent h1,
#readmeContent h2,
#readmeContent h3 {
    border-bottom: 1px solid #eaecef;
    padding-bottom: .3em;
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
}

#readmeContent h1 {
    font-size: 1.5em;
}

#readmeContent h2 {
    font-size: 1.25em;
}

#readmeContent p {
    margin-bottom: 16px;
}

@media (max-width: 576px) {
    #readmeContent {
        font-size: 0.9rem;
        padding: 15px !important;
    }

    .code-header #currentFileName {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Comment Section Enhancements */
.comment-wrapper {
    position: relative;
}

.comment-wrapper .comment-wrapper::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 0;
    bottom: 20px;
    width: 2px;
    background-color: #e9ecef;
}

.comment-card {
    transition: all 0.2s ease;
    border-radius: 12px !important;
}

.comment-card:hover {
    background-color: #f8f9fa;
}

.comment-card.border-primary {
    border-left-width: 4px !important;
}

.comment-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.badge.bg-primary {
    background-color: #0d6efd !important;
    font-weight: 500;
    padding: 3px 8px;
}

@media (max-width: 576px) {
    .comment-wrapper .comment-wrapper {
        margin-left: 15px !important;
    }

    .comment-wrapper .comment-wrapper::before {
        left: -10px;
    }
}

/* Tutorial Drawer (Left Sliding Panel) */
.tutorial-aside {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0;
    transform: translateX(0);
    z-index: 3000;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-aside.collapsed {
    transform: translateX(-100%);
}

.aside-toggle-btn {
    position: absolute;
    top: 40%;
    right: -48px;
    width: 48px;
    height: 48px;
    background: #04AA6D;
    background: linear-gradient(135deg, #04AA6D 0%, #038d5a 100%);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 0 15px rgba(4, 170, 109, 0.3);
    z-index: 2001;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.aside-toggle-btn:hover {
    padding-left: 5px;
    background: linear-gradient(135deg, #05c07b 0%, #04AA6D 100%);
}

.aside-content {
    flex: 1;
    overflow-y: auto;
    padding: 0px 0 40px;
    scrollbar-width: thin;
}

.aside-content::-webkit-scrollbar {
    width: 4px;
}

.aside-content::-webkit-scrollbar-thumb {
    background: #eee;
    border-radius: 10px;
}

.series-topic-title {
    padding: 15px 25px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.5px;
}

.aside-header {
    padding: 25px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.aside-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.tutorial-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tutorial-list li {
    margin: 2px 12px;
}

.tutorial-list li a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #555;
    text-decoration: none;
    font-size: 0.6rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lesson-icon {
    margin-right: 12px;
    font-size: 1rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.tutorial-list li:hover a {
    background: rgba(4, 170, 109, 0.05);
    color: #04AA6D;
    transform: translateX(4px);
}

.tutorial-list li:hover .lesson-icon {
    transform: scale(1.2);
    opacity: 1;
}

.tutorial-list li.active a {
    background: linear-gradient(135deg, #04AA6D 0%, #038d5a 100%);
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(4, 170, 109, 0.2);
}

.tutorial-list li.active .lesson-icon {
    opacity: 1;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] .tutorial-aside {
    background: #12141d;
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .aside-header {
    background: #161925;
    border-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .aside-title {
    color: #f8f9fa;
}

[data-bs-theme="dark"] .tutorial-list li a {
    color: #a0a4b8;
}

[data-bs-theme="dark"] .tutorial-list li:hover a {
    background: rgba(4, 170, 109, 0.15);
}

[data-bs-theme="dark"] .series-topic-title {
    color: #5d6174;
}

[data-bs-theme="dark"] .aside-content::-webkit-scrollbar-thumb {
    background: #2e324a;
}

/* Close button style for drawer */
.btn-close-aside {
    opacity: 0.6;
    transition: all 0.2s;
    padding: 10px;
}

.btn-close-aside:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Adjust Main Content when Aside is Open */
body.tutorial-aside-open {
    overflow: hidden;
}

@media (min-width: 992px) {
    main.tutorial-layout {
        transition: padding-left 0.3s ease;
    }

    body.tutorial-aside-active main.tutorial-layout {
        padding-left: 300px;
    }
}

/* Fix for existing sidebar styles */
.tutorial-sidebar {
    display: none;
}

/* Sidebar (Right) Sticky */
.sidebar-sticky {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: none;
    /* Hide scrollbar for cleaner look */
}

.sidebar-sticky::-webkit-scrollbar {
    display: none;
}

/* Sidebar (Right) */
.sidebar-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
}

[data-bs-theme="dark"] .sidebar-card {
    background: #1a1d2e;
    border: 1px solid #2e324a;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hot-topics-list li a {
    color: #444;
    transition: background 0.2s;
}

[data-bs-theme="dark"] .hot-topics-list li a {
    color: #b0b3c5;
}

.hot-topics-list li a:hover {
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] .hot-topics-list li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Navigation Boxes (Prev/Next) */
.nav-box {
    background-color: #f1f1f1;
    border-radius: 8px;
    padding: 15px 20px;
    text-decoration: none !important;
    transition: all 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

[data-bs-theme="dark"] .nav-box {
    background-color: #1e2139;
    border: 1px solid #2e324a;
}

.nav-box:hover {
    background-color: #ddd;
}

[data-bs-theme="dark"] .nav-box:hover {
    background-color: #2e324a;
}

.nav-box.prev {
    border-left: 5px solid #ccc;
}

.nav-box.next {
    border-right: 5px solid #04AA6D;
    text-align: right;
}

.nav-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}

[data-bs-theme="dark"] .nav-label {
    color: #b0b3c5;
}

.nav-title {
    font-size: 1rem;
    color: #333;
    margin: 0;
    font-weight: 600;
}

[data-bs-theme="dark"] .nav-title {
    color: white;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .nav-box {
        padding: 10px 15px;
    }

    .nav-title {
        font-size: 0.9rem;
    }
}

/* Navigation Box Hover Effects */
.hover-shadow {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px);
}

.transition-all {
    transition: all 0.3s ease;
}

.nav-box:hover .nav-title {
    color: #0d6efd;
}

[data-bs-theme="dark"] .nav-box:hover .nav-title {
    color: #6ea8fe;
}