/* ── Wiki Content Rendering ─────────────────────────────────── */

.wiki-content {
    max-width: 100%;
    line-height: 1.75;
    color: var(--dx-text-dark, #01171e);
    font-size: 0.95rem;
    word-break: break-word;
}

.wiki-content h1,
.wiki-content h2,
.wiki-content h3,
.wiki-content h4,
.wiki-content h5 {
    margin-top: 1.5rem;
    margin-bottom: .5rem;
    font-weight: 700;
    color: var(--dx-teal-dark, #01171e);
    line-height: 1.3;
}

.wiki-content h1 { font-size: 1.6rem; border-bottom: 2px solid var(--dx-border, #e2e5e9); padding-bottom: .35rem; }
.wiki-content h2 { font-size: 1.3rem; border-bottom: 1px solid var(--dx-border, #e2e5e9); padding-bottom: .25rem; }
.wiki-content h3 { font-size: 1.1rem; }
.wiki-content h4 { font-size: 1rem; }

.wiki-content p       { margin-bottom: .75rem; }
.wiki-content ul,
.wiki-content ol      { margin-bottom: .75rem; padding-left: 1.5rem; }
.wiki-content li      { margin-bottom: .25rem; }
.wiki-content li > ul,
.wiki-content li > ol { margin-top: .25rem; margin-bottom: 0; }

.wiki-content a {
    color: var(--dx-blue-link, #2ea3f2);
    text-decoration: none;
}
.wiki-content a:hover { text-decoration: underline; }

.wiki-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.wiki-content th,
.wiki-content td {
    border: 1px solid var(--dx-border, #e2e5e9);
    padding: .45rem .65rem;
    text-align: left;
}
.wiki-content th {
    background: var(--dx-bg, #f5f6f8);
    font-weight: 600;
}
.wiki-content tr:nth-child(even) td {
    background: rgba(0,0,0,.025);
}

.wiki-content blockquote {
    margin: .75rem 0;
    padding: .5rem 1rem;
    border-left: 4px solid var(--dx-border, #e2e5e9);
    color: var(--dx-text-muted, #6f797d);
    background: var(--dx-bg, #f5f6f8);
    border-radius: 0 var(--dx-radius-sm,4px) var(--dx-radius-sm,4px) 0;
}

.wiki-content pre,
.wiki-content .wiki-code {
    background: #1e2530;
    color: #e8eaf0;
    padding: .85rem 1rem;
    border-radius: var(--dx-radius-md, 8px);
    overflow-x: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: .85rem;
    margin-bottom: .75rem;
}
.wiki-content code {
    background: rgba(0,0,0,.07);
    padding: .1em .3em;
    border-radius: 3px;
    font-size: .88em;
    font-family: 'Courier New', Consolas, monospace;
}
.wiki-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* ── Formatbausteine ─────────────────────────────────────────── */

.wiki-note,
.wiki-warning,
.wiki-tip {
    padding: .65rem 1rem;
    border-radius: var(--dx-radius-md, 8px);
    margin-bottom: .75rem;
    border-left: 4px solid;
}

.wiki-note    { background: #e8f4fd; border-color: #2ea3f2; color: #0a3d62; }
.wiki-warning { background: #fdf3e8; border-color: #e3001a; color: #7a0010; }
.wiki-tip     { background: #e8f9ef; border-color: #28a745; color: #145523; }

.wiki-note    strong { color: #1a7abf; }
.wiki-warning strong { color: #c4001a; }
.wiki-tip     strong { color: #1a7040; }

/* ── Bilder ──────────────────────────────────────────────────── */

.wiki-image,
.wiki-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--dx-radius-md, 8px);
    box-shadow: var(--dx-shadow-sm);
    margin: .5rem 0;
}

/* ── Interne Links ───────────────────────────────────────────── */

.wiki-content a.wiki-internal-link::before {
    content: "📄 ";
    font-style: normal;
}
.wiki-content a.wiki-function-link::before {
    content: "⚡ ";
    font-style: normal;
}

/* ── TOC (Inhaltsverzeichnis) ────────────────────────────────── */

.wiki-toc {
    background: var(--dx-bg, #f5f6f8);
    border: 1px solid var(--dx-border, #e2e5e9);
    border-radius: var(--dx-radius-md, 8px);
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .88rem;
}
.wiki-toc-titel {
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--dx-text-muted, #6f797d);
    margin-bottom: .4rem;
}
.wiki-toc ul { margin: 0; padding-left: 1.1rem; }
.wiki-toc li { margin: .15rem 0; }
.wiki-toc a  { color: var(--dx-teal-light, #054a62); text-decoration: none; }
.wiki-toc a:hover { text-decoration: underline; }
.wiki-toc .toc-h3 { padding-left: .75rem; }

/* ── Artikel-Header ──────────────────────────────────────────── */

.wiki-artikel-header {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--dx-border, #e2e5e9);
    flex-wrap: wrap;
}
.wiki-artikel-titel { flex: 1; min-width: 0; margin: 0; font-size: 1.4rem; font-weight: 700; }
.wiki-artikel-meta  { font-size: .78rem; color: var(--dx-text-muted, #6f797d); margin-top: .15rem; }
.wiki-artikel-aktionen { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }

/* ── Lese-Layout ─────────────────────────────────────────────── */

.wiki-lese-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    max-width: 1440px;
}
.wiki-lese-baum {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid var(--dx-border, #e2e5e9);
    padding-right: 1rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.wiki-lese-inhalt {
    flex: 1;
    min-width: 0;
}

/* ── Baum-Knoten (Lesesicht) ─────────────────────────────────── */

.wiki-baum-knoten {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .5rem;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    font-size: .88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wiki-baum-knoten:hover { background: var(--dx-bg, #f5f6f8); }
.wiki-baum-knoten.aktiv { background: #e3f0ff; font-weight: 600; color: var(--dx-teal-dark, #01171e); }
.wiki-baum-knoten.ordner { color: var(--dx-text-muted, #6f797d); cursor: default; }
.wiki-baum-kinder { padding-left: 1.1rem; border-left: 1px dashed var(--dx-border, #e2e5e9); margin-left: .55rem; }

/* ── Bereiche-Übersicht ──────────────────────────────────────── */

.wiki-bereiche-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    padding: .5rem 0;
}
.wiki-bereich-karte {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--dx-border, #e2e5e9);
    border-radius: var(--dx-radius-lg, 12px);
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--dx-duration) var(--dx-ease), border-color var(--dx-duration) var(--dx-ease);
    background: #fff;
    cursor: pointer;
}
.wiki-bereich-karte:hover {
    box-shadow: var(--dx-shadow-md);
    border-color: var(--dx-red, #e3001a);
    color: inherit;
    text-decoration: none;
}
.wiki-bereich-karte-icon {
    font-size: 1.6rem;
    margin-bottom: .25rem;
}
.wiki-bereich-karte h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--dx-teal-dark, #01171e);
}
.wiki-bereich-karte p {
    margin: 0;
    font-size: .83rem;
    color: var(--dx-text-muted, #6f797d);
    line-height: 1.4;
}

/* ── Anhänge (Lesesicht) ─────────────────────────────────────── */

.wiki-anhaenge-leseansicht {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--dx-border, #e2e5e9);
}

.wiki-anhaenge-titel {
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--dx-text-muted, #6f797d);
    margin-bottom: .5rem;
}

.wiki-anhang-link {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .65rem;
    border: 1px solid var(--dx-border, #e2e5e9);
    border-radius: var(--dx-radius-sm, 4px);
    text-decoration: none;
    color: var(--dx-text-dark, #01171e);
    font-size: .88rem;
    margin-bottom: .3rem;
    transition: background .12s;
}

.wiki-anhang-link:hover {
    background: var(--dx-bg, #f5f6f8);
    text-decoration: none;
    color: inherit;
}

/* ── Dark Mode ───────────────────────────────────────────────── */

[data-theme="dark"] .wiki-content         { color: #e8eaf0; }
[data-theme="dark"] .wiki-content h1,
[data-theme="dark"] .wiki-content h2,
[data-theme="dark"] .wiki-content h3,
[data-theme="dark"] .wiki-content h4      { color: #f0f2f5; border-color: #2d3748; }
[data-theme="dark"] .wiki-content th      { background: #1a202c; }
[data-theme="dark"] .wiki-content code    { background: rgba(255,255,255,.1); }
[data-theme="dark"] .wiki-toc             { background: #1a202c; border-color: #2d3748; }
[data-theme="dark"] .wiki-bereich-karte   { background: #1a202c; border-color: #2d3748; }
[data-theme="dark"] .wiki-bereich-karte h3 { color: #f0f2f5; }
[data-theme="dark"] .wiki-baum-knoten.aktiv { background: #0d2d4e; }
[data-theme="dark"] .wiki-note    { background: #0a1f2f; }
[data-theme="dark"] .wiki-warning { background: #2a0a0a; }
[data-theme="dark"] .wiki-tip     { background: #0a2014; }

/* ── Suche ─────────────────────────────────────────────────────── */

.wiki-suche-container {
    position: relative;
}

.wiki-suche-ergebnisse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--dx-card, #fff);
    border: 1px solid var(--dx-border, #e2e5e9);
    border-radius: var(--dx-radius-sm, 4px);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    max-height: 400px;
    overflow-y: auto;
}

.wiki-suche-meldung {
    padding: .75rem 1rem;
    color: var(--dx-text-muted, #6f797d);
    font-size: .88rem;
}

.wiki-suche-treffer {
    padding: .65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--dx-border, #e2e5e9);
    transition: background .1s;
}

.wiki-suche-treffer:last-child { border-bottom: none; }

.wiki-suche-treffer:hover { background: var(--dx-bg, #f5f6f8); }

.wiki-suche-treffer-titel {
    font-weight: 600;
    font-size: .9rem;
    color: var(--dx-text-dark, #01171e);
}

.wiki-suche-treffer-bereich {
    font-size: .76rem;
    color: var(--dx-teal, #0097b2);
    margin-top: .1rem;
}

.wiki-suche-treffer-snippet {
    font-size: .8rem;
    color: var(--dx-text-muted, #6f797d);
    margin-top: .25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Neue-Artikel-Badge ─────────────────────────────────────── */

.wiki-neu-badge {
    display: inline-block;
    background: var(--bs-warning, #ffc107);
    color: #000;
    font-size: .72rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 999px;
    line-height: 1.6;
}

/* ── Feedback & Lesezeichen ─────────────────────────────────── */

.wiki-artikel-fusszeile {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--dx-border, #e2e5e9);
}

.wiki-feedback-bereich {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.wiki-feedback-kommentar-box {
    margin-top: .75rem;
    padding: .75rem;
    background: var(--dx-bg, #f5f6f8);
    border-radius: var(--dx-radius-sm, 4px);
    border: 1px solid var(--dx-border, #e2e5e9);
}

/* ── Pflichtartikel-Box ─────────────────────────────────────── */

.wiki-pflicht-box {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1.5rem;
    padding: .75rem 1rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: var(--dx-radius-sm, 4px);
}

/* ── Favoriten-Seite ─────────────────────────────────────────── */

.wiki-favorit-eintrag {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--dx-border, #e2e5e9);
    border-radius: var(--dx-radius-sm, 4px);
    cursor: pointer;
    transition: background .12s;
}

.wiki-favorit-eintrag:hover { background: var(--dx-bg, #f5f6f8); }

/* ── Admin Statistik-Karten ─────────────────────────────────── */

.wiki-stat-card {
    background: var(--dx-card, #fff);
    border: 1px solid var(--dx-border, #e2e5e9);
    border-radius: var(--dx-radius, 6px);
    padding: .75rem 1.25rem;
    min-width: 130px;
    text-align: center;
}

.wiki-stat-card--gruen { border-left: 3px solid var(--bs-success, #28a745); }
.wiki-stat-card--rot   { border-left: 3px solid var(--bs-danger, #dc3545); }

.wiki-stat-wert {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dx-text-dark, #01171e);
    line-height: 1.2;
}

.wiki-stat-label {
    font-size: .78rem;
    color: var(--dx-text-muted, #6f797d);
    margin-top: .2rem;
}

/* ── Dark Mode: Neue Elemente ───────────────────────────────── */

[data-theme="dark"] .wiki-suche-ergebnisse   { background: #1a202c; border-color: #2d3748; }
[data-theme="dark"] .wiki-suche-treffer:hover { background: #2d3748; }
[data-theme="dark"] .wiki-suche-treffer-titel { color: #f0f2f5; }
[data-theme="dark"] .wiki-stat-card          { background: #1a202c; border-color: #2d3748; }
[data-theme="dark"] .wiki-stat-wert          { color: #f0f2f5; }
[data-theme="dark"] .wiki-favorit-eintrag    { border-color: #2d3748; }
[data-theme="dark"] .wiki-favorit-eintrag:hover { background: #2d3748; }
[data-theme="dark"] .wiki-pflicht-box        { background: rgba(255,193,7,.08); border-color: rgba(255,193,7,.25); }
[data-theme="dark"] .wiki-feedback-kommentar-box { background: #2d3748; border-color: #4a5568; }
