/* ===================================================================
   Anivation Knowledgebase — stylesheet
   Lichte, frisse, KB-look in lijn met kb.flexynode.com.
   =================================================================== */

:root {
    --bg:           #f6f7f9;
    --surface:      #ffffff;
    --surface-2:    #fafbfc;
    --border:       #e5e7eb;
    --border-strong:#d1d5db;
    --text:         #15181d;
    --text-soft:    #4b5563;
    --text-muted:   #6b7280;
    --primary:      #0f0f0f;
    --primary-ink:  #fafafa;
    --accent:       #c6f432;
    --accent-ink:   #0f0f0f;
    --coral:        #ff6a4d;
    --link:         #0a58ca;
    --link-hover:   #073f93;
    --danger:       #b91c1c;
    --ok-bg:        #ecfdf5;
    --ok-fg:        #047857;
    --err-bg:       #fef2f2;
    --err-fg:       #b91c1c;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
    --topbar-h:     60px;
    --sidebar-w:    280px;
    --maxw:         1100px;
    --mono:         ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
    --sans:         system-ui,-apple-system,Segoe UI,Roboto,Inter,"Helvetica Neue",Arial,sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; }
code { font-family: var(--mono); font-size: .92em;
       background: #f1f3f5; padding: .12em .35em; border-radius: 4px; }
pre  { font-family: var(--mono); font-size: .9em;
       background: #0f172a; color: #e2e8f0;
       padding: 14px 16px; border-radius: var(--radius-sm); overflow:auto; }
pre code { background: transparent; padding: 0; color: inherit; }

.muted     { color: var(--text-muted); }
.inline    { display: inline; }

/* ============ Topbar ============ */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 30;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text);
    font-weight: 700; letter-spacing: -.01em;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--primary); color: var(--accent);
    display: grid; place-items: center;
    font-weight: 800; font-size: 18px;
}
.brand-name { font-size: 15px; }

.search { flex: 1; max-width: 540px; }
.search input {
    width: 100%; height: 38px; padding: 0 14px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-2);
    font-size: 14px;
}
.search input:focus {
    outline: none; border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(15,15,15,.08);
}

