:root {
    --sidebar-bg: #f8f9fa; /* Light Gray */
    --accent-orange: #e67e22; /* Orange from logo */
    --accent-teal: #4a919e; /* Teal from logo */
    --primary-text: #2c3e50; /* Dark Blue/Gray */
    --secondary-text: #7f8c8d; /* Lighter Gray */
    --primary-color: #2980b9; /* Blue for links and highlights */
    --text-color: #333333; /* General text color */
    --border-color: #e5e5e5;
    --code-bg: #2d2d2d;
    --code-text: #f8f8f2;
    --nav-width: 280px;
}

body {
    display: grid;
    grid-template-rows: 1fr auto;
    grid-template-columns: var(--nav-width) 1fr;
    grid-template-areas:
        "sidebar main"
        "footer footer";
    margin: 0;
    font-family: 'Inter', sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: #FCFCFC;
}

.container {
    display: flex;
    width: 100%;
}

.main-container {
    grid-area: main; /* Assign the content area */
    display: contents; /* This makes the grid see the children (.sidebar, .main-content) */
}

.search-bar {
    position: relative;
    color: var(--secondary-text);
}

/* --- Sidebar Navigation --- */
.nav-category {
    margin-bottom: 20px;
}

.nav-category-title {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary-text);
    padding: 0 25px;
    margin-bottom: 10px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 15px;

    /* Updated styles for the container */
    margin: 20px; /* Gives it space from the sidebar edges */
    padding: 15px; /* Adjusts padding inside the border */
    background-color: white;
    border: 1px solid var(--accent-teal);
    border-radius: 8px; /* Softens the corners */
}

.sidebar-header img {
    height: 83.6833px;
    width: 200px;
}

.sidebar-header h1 {
    font-size: 1.8em;
    margin: 0;
    font-weight: 700;
    color: var(--primary-text);
}

.sidebar-logo {
    text-align: center;
    padding: 10px 15px;
    margin-bottom: 20px;
}

.sidebar-logo img {
    max-width: 75%;
    height: auto;
}

.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--primary-text);
    border-right: 1px solid var(--border-color);
    box-shadow: none;
    height: 100vh;
    grid-area: sidebar; /* Assign to the 'sidebar' grid area */
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 25px 0;
    position: sticky; /* Stick to the top of the viewport */
    top: 0;
    box-sizing: border-box;
}

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

/* This styles the base link */
.sidebar nav ul li a {
    color: var(--primary-text);
    text-decoration: none;
    display: block; /* Makes the entire area clickable */
    padding: 8px 25px;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* This styles the hover state */
.sidebar nav ul li a:hover {
    background-color: var(--border-color);
    color: var(--primary-text);
}

/* This styles the active link */
.sidebar nav ul li a.active {
    background-color: var(--accent-teal);
    color: white;
    font-weight: 700;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-text);
}

a {
    color: var(--accent-teal);
}

.sidebar.hidden {
    transform: translateX(-100%);
}

/* --- Main Content Area --- */
.main-content {
    grid-area: main; /* Assign to the 'main' grid area */
    padding: 40px;
    max-width: 900px;
    flex-grow: 1;
    padding: 40px; /* Re-adjust padding a bit */
    max-width: 1024px; /* Give the content a max-width for readability */
    box-sizing: border-box;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin: 0;
}

.hamburger {
    display: none; /* Hidden by default, shown on smaller screens */
    cursor: pointer;
    padding: 10px;
    z-index: 1001; /* Above sidebar */
}

.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--primary-text); /* Use the correct variable */
    transition: all 0.3s ease-in-out;
}

/* --- Content Styling --- */

pre {
    background-color: #f6f8fa; /* Light gray background */
    border: 1px solid var(--border-color); /* Subtle border */
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 1.5em;
}

/* For inline `code` snippets */
code {
    font-family: 'Fira Code', monospace;
    background-color: rgba(65, 132, 146, 0.1); /* Subtle teal background */
    color: var(--accent-teal); /* Teal text color */
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.9em;
}

/* This resets the inline style for code inside a <pre> block */
pre code {
    background: none;
    color: inherit; /* Inherit the dark text color from the <pre> tag */
    padding: 0;
    font-size: 1em; /* Reset font size */
}

/* --- Site Footer --- */
.site-footer {
    grid-area: footer;
    width: 100%;
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-size: 0.9em;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--secondary-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-text);
    text-decoration: none;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        /* Revert to a single-column layout on mobile */
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    /* Adjust header for mobile */
    .header-content {
        margin-left: 0;
    }

    .search-bar {
        display: none; /* Hide search on mobile for simplicity */
    }

    /* Make the sidebar appear above the content */
    .sidebar {
        /* The sidebar will now be hidden off-screen until toggled */
        position: fixed; /* Use fixed positioning for the mobile overlay */
        top: 0;
        left: 0;
        bottom: 0;
        padding: 60px 20px 20px 20px; /* Top, Right, Bottom, Left padding */
        box-sizing: border-box;
        overflow-y: auto;
        transform: translateX(-100%);
        z-index: 1002;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .header-content {
        justify-content: flex-end; /* Push button to the right since search is hidden */
    }

    .main-content {
        max-width: 100%;
        padding: 30px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .hamburger {
        display: block;
        position: fixed;
        top: 5px;
        left: 5px;
        z-index: 1003; /* Make sure it's on top of the sidebar */
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Adjust main content padding when sidebar is active */
    body.sidebar-open .main-content {
        margin-left: 250px; /* Adjust if you want content to shift */
    }
}
