/* assets/css/blog_styles.css - Theme: Professional Bootstrap-Inspired */

/* --- 1. Global Layout & Typography --- */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --header-text: #343a40;
    --footer-bg: #212529;
    --footer-text: #ced4da;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --header-bg: #343a40;
    --header-text: #ffffff;
    --footer-bg: #343a40;
    --footer-text: #adb5bd;
}

html { height: 100%; }
body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    word-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

p, li {
    font-size: 1rem;
    line-height: 1.6;
}
main { flex-grow: 1;
    overflow-y: auto; }


pre, code {
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
}
a, button {
    transition: all 0.2s ease-in-out;
}


/* --- 2. Header & Navigation --- */
header {
    background-color: var(--header-bg);
    color: var(--header-text);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.navbar .nav-menu a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
    font-weight: 500;
}
.navbar .nav-menu a:hover {
    color: #ffffff;
}

/* --- 3. Blog Layout (9/3 Split) --- */
.blog-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}
.blog-container h1 {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2.5rem;
}
.blog-layout {
    display: flex;
    gap: 2rem; /* Adjust gap as needed */
}
.main-content {
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.about-me-section {
    width: 20%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}


/* --- 4. Search Form --- */
.search-form {
    margin-bottom: 2.5rem;
    display: flex;
}
.search-form input[type="text"] {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 0.375rem 0 0 0.375rem;
    font-size: 1rem;
}
.search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.search-form button {
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    border-radius: 0 0.375rem 0.375rem 0;
    cursor: pointer;
    font-size: 1rem;
}
.search-form button:hover {
    background-color: #0b5ed7;
}

/* --- 5. Blog Post Cards --- */
.blog-post-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}
.blog-post-item h2 { margin-top: 0; font-size: 1.5rem; font-weight: 600; }
.blog-post-item h2 a { text-decoration: none; color: var(--text-color); }
.blog-post-item p { color: #6c757d; margin-bottom: 0; }
.read-more {
    display: inline-block;
    margin-top: 1rem;
    text-decoration: none;
    color: var(--text-color);
}
.blog-post-item p {
    color: var(--secondary-color);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}
.read-more {
    font-weight: 600;
    color: var(--primary-color);
    font-weight: 600;
}

/* --- 6. Single Post Page --- */
.blog-post {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
}
.blog-post h1 {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-weight: 600;
}
.post-meta {
    color: #6c757d;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}
.post-meta a { color: var(--primary-color); text-decoration: none; }
.post-content {
    font-size: 1.1rem;
    line-height: 1.7;
}
.post-content h2, .post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}
.post-content p { margin-bottom: 1rem; }
.post-content pre {
    background-color: #212529;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 25px;
    overflow-x: auto;
}
.post-content code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.9rem; }

/* --- 7. about-me-section Styling (Card Style) --- */
.about-me-section {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}
.about-me-section h3 {
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.category-list {
    list-style: none;
    padding: 0;
    /* margin: 1.5rem 0 0 0; */
}
.category-list li {
    margin-bottom: 0.5rem;
}
.category-list a {
    text-decoration: none;
    color: var(--primary-color);
}

/* --- 8. Footer Styling --- */
footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 0.5rem 0;
    text-align: center;
    margin-top: 3rem;
}
footer .container p { margin: 0; font-size: 0.9rem; }

/* --- 9. Floating Back to Top Button --- */
#back-to-top-btn {
    display: none;
    position: fixed;
    bottom: 30px; /* Increased distance from bottom */
    right: 30px;
    z-index: 100;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: background-color 0.2s;
}
#back-to-top-btn:hover {
    background-color: #0b5ed7;
}

/* --- 10. Responsive Adjustments --- */
@media (max-width: 992px) {
    .blog-layout {
        flex-direction: column;
    }
    .main-content, .about-me-section {
        width: 100%;
    }
    .about-me-section {
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    /* Make all dropdowns full-width */
    .nav-menu .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        min-width: 100%;
        background-color: transparent;
        padding-left: 1rem;
    }

    .nav-menu > .dropdown > .dropdown-menu {
        border-radius: 0;
    }

    /* Force nested dropdowns to stack vertically */
    .dropdown-menu .dropdown > .dropdown-menu {
        position: static;
        padding-left: 1rem;
        border-radius: 0;
        box-shadow: none;
        background-color: transparent;
        border: none;
    }

    /* Adjust link spacing */
    .dropdown-menu a {
        padding: 0.5rem 1rem;
        background-color: transparent;
        color: var(--header-text);
    }

    .dropdown-menu li > a:hover {
        background-color: rgba(255,255,255,0.05);
    }

    /* Prevent overflow on right side */
    .navbar, .nav-menu {
        overflow-x: hidden;
    }

    /* Icon realignment if needed */
    .dropdown-icon-side {
        margin-left: auto;
    }
}


