/* ============================================================
   RMH Knowledgebase – Public (3-Spalten-Layout)
   ============================================================ */

/* ── Design Tokens ──────────────────── */
:root {
    --accent:        #f9423a;
    --accent-weak:   rgba(249,66,58,.12);
    --accent-line:   rgba(249,66,58,.35);
    --sidebar-bg:    #3b3c3f;
    --toc-bg:        #f5f5f3;
    --text:          #3b3c3f;
    --text-strong:   #1f2937;
    --muted:         #64748b;
    --faint:         #94a3b8;
    --border:        #e2e8f0;
    --border-soft:   #dee2e6;
    --surface:       #ffffff;
    --surface-2:     #fafafa;
    --surface-code:  #f1f3f5;
    --code-bg:       #1e1e2e;
    --code-text:     #cdd6f4;
    --shadow-author: 0 1px 3px rgba(0,0,0,.05), 0 4px 16px -4px rgba(0,0,0,.07);
}

/* ── Reset ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Metropolis', system-ui, sans-serif;
    font-weight: 400; font-size: 15px; line-height: 1.7;
    color: var(--text); background: var(--surface);
    height: 100vh; overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
a:hover {
     /* text-decoration: underline;  */
}

/* ── Layout ─────────────────────────── */
.app { display: flex; height: 100vh; }

