/* General Body and Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* --- TOP MENU BAR --- */
#top-menubar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #34495e;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    flex-shrink: 0;
    z-index: 1000;
}

#top-menubar .app-name {
    font-size: 1.5em;
    font-weight: bold;
}

#top-menubar .search-container {
    position: relative; /* Anchor for the results dropdown */
}

#top-menubar .search-input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    width: 250px;
}

.search-results {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    list-style-type: none;
    padding: 0;
    margin-top: 5px;
}

.search-results.visible {
    display: block;
}

.search-result-item a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-result-item a:hover {
    background-color: #f6f8fa;
}

.search-result-item small {
    display: block;
    color: #777;
    font-size: 0.8em;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Wrapper for Nav and Main Content */
#content-wrapper {
    display: flex;
    flex-grow: 1;
}

/* --- LEFT NAVIGATION BAR --- */
#wiki-nav,
#nav-placeholder {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e1e4e8;
    padding: 15px 0;
    height: calc(100vh - 58px); /* Adjust for header height */
    overflow-y: auto;
    position: sticky;
    top: 58px; /* Stick below the header */
}

#wiki-nav .home-link,
#nav-placeholder .home-link {
    display: block;
    font-weight: bold;
    color: #2c3e50;
    padding: 15px 20px;
    font-size: 1.2em;
    text-decoration: none;
    border-bottom: 1px solid #e1e4e8;
    margin-bottom: 10px;
}

#wiki-nav .home-link:hover,
#nav-placeholder .home-link:hover {
    background-color: #f6f8fa;
}

.nav-category { margin-bottom: 5px; }

.nav-header {
    background: none; border: none; width: 100%; text-align: left;
    padding: 12px 20px; font-size: 1em; font-weight: 500;
    color: #2d3436; cursor: pointer; position: relative;
    transition: background-color 0.2s;
}
.nav-header:hover { background-color: #f6f8fa; }
.nav-header::after {
    content: '\25B8'; position: absolute; right: 15px; top: 50%;
    transform: translateY(-50%) rotate(0deg); font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
}
.nav-header.active::after { transform: translateY(-50%) rotate(90deg); }

.nav-links {
    list-style-type: none; padding: 0; margin: 0;
    background-color: #f6f8fa; max-height: 0;
    overflow: hidden; transition: max-height 0.3s ease-in-out;
}
.nav-links li a {
    display: block; text-decoration: none; color: #576574;
    padding: 10px 20px 10px 35px; font-size: 0.95em;
    transition: background-color 0.2s;
}
.nav-links li a:hover { background-color: #e1e4e8; }
.nav-links li a.active {
    background-color: #0984e3;
    color: #ffffff;
    font-weight: 600;
}
.nav-links li a.active:hover {
    background-color: #0773c7;
}
.home-link.active {
    background-color: #0984e3;
    color: #ffffff !important;
}


/* --- MAIN CONTENT AREA --- */
#wiki-main {
    flex-grow: 1;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Headings & Content Blocks */
h1, h2, h3, h4 {
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
    width: 100%;
    max-width: 960px;
}
h1 { text-align: center; border-bottom-width: 3px; }
h2 { margin-top: 40px; background-color: #ecf0f1; padding: 10px 15px; border-radius: 6px; }

.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 0;
    width: 100%;
    max-width: 960px;
    margin: 20px 0;
}
.menu-item {
    background-color: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 25px;
    margin: 20px 0;
    max-width: 960px;
    width: 100%;
    box-shadow: 0 1px 5px rgba(0,0,0,0.06);
}

.menu-link {
    background-color: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 15px 20px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.menu-link:hover {
    background-color: #f6f8fa;
    border-color: #0984e3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.menu-link a {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    font-size: 1em;
    display: block;
}

.menu-link a:hover {
    color: #0984e3;
}
.purpose {
    font-style: italic;
    color: #576574;
    border-left: 3px solid #0984e3;
    padding-left: 15px;
    margin-bottom: 20px;
}
ol { padding-left: 20px; }
ol li { margin-bottom: 8px; }
ul { list-style-type: none; padding: 0; }