/* Add for smaller screens */
@media (max-width: 576px) {
    .blog-container {
        padding: 0 1rem;
    }
    .blog-post-item {
        padding: 1rem;
    }
    .search-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    .search-form input[type="text"],
    .search-form button {
        width: 100%;
        border-radius: 25px;
        border-right: 1px solid var(--border-color);
    }
    .search-form input[type="text"] {
        border-radius: 25px;
    }
    .search-form button {
        border-radius: 25px;
    }
    .blog-container h1,
    .blog-post h1 {
        font-size: 1.8rem;
    }

    .blog-post-item h2 {
        font-size: 1.25rem;
    }

    .post-content h2, .post-content h3 {
        font-size: 1.2rem;
    }
}
/* --- 8. Pagination (NEW Professional Styles) --- */
.pagination {
    display: flex;
    justify-content: center;
    padding: 0;
    margin-top: 2.5rem; /* Space above the pagination */
    list-style: none;
}
.pagination a, .pagination span {
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    text-decoration: none;
    transition: background-color .2s;
    border: 1px solid var(--border-color);
    border-radius: 25px; /* Bootstrap-like radius */
    background-color: var(--card-bg);
}
.pagination a:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}
.pagination .active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    pointer-events: none; /* The active page isn't clickable */
}


/* --- 11. Multi-Level Clickable Dropdown Menu Styles --- */

/* --- General Setup --- */
.dropdown {
    position: relative;
}
.dropdown-menu {
    display: none; /* Hide all dropdowns by default */
    position: absolute;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 1000;
}

/* --- Level 1 (Top Bar) --- */
.dropdown-icon {
    font-size: 0.7em;
    margin-left: 0.3rem;
    transition: transform 0.2s ease-in-out;
}
/* Rotate the icon when the dropdown is open */
.nav-menu > .dropdown.open > a > .dropdown-icon {
    transform: rotate(180deg);
}

/* --- Level 2 (First Dropdown) --- */
.nav-menu > .dropdown > .dropdown-menu {
    top: 100%;
    left: 0;
    border-radius: 0 0 0.5rem 0.5rem;
}
/* **KEY CHANGE**: Show the menu when its parent has the 'open' class */
.nav-menu > .dropdown.open > .dropdown-menu {
    display: block;
}

/* --- Level 3+ (Side Fly-out Menus) --- */
.dropdown-menu .dropdown > .dropdown-menu {
    top: -1px;
    left: 100%;
    border-radius: 25px;
}
/* **KEY CHANGE**: Show the fly-out menu when its parent has the 'open' class */
.dropdown-menu .dropdown.open > .dropdown-menu {
    display: block;
}

/* --- General Link Styling within Dropdowns --- */
.dropdown-menu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}
.dropdown-icon-side {
    font-size: 0.7em;
    margin-left: 1rem;
}
.dropdown-menu li {
    margin: 0 !important;
}


/* --- New Styles for Breadcrumb Navigation --- */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    list-style: none;
    background-color: #e9ecef; /* A light gray background */
    border-radius: 25px; /* Bootstrap-like radius */
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .breadcrumb-separator {
    padding: 0 0.5rem;
    color: var(--secondary-color); /* Muted gray for the separator */
}

/* --- 11. Split Button Clickable Dropdown Menu --- */

/* --- Main Navigation Bar --- */
.nav-menu {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
}
.nav-menu > li {
    margin: 0 5px;
    display: flex;
    align-items: center;
}
.nav-menu > li > a {
    padding: 0.5rem 0.75rem;
}

/* --- Dropdown Toggle Button --- */
.dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: -5px;
    color: inherit;
    line-height: 1;
}
.dropdown-toggle:hover {
    color: var(--primary-color);
}
.dropdown-icon {
    font-size: 0.7em;
    transition: transform 0.2s ease-in-out;
}
/* Rotate the icon when the dropdown is open */
.dropdown.open > .dropdown-toggle > .dropdown-icon {
    transform: rotate(180deg);
}

/* --- General Dropdown Menu --- */
.dropdown-menu {
    display: none;
    position: absolute;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 1000;
}
.dropdown.open > .dropdown-menu {
    display: block;
}