.topnav { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.user-menu { display: flex; align-items: center; gap: 6px; padding-left: 8px;
             border-left: 1px solid var(--border); margin-left: 4px; }
.user-chip {
    display: flex; flex-direction: column; align-items: flex-end;
    padding: 4px 8px; border-radius: 8px;
    color: var(--text); line-height: 1.1; font-size: 13px;
}
.user-chip small { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.user-chip:hover { background: var(--bg); text-decoration: none; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    text-decoration: none; transition: background .12s, border-color .12s;
    line-height: 1;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { background: #1f1f1f; color: var(--primary-ink); }
.btn-ghost   { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger  { background: var(--err-bg); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm      { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block   { width: 100%; justify-content: center; }

/* ============ Shell + Sidebar ============ */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: calc(100vh - var(--topbar-h));
}
.sidebar {
    border-right: 1px solid var(--border);
    background: var(--surface);
    padding: 18px 12px 60px;
    position: sticky; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
}
.cat-tree { list-style: none; padding: 0; margin: 0; }
.cat-home a { display:block; padding: 6px 10px; border-radius: 6px;
              color: var(--text); font-weight: 600; margin-bottom: 6px; }
.cat-home a:hover { background: var(--bg); text-decoration: none; }

.cat       { margin-bottom: 6px; }
.cat-head  { padding: 8px 10px 2px; font-size: 12px;
             text-transform: uppercase; letter-spacing: .06em;
             color: var(--text-muted); font-weight: 700; }
.cat-pages, .cat-children { list-style: none; padding: 0; margin: 0 0 4px; }
.cat-pages li a {
    display: block; padding: 5px 10px; border-radius: 6px;
    color: var(--text-soft); font-size: 14px;
    border-left: 2px solid transparent;
}
.cat-pages li a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.cat-children { padding-left: 8px; }

/* ============ Content ============ */
.content {
    padding: 28px 36px 80px;
    max-width: var(--maxw);
    width: 100%;
}

.page-header { display: flex; align-items: center; justify-content: space-between;
               gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-header h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.page-header p { margin: 4px 0 0; }

/* ============ Flash ============ */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-ok  { background: var(--ok-bg);  color: var(--ok-fg);  border: 1px solid #a7f3d0; }
.flash-err { background: var(--err-bg); color: var(--err-fg); border: 1px solid #fecaca; }

/* ============ Cards / Dashboard ============ */
.cards-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    margin-bottom: 28px;
}
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card-list { list-style: none; padding: 0; margin: 0; }
.card-list li { padding: 3px 0; font-size: 14px; }
.card-list li a { color: var(--text-soft); }

.recent { margin-top: 32px; }
.recent h2 { margin: 0 0 10px; font-size: 18px; }
.recent-list { list-style: none; padding: 0; margin: 0;
               border-top: 1px solid var(--border); }
.recent-list li { padding: 10px 0; border-bottom: 1px solid var(--border);
                  display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.recent-list li a { font-weight: 500; }

/* ============ Search ============ */
.search-results { list-style: none; padding: 0; margin: 0;
                  border-top: 1px solid var(--border); }
.search-results li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.search-title { font-size: 16px; font-weight: 500; }

/* ============ Page article (Markdown render) ============ */
.page-article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow);
}
.page-meta { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 22px; }
.page-meta h1 { margin: 6px 0 4px; font-size: 28px; letter-spacing: -.01em; }
.crumbs span { font-size: 12px; font-weight: 600; color: var(--text-muted);
               text-transform: uppercase; letter-spacing: .08em; }
.page-actions { display: flex; gap: 8px; margin-top: 12px; }

.md-content { font-size: 15px; line-height: 1.7; color: var(--text); }
.md-content h1, .md-content h2, .md-content h3, .md-content h4 {
    line-height: 1.25; letter-spacing: -.01em; margin: 1.6em 0 .5em;
}
.md-content h1 { font-size: 26px; }
.md-content h2 { font-size: 21px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.md-content h3 { font-size: 17px; }
.md-content h4 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }
.md-content p { margin: 0 0 1em; }
.md-content ul, .md-content ol { margin: 0 0 1em 1.4em; padding: 0; }
.md-content li { margin: .25em 0; }
.md-content blockquote {
    margin: 1em 0; padding: 8px 14px;
    border-left: 3px solid var(--accent);
    background: #fcfdfa; color: var(--text-soft);
    border-radius: 0 6px 6px 0;
}
.md-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; }
.md-content th, .md-content td { padding: 8px 10px; border: 1px solid var(--border); text-align: left; }
.md-content th { background: var(--surface-2); }
.md-content a { color: var(--link); }
.md-content img { border-radius: var(--radius-sm); margin: 1em 0; }
.md-content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* ============ Forms ============ */
.form { display: grid; gap: 14px; max-width: 520px; }
.form-wide   { max-width: 100%; }
.form-narrow { max-width: 480px; }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; max-width: 100%; }
.form-inline .grow { flex: 1; min-width: 200px; }
.form label { display: grid; gap: 5px; font-size: 13px; color: var(--text-soft); }
.form label > span { font-weight: 600; color: var(--text); font-size: 13px; }

.form input, .form select, .form textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--text);
    font-family: inherit; font-size: 14px;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,15,15,.08);
}
.form input[disabled] { background: var(--surface-2); color: var(--text-muted); }

.form .md-editor { font-family: var(--mono); font-size: 14px; line-height: 1.5; min-height: 380px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.fieldset legend { padding: 0 6px; font-weight: 600; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ============ Tables ============ */
.table { width: 100%; border-collapse: collapse;
         background: var(--surface); border: 1px solid var(--border);
         border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-soft); }
.table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.role { display: inline-block; padding: 2px 8px; border-radius: 999px;
        font-size: 12px; font-weight: 600; text-transform: capitalize;
        background: #eef2ff; color: #3730a3; }
.role-editor { background: #ecfeff; color: #155e75; }
.role-admin  { background: #fef3c7; color: #92400e; }

/* ============ Panels ============ */
.panel { background: var(--surface); border: 1px solid var(--border);
         border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
         box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 16px; }

/* ============ Auth ============ */
.auth-body { display: grid; place-items: center; min-height: 100vh;
             background: linear-gradient(180deg, #f6f7f9 0%, #eef0f3 100%); padding: 24px; }
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 28px 28px 22px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 40px rgba(0,0,0,.06);
}
.auth-card h1 { margin: 0 0 16px; font-size: 22px; letter-spacing: -.01em; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-footnote { margin-top: 20px; color: var(--text-muted); font-size: 12px; text-align: center; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static; height: auto; max-height: 280px;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .content { padding: 22px 18px 60px; }
    .topbar { gap: 8px; padding: 0 12px; }
    .brand-name { display: none; }
    .topnav .btn { padding: 0 10px; }
    .user-chip { display: none; }
    .page-article { padding: 20px; }
}
