/* Minimal Wikipedia-like style */
body { font-family: sans-serif; background: #f6f6f6; color: #202122; margin: 0; padding: 0; }
#content { max-width: 1100px; margin: 20px auto; background: #fff; border: 1px solid #a7d7f9; padding: 20px; box-sizing: border-box; }

header { 
    display: flex; 
    flex-wrap: wrap; 
    align-items: flex-start; 
    gap: 16px; 
    margin-bottom: 20px; 
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 15px;
}

header img { width: 50px; height: 50px; flex-shrink: 0; }

.header-text { flex: 1; min-width: 200px; }
h1 { font-size: 1.8rem; border-bottom: none; padding-bottom: 0; margin: 0 0 10px 0; line-height: 1.2; }

/* Navigation links */
nav.links { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    margin-top: 5px; 
    font-size: 0.9rem;
}
nav.links a { color: #0645ad; text-decoration: none; white-space: nowrap; }
nav.links a:hover { text-decoration: underline; }

h2 { font-size: 1.4rem; border-bottom: 1px solid #ddd; padding-bottom: 4px; margin-top: 24px; }
.toc { background: #f8f9fa; border: 1px solid #ddd; padding: 12px; margin: 16px 0; display: inline-block; min-width: 200px; }
.toc h3 { margin: 0 0 8px 0; font-size: 1rem; text-align: center; }
.toc ul { margin: 0; padding-left: 20px; }
code, pre { background: #f8f9fa; border: 1px solid #ddd; padding: 2px 4px; border-radius: 2px; }
pre { padding: 10px; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; }
.footer { margin-top: 24px; font-size: 12px; color: #555; border-top: 1px solid #ddd; padding-top: 10px; }

/* Search Styles */
.search-container { 
    position: relative; 
    margin-top: 10px; 
    width: 100%; 
    max-width: 300px;
    display: flex;
}
.search-form { display: flex; width: 100%; }
#wiki-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #a2a9b1;
    border-radius: 2px 0 0 2px;
    font-size: 13px;
    min-width: 0; /* Fix flex overflow */
}
#wiki-search-btn {
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-left: none;
    border-radius: 0 2px 2px 0;
    cursor: pointer;
    font-weight: bold;
    color: #202122;
}
#wiki-search-btn:hover { background: #e8e8e8; }

#wiki-search-input:focus { border-color: #3366cc; outline: none; box-shadow: 0 0 0 1px #3366cc inset; }

#wiki-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    width: 100%; /* Ensure match parent width */
    box-sizing: border-box;
}
.hidden { display: none; }
.search-result-item {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #202122;
    border-bottom: 1px solid #eee;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f8f9fa; text-decoration: none; }
.result-title { font-weight: bold; font-size: 13px; color: #0645ad; }
.result-snippet { font-size: 12px; color: #54595d; margin-top: 2px; }
.search-no-results { padding: 12px; color: #72777d; font-size: 13px; text-align: center; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header { flex-direction: column; align-items: center; text-align: center; }
    .header-text { width: 100%; }
    .search-container { margin: 10px auto; width: 100%; max-width: 100%; }
    nav.links { justify-content: center; }
    #content { margin: 0; border: none; padding: 15px; }
    .toc { width: 100%; box-sizing: border-box; }
}