/* --- Level 2 Dropdown --- */
.nav-menu > .dropdown > .dropdown-menu {
    top: 100%;
    left: 0;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* --- Level 3+ Fly-out Menus & Link Styling --- */
.dropdown-menu .dropdown > .dropdown-menu {
    top: -1px;
    left: 100%;
    border-radius: 25px;
}
.dropdown-menu li {
    margin: 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* .dropdown-menu li { */
   /* margin: 0 !important; */
    /* display: flex; */
    /* justify-content: center; */
    /* flex-direction: row; */
    /* align-items: center; */
    /* flex-wrap: wrap; */
/* } */
.dropdown-menu li > a {
    /* padding: 0.75rem 1.5rem; */
    white-space: nowrap;
    flex-grow: 1;
}
.dropdown-menu li > .dropdown-toggle {
    padding: 0.75rem 1rem;
}
.dropdown-icon-side {
    font-size: 0.7em;
    margin-left: 1rem;
}
/* --- New Styles for "Quick Reference" Homepage --- */

.homepage-layout h2 {
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Code Snippet Card */
.snippet-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.snippet-card p {
    margin-top: -1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.snippet-card p a {
    color: var(--primary-color);
    text-decoration: none;
}

.snippet-card pre {
    background-color: #212529;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 25px;
    overflow-x: auto;
    max-height: 200px; /* Prevents very long snippets from taking over the page */
}

.snippet-card code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
}

/* Topic Tag Cloud */
.tag-cloud-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 1.5rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #e9ecef;
    color: var(--text-color);
    border-radius: 999px; /* Pill shape */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.tag:hover {
    background-color: var(--primary-color);
    color: #fff;
}
/* --- New Styles for "About Me" and Category about-me-section Cards --- */
.category-about-me-section-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.category-sidebar-card {
	background: #f9f9f9;
    padding: 20px;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    overflow: scroll;
}

.category-sidebar-card h3 {
    font-size: 1.2rem;
    text-align: center;
}

/* --- Styles for Hierarchical about-me-section List --- */
.about-me-section .category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left; /* Ensure list is left-aligned */
}

.about-me-section .category-list li {
    margin-bottom: 0.5rem;
}

.about-me-section .category-list a {
    text-decoration: none;
    color: var(--primary-color);
    display: block;
}

.about-me-section .category-list a:hover {
    text-decoration: underline;
}

/* Indent child lists */
.about-me-section .category-list ul {
    list-style: none;
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

.about-me-section {
    /* width: 300px; */
    padding: 20px;
    background-color: #fff;
}

.about-me-card {
    text-align: center;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.about-me-card .profile-pic {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
}

.about-me-card h3 {
    margin: 10px 0 5px;
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
}

.about-me-card p {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.about-me-card .btn {
    /* display: inline-block; */
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border-radius: 25px;
    text-decoration: none;
    width: 100%;
    justify-content: center;
}

.about-me-card .btn:hover {
    background-color: #0056b3;
}

/* --- 12. Social Share Section --- */
.social-share-container {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.social-share-container h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.social-share-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, opacity 0.2s;
}

.share-btn:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

/* Brand colors */
.share-btn.linkedin { background-color: #0077B5; }
.share-btn.twitter { background-color: #1DA1F2; }
.share-btn.facebook { background-color: #1877F2; }
.share-btn.reddit { background-color: #FF4500; }
.share-btn.copy-link { background-color: #6c757d; }



.dropdown-menu .dropdown-menu a {
    padding-left: 2rem;
}
.dropdown-menu .dropdown-menu .dropdown-menu a {
    padding-left: 3rem;
}
.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}


/* --- New Styles for Homepage 2/3 and 1/3 Split --- */

.homepage-featured-layout {
    display: flex;
    gap: 2rem; /* The space between the snippet card and the about me card */
    margin-bottom: 2.5rem; /* Space below the featured section */
}

.featured-main {
    width: 66.66%; /* Two-thirds of the space */
}

.featured-sidebar {
    width: 33.33%; /* One-third of the space */
}

/* Ensure the cards inside the new layout don't have extra bottom margin */
.featured-main .snippet-card,
.featured-sidebar .about-me-card {
    margin-bottom: 0;
}

/* Responsive adjustment for the new featured section */
@media (max-width: 992px) {
    .homepage-featured-layout {
        flex-direction: column;
    }
    .featured-main,
    .featured-sidebar {
        width: 100%;
    }
}
/* --- 14. Mobile Navigation Styles --- */

.hamburger-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001; /* Above the overlay */
}

.mobile-sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background-color: #2c3e50; /* A dark background for the sidebar */
    padding: 2rem;
    box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    transform: translateX(-100%); /* Hidden off-screen by default */
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    overflow-y: auto;
    box-sizing: border-box;
}

.mobile-sidebar-nav.open {
    transform: translateX(0); /* Slides the menu in */
}

.mobile-sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-sidebar-nav li {
    margin-bottom: 0.5rem;
}

.mobile-sidebar-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.5rem 0;
    /* display: block; */
}

.mobile-sidebar-nav .dropdown-toggle {
    color: rgba(255,255,255,0.8);
}

.mobile-sidebar-nav .dropdown-menu {
    position: static; /* No fly-outs on mobile */
    display: none;
    background: none;
    border: none;
    box-shadow: none;
    padding-left: 1rem; /* Indent sub-items */
}

.mobile-sidebar-nav .dropdown.open > .dropdown-menu {
    display: block;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
}

.overlay.show {
    display: block;
}


/* --- Responsive Breakpoint --- */
@media (max-width: 992px) {
    .navbar-desktop {
        display: none; /* Hide the desktop menu */
    }
    .hamburger-toggle {
        display: block; /* Show the hamburger button */
    }
    .navbar.container {
        justify-content: flex-start; /* Align hamburger to the left */
    }
}