/* ── Linke Sidebar ──────────────────── */
.sidebar-left { width: 252px; flex-shrink: 0; background: var(--sidebar-bg); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-logo { padding: 16px; border-bottom: 1px solid rgba(255,255,255,.1); flex-shrink: 0; position: relative; }
.sidebar-logo::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 50px; height: 2px; background: var(--accent); }
.sidebar-logo img  { height: 18px; width: auto; display: block; margin-bottom: 5px; }
.sidebar-logo span { display: block; font-size: 11px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.4); }
.sidebar-search { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.sidebar-search input { width: 100%; border: 1px solid rgba(255,255,255,.15); border-radius: 6px; padding: 8px 10px; font-size: 13px; background: rgba(0,0,0,.2); color: #fff; outline: none; }
.sidebar-search input::placeholder { color: rgba(255,255,255,.35); }
.sidebar-search input:focus { border-color: rgba(249,66,58,.5); background: rgba(0,0,0,.28); }
.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.sidebar-footer { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.1); flex-shrink: 0; font-size: 12px; display: flex; gap: 12px; align-items: center; }
.sidebar-footer a, .sidebar-footer button { color: rgba(255,255,255,.4); background: none; border: none; cursor: pointer; font-size: 12px; padding: 0; }
.sidebar-footer a:hover, .sidebar-footer button:hover { color: var(--accent); text-decoration: none; }

/* ── Collections-Nav ────────────────── */
/* Eigenständiger Nav-Link (z.B. Startseite) – gleiche Optik wie col-cat-link */
.sidebar-nav-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 4px 4px 0; border-radius: 5px; font-size: 14px; color: rgba(255,255,255,.78); font-weight: 400; text-decoration: none; transition: background .12s, color .12s; }
.sidebar-nav-link:hover { background: rgba(0,0,0,.18); color: #fff; text-decoration: none; }
.sidebar-nav-link.active { background: var(--accent); color: #fff; font-weight: 500; }

.col-header   { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.4); padding: 16px 14px 6px; }

/* Kategorie-Zeile: Titellink + Toggle-Pfeil sind getrennte Elemente */
.col-btn-wrap { display: flex; align-items: center; margin: 1px 4px; border-radius: 5px; transition: background .12s; }
.col-btn-wrap:hover { background: rgba(0,0,0,.18); }
.col-cat-link { display: flex; align-items: center; gap: 8px; flex: 1; padding: 7px 4px 7px 10px; font-size: 14px; color: rgba(255,255,255,.78); text-decoration: none; font-weight: 400; }
.col-cat-link:hover  { color: #fff; text-decoration: none; }
.col-cat-link.active { color: rgba(255,255,255,.95); font-weight: 500; }
.col-toggle   { background: none; border: none; cursor: pointer; padding: 6px 10px; color: rgba(255,255,255,.35); display: flex; align-items: center; flex-shrink: 0; }
.col-toggle:hover { color: rgba(255,255,255,.75); }

.col-dot      { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.col-chevron  { font-size: 10px; color: rgba(255,255,255,.4); transition: transform .2s ease; display: inline-block; }
.col-chevron.open { transform: rotate(90deg); }

/* Sanfte Transition statt hartem display:none/block */
.col-items {
    display: block;
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
    padding-bottom: 0;
}
.col-items.open {
    max-height: 600px;
    padding-bottom: 4px;
}

.col-items a  { display: block; padding: 6px 10px 6px 34px; font-size: 13.5px; color: rgba(255,255,255,.72); border-radius: 5px; margin: 1px 4px; font-weight: 400; }
.col-items a:hover  { background: rgba(0,0,0,.18); color: #fff; text-decoration: none; }
.col-items a.active { background: var(--accent); color: #fff; font-weight: 500; }
.col-sub-label { display: block; font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.55); padding: 10px 10px 3px 26px; text-transform: uppercase; letter-spacing: .0em; text-decoration: none; transition: color .12s; }
.col-sub-label:hover { color: rgba(255,255,255,.85); text-decoration: none; }
.col-items .sub-article { padding-left: 44px; }

/* ── TOC (Mitte) ────────────────────── */
.sidebar-toc { width: 220px; flex-shrink: 0; background: var(--toc-bg); overflow: hidden; transition: width .2s ease; }
.sidebar-toc.collapsed { width: 0; }
.toc-header  { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 20px 16px 8px; white-space: nowrap; }
/* Kontrast verbessert: war #64748b, aktiv bleibt Akzent */
.toc-link    { display: block; padding: 5px 16px; font-size: 13.5px; color: var(--muted); border-left: 2px solid transparent; margin: 0 0 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.toc-link:hover  { color: var(--text); text-decoration: none; border-left-color: var(--border); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
#toc-toggle-btn { width: 16px; flex-shrink: 0; background: var(--toc-bg); border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); cursor: pointer; color: var(--faint); font-size: 10px; padding: 20px 0 0; display: flex; align-items: center; justify-content: center; transition: background .15s; }
#toc-toggle-btn:hover { background: #ededeb; color: var(--muted); }

/* ── Hauptinhalt ────────────────────── */
.main-content { flex: 1; overflow-y: auto; padding: 52px 64px; max-width: 880px; }

/* ── Prose / Artikel ────────────────── */
.prose h1 { font-size: 2.1rem; font-weight: 700; margin-bottom: 14px; line-height: 1.2; letter-spacing: -.025em; }
.prose:not(#article-content) h1 {
    font-size: 3.1rem;
}
.prose h2 { font-size: 1.4rem; font-weight: 700; margin: 40px 0 12px; border-bottom: 1px solid #e9ecef; padding-bottom: 8px; }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 28px 0 10px; }
.prose p  { margin-bottom: 16px; font-weight: 400; line-height: 1.75; }
.prose ul, .prose ol { margin: 0 0 16px 24px; }
.prose li { margin-bottom: 6px; font-weight: 400; line-height: 1.65; }
.prose code     { background: var(--surface-code); padding: 2px 6px; border-radius: 4px; font-size: .87em; font-family: monospace; }
.prose pre      { background: var(--code-bg); color: var(--code-text); padding: 18px; border-radius: 8px; overflow-x: auto; margin-bottom: 18px; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 0 0 16px; padding: 4px 0 4px 18px; color: var(--muted); font-style: italic; }
.prose img      { max-width: 100%; border-radius: 8px; margin: 14px 0; }
.prose table    { border-collapse: collapse; width: 100%; margin-bottom: 16px; }
.prose th, .prose td { border: 1px solid var(--border-soft); padding: 10px 14px; font-size: 14px; font-weight: 400; }
.prose th       { background: #f8f9fa; font-weight: 600; }

/* ── Meta / Badges ──────────────────── */
.article-meta   { font-size: 13.5px; color: var(--faint); margin-bottom: 32px; display: flex; gap: 16px; flex-wrap: wrap; font-weight: 400; align-items: center; }
.badge          { display: inline-block; font-size: 11.5px; padding: 3px 10px; border-radius: 20px; background: #f1f3f5; color: var(--muted); font-weight: 500; }
.badge-internal { background: var(--accent-weak); color: var(--accent); }

/* ── Autorenbox ─────────────────────── */
.author-box    { margin-top: 56px; padding: 28px 32px; border: 1px solid var(--border); border-radius: 12px; display: flex; gap: 24px; align-items: flex-start; background: var(--surface-2); box-shadow: var(--shadow-author); }
.author-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--border); }
.author-name   { font-weight: 700; font-size: 17px; color: var(--text); margin-bottom: 3px; }
.author-title  { font-size: 14px; color: var(--muted); margin-bottom: 12px; font-weight: 400; }
.author-bio    { font-size: 14.5px; color: #475569; line-height: 1.7; margin-bottom: 14px; font-weight: 400; }
.author-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-line);
  padding: 5px 12px; border-radius: 7px; text-decoration: none;
  transition: background .15s;
}
.author-link:hover { background: var(--accent-weak); text-decoration: none; }

/* ── Breadcrumb ─────────────────────── */
.breadcrumb     { font-size: 14px; color: var(--faint); margin-bottom: 24px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb a   { color: var(--faint); font-weight: 400; }
.breadcrumb .sep { opacity: .5; }

/* ── Responsive ─────────────────────── */
@media (max-width: 900px) { .sidebar-toc { display: none; } #toc-toggle-btn { display: none; } .main-content { padding: 28px 24px; } }
@media (max-width: 640px) { .sidebar-left { display: none; } }

/* ── Author-Info-Wrapper ────────────── */
.author-info { flex: 1; min-width: 0; }

/* ── Breadcrumb aktive Kategorie ────── */
/* color bleibt dynamisch inline; nur font-weight hierher */
.breadcrumb-active { font-weight: 500; }

/* ── Kategorie-Seite Header-Hero ────── */
/* background-color + optional background-image bleiben inline (PHP-Wert) */
.cat-hero {
  margin: -48px -60px 40px; padding: 48px 60px;
  position: relative; min-height: 200px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background-size: cover; background-position: center;
}
/* gradient-Overlay: background-Wert bleibt inline (dynamische Farbe) */
.cat-hero-overlay  { position: absolute; inset: 0; pointer-events: none; }
.cat-hero-content  { position: relative; z-index: 1; }
.cat-hero-parent   { font-size: 12px; color: rgba(255,255,255,.7); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
.cat-hero-title    { font-size: 2rem; font-weight: 700; color: #fff; margin: 0 0 10px; line-height: 1.2; }
.cat-hero-desc     { color: rgba(255,255,255,.85); font-size: 15px; max-width: 600px; line-height: 1.6; margin: 0; font-weight: 400; }

/* ── Kategorie-Seite Inhalt ─────────── */
.section-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

.sub-cat-section { margin-bottom: 40px; }
.sub-cat-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
/* border-color & --hover-bg bleiben inline (dynamische PHP-Kategorie-Farbe) */
.sub-cat-card    { display: block; padding: 14px 16px; border-radius: 8px; text-decoration: none; color: var(--text); border: 2px solid transparent; transition: background .12s; }
.sub-cat-card:hover { background: var(--hover-bg, rgba(249,66,58,.08)); }
.sub-cat-title   { font-weight: 600; font-size: 14px; display: block; margin-bottom: 2px; }
.sub-cat-count   { font-size: 12px; color: var(--muted); }

/* Artikel-Links auf Kategorie-Seite */
/* --hover-border & --hover-bg werden inline als CSS-Variablen gesetzt */
.cat-article-link  { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 7px; color: var(--text); text-decoration: none; border: 1px solid transparent; margin-bottom: 2px; transition: border-color .12s, background .12s; }
.cat-article-link:hover { border-color: var(--hover-border, var(--accent)); background: var(--hover-bg, var(--accent-weak)); }
.cat-article-title { font-weight: 500; font-size: 14px; }
.cat-article-date  { font-size: 12px; color: var(--muted); flex-shrink: 0; margin-left: 16px; }
.cat-empty-msg     { color: var(--muted); font-size: 14px; }

/* ── TOC Sub-Label (Kategorie-Seite) ── */
.toc-sub-label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 12px 16px 4px; }

/* ── Badge öffentlich (Public-Frontend) */
.badge-public { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 50px; background: rgba(16,185,129,.12); color: #059669; flex-shrink: 0; }

/* ── Meta-Trenner ───────────────────── */
.meta-sep { opacity: .35; line-height: 1; }

/* ── Suchseite ──────────────────────── */
.search-header      { margin-bottom: 32px; }
.search-title       { font-size: 1.6rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; margin-bottom: 6px; }
.search-header-sub  { font-size: 14px; color: var(--faint); font-weight: 400; }
.search-header-sub strong { color: var(--muted); font-weight: 600; }
.search-results     { display: flex; flex-direction: column; gap: 2px; }
.search-card        { display: block; padding: 18px 20px; border-radius: 10px; border: 1px solid var(--border); text-decoration: none; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.search-card:hover  { border-color: var(--accent); box-shadow: 0 2px 12px rgba(249,66,58,.08); }
.search-card-head   { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.search-card-title  { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.search-card-excerpt { font-size: 13.5px; color: var(--muted); line-height: 1.65; margin-bottom: 10px; font-weight: 400; }
.search-card-excerpt mark { background: #fef08a; border-radius: 2px; padding: 0 2px; }
.search-card-meta   { display: flex; gap: 12px; font-size: 12.5px; color: var(--faint); font-weight: 400; align-items: center; }
.search-empty       { text-align: center; padding: 60px 0; color: var(--muted); }
.search-empty-icon  { font-size: 2rem; margin-bottom: 12px; }

/* ── Kurse – Öffentliche Seiten ─────── */
.courses-header   { margin-bottom: 32px; }
.courses-title    { font-size: 1.6rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.courses-sub      { font-size: 15px; color: var(--muted); }
.course-card      { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); text-decoration: none; margin-bottom: 16px; transition: box-shadow .15s, border-color .15s; }
.course-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); border-color: var(--accent-line); }
.course-card-img img { width: 100%; height: 200px; object-fit: cover; display: block; }
.course-card-body { padding: 20px 22px; flex: 1; }
.course-card-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.course-card-desc  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 12px; }
.course-card-meta  { display: flex; gap: 12px; font-size: 13px; color: var(--faint); align-items: center; }
.course-card-cta   { padding: 14px 22px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--accent); }
.course-hero-img img { width: 100%; height: 280px; object-fit: cover; border-radius: 12px; margin-bottom: 24px; }
.course-hero-title  { font-size: 2rem; font-weight: 700; color: var(--text); margin-bottom: 10px; letter-spacing: -.02em; }
.course-hero-desc   { font-size: 15px; color: var(--muted); line-height: 1.7; margin-bottom: 20px; }
.course-hero-meta   { display: flex; gap: 16px; font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.course-progress-bar-wrap { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; margin-bottom: 8px; }
.course-progress-bar { background: var(--accent); height: 6px; border-radius: 99px; transition: width .3s ease; }
.course-outline-list { display: flex; flex-direction: column; gap: 4px; }
.course-outline-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.course-outline-item.is-read { border-color: var(--accent-line); }
.course-outline-num { width: 28px; height: 28px; border-radius: 50%; background: var(--border); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.is-read .course-outline-num { background: var(--accent); color: #fff; }
.course-outline-text { flex: 1; min-width: 0; }
.course-outline-title { font-size: 14px; font-weight: 500; color: var(--text); display: block; }
.course-outline-cat   { font-size: 12px; color: var(--muted); }
.learn-nav-link { display: flex; align-items: center; gap: 9px; padding: 7px 10px; margin: 1px 4px; border-radius: 5px; font-size: 13.5px; color: rgba(255,255,255,.70); text-decoration: none; font-weight: 400; transition: background .12s, color .12s; }
.learn-nav-link:hover { background: rgba(0,0,0,.18); color: #fff; text-decoration: none; }
.learn-nav-link.active { background: var(--accent); color: #fff; font-weight: 500; }
.learn-nav-link.is-read:not(.active) { color: rgba(255,255,255,.5); }
.learn-nav-num { width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.12); color: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.learn-nav-num.done { background: var(--accent); color: #fff; }
.active .learn-nav-num { background: rgba(255,255,255,.25); color: #fff; }
.learn-nav-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learn-topnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.learn-read-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #059669; background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); padding: 4px 10px; border-radius: 20px; margin-bottom: 24px; }
