/* Wiki Server - Clean, minimal styling */

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border: #e5e7eb;
    --pre-bg: #1e293b;
    --pre-text: #e2e8f0;
    --code-bg: #f1f5f9;
    --dead-link: #ef4444;
    --success: #22c55e;
    --error: #ef4444;
    --nav-height: 48px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --bg-card: #1e293b;
        --text: #e2e8f0;
        --text-muted: #94a3b8;
        --accent: #60a5fa;
        --accent-hover: #93bbfd;
        --border: #334155;
        --pre-bg: #0f172a;
        --code-bg: #1e293b;
        --dead-link: #f87171;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

/* Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-weight: 700;
    font-size: 18px;
    color: var(--accent);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Main content */
.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 32px) 20px 80px;
}

/* Wiki page */
.wiki-page h1 {
    font-size: 2em;
    margin-bottom: 0.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
}

.wiki-page h2 {
    font-size: 1.5em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.wiki-page h3 {
    font-size: 1.25em;
    margin-top: 1.2em;
    margin-bottom: 0.4em;
}

.wiki-page p {
    margin-bottom: 1em;
}

.wiki-page ul, .wiki-page ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.wiki-page li {
    margin-bottom: 0.3em;
}

.wiki-page a {
    color: var(--accent);
    text-decoration: none;
}

.wiki-page a:hover {
    text-decoration: underline;
}

.wiki-page .dead-link {
    color: var(--dead-link);
    text-decoration: none;
    cursor: not-allowed;
}

.wiki-page .dead-link::after {
    content: " (page not created yet)";
    font-size: 0.8em;
    opacity: 0.7;
}

/* Code blocks */
.wiki-page pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1em;
    font-size: 14px;
    line-height: 1.5;
}

.wiki-page code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
}

.wiki-page pre code {
    background: none;
    padding: 0;
}

/* Tables */
.wiki-page table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.wiki-page th, .wiki-page td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.wiki-page th {
    background: var(--code-bg);
    font-weight: 600;
}

/* Blockquotes */
.wiki-page blockquote {
    border-left: 4px solid var(--accent);
    padding: 8px 16px;
    margin: 0 0 1em;
    background: var(--code-bg);
    border-radius: 0 8px 8px 0;
}

/* TOC */
.wiki-page .toc {
    background: var(--code-bg);
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 1.5em;
    display: inline-block;
}

.wiki-page .toc ul {
    list-style: none;
    padding-left: 1.5em;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.form-group .help {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--accent-hover);
}

/* Upload result */
.upload-result {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 16px;
}

.upload-result.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.upload-result.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

/* Search */
.search-group {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
}

.search-summary {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

.search-result {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    background: var(--bg-card);
}

.search-result h3 {
    margin-bottom: 8px;
}

.search-result h3 a {
    color: var(--accent);
    text-decoration: none;
}

.search-result h3 a:hover {
    text-decoration: underline;
}

.result-snippet {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.result-snippet b, .result-snippet strong {
    color: var(--text);
    background: rgba(59, 130, 246, 0.15);
    padding: 0 2px;
    border-radius: 2px;
}

.result-path {
    font-size: 12px;
    color: var(--text-muted);
}

.result-score {
    margin-left: 16px;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

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

/* Responsive */
@media (max-width: 640px) {
    .nav-links {
        gap: 10px;
    }
    .nav-links a {
        font-size: 12px;
    }
    .main-content {
        padding-left: 12px;
        padding-right: 12px;
    }
}
