/* ============================================================
   Chapter X — gemeinsames Theme
   Wird von login.php, regelwerk.php, regelwerk-user.php und
   dashboard.php eingebunden.
   ============================================================ */

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

:root {
    --cx-bg:#0a0814;
    --cx-primary:#171233;
    --cx-primary-light:#221b42;
    --cx-accent:#C630E8;
    --cx-accent-2:#5b6ef5;
    --cx-accent-light:#e08cf2;
    --cx-glow:rgba(198,48,232,.45);
    --cx-dim:rgba(198,48,232,.15);
    --cx-border:rgba(198,48,232,.35);
    --cx-text:#e8ebf1;
    --cx-text-light:#9da7be;
    --cx-danger:#e53935;
    --cx-success:#00c853;
}

html, body { height:100%; }

body {
    font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
    background:linear-gradient(135deg,var(--cx-bg) 0%,var(--cx-primary) 100%);
    color:var(--cx-text);
    min-height:100vh;
}

::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:linear-gradient(180deg,var(--cx-accent-2),var(--cx-accent)); border-radius:4px; }

a { color:var(--cx-accent); }

/* ── HEADER ─────────────────────────────────────────────── */
header.cx-header {
    background:rgba(21,18,45,0.97);
    border-bottom:2px solid var(--cx-accent);
    padding:0 40px;
    height:70px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    position:sticky;
    top:0;
    z-index:100;
    backdrop-filter:blur(12px);
}
.cx-logo {
    font-size:20px;
    font-weight:800;
    display:flex;
    align-items:center;
    gap:10px;
    background:linear-gradient(90deg,#e8eaf0 0%,var(--cx-accent-2) 50%,var(--cx-accent) 100%);
    -webkit-background-clip:text;
    background-clip:text;
    -webkit-text-fill-color:transparent;
}
.cx-logo span { color:var(--cx-text); font-weight:400; -webkit-text-fill-color:var(--cx-text); }
.cx-header-right { display:flex; align-items:center; gap:12px; }
.cx-badge {
    background:var(--cx-dim);
    border:1px solid var(--cx-border);
    color:var(--cx-accent-light);
    font-size:11px;
    font-weight:800;
    padding:4px 12px;
    border-radius:999px;
    letter-spacing:.5px;
}
.cx-user-pill {
    display:flex; align-items:center; gap:8px;
    font-size:13px; color:var(--cx-text-light);
}
.cx-user-pill strong { color:var(--cx-text); }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
    padding:10px 18px;
    border-radius:9px;
    border:1px solid var(--cx-accent-2);
    background:rgba(91,110,245,.08);
    color:var(--cx-text);
    font-weight:700;
    font-size:14px;
    font-family:inherit;
    cursor:pointer;
    transition:all .18s;
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    gap:6px;
}
.btn:hover { border-color:var(--cx-accent); background:var(--cx-dim); box-shadow:0 0 22px var(--cx-glow); color:#fff; }
.btn-primary { background:linear-gradient(90deg,var(--cx-accent-2),var(--cx-accent)); border:none; color:#fff; }
.btn-primary:hover { filter:brightness(1.1); box-shadow:0 0 22px var(--cx-glow); }
.btn-danger { border-color:rgba(229,57,53,.5); background:rgba(229,57,53,.08); color:#ff8a80; }
.btn-danger:hover { border-color:var(--cx-danger); background:rgba(229,57,53,.16); box-shadow:0 0 18px rgba(229,57,53,.35); color:#fff; }
.btn-sm { padding:6px 12px; font-size:12px; border-radius:7px; }
.btn-block { width:100%; justify-content:center; }

/* ── FORMS ──────────────────────────────────────────────── */
.cx-field { margin-bottom:16px; }
.cx-field label { display:block; font-size:12px; font-weight:700; color:var(--cx-text-light); text-transform:uppercase; letter-spacing:.5px; margin-bottom:7px; }
.cx-field input[type=text],
.cx-field input[type=password],
.cx-field input[type=number],
.cx-field select,
.cx-field textarea {
    width:100%;
    padding:12px 14px;
    background:rgba(10,8,20,.7);
    border:1px solid var(--cx-border);
    border-radius:10px;
    color:var(--cx-text);
    font-size:14px;
    font-family:inherit;
    outline:none;
    transition:border-color .2s, box-shadow .2s;
}
.cx-field textarea { resize:vertical; min-height:160px; line-height:1.6; }
.cx-field input:focus, .cx-field select:focus, .cx-field textarea:focus {
    border-color:var(--cx-accent);
    box-shadow:0 0 0 3px var(--cx-dim);
}
.cx-field .hint { font-size:11px; color:var(--cx-text-light); margin-top:5px; }

/* ── ALERTS ─────────────────────────────────────────────── */
.cx-alert {
    padding:12px 16px;
    border-radius:10px;
    font-size:13px;
    margin-bottom:18px;
    border:1px solid;
}
.cx-alert-error { background:rgba(229,57,53,.1); border-color:rgba(229,57,53,.4); color:#ff8a80; }
.cx-alert-success { background:rgba(0,200,83,.1); border-color:rgba(0,200,83,.4); color:#69f0ae; }

/* ── SEARCH BAR ─────────────────────────────────────────── */
.search-wrap { background:rgba(15,12,30,0.7); border-bottom:1px solid var(--cx-dim); padding:16px 40px; position:sticky; top:70px; z-index:90; backdrop-filter:blur(10px); }
.search-inner { max-width:860px; margin:0 auto; position:relative; }
.search-inner svg { position:absolute; left:14px; top:50%; transform:translateY(-50%); width:17px; height:17px; color:var(--cx-text-light); pointer-events:none; }
#searchInput { width:100%; padding:11px 14px 11px 42px; background:rgba(10,8,20,.7); border:1px solid var(--cx-border); border-radius:10px; color:var(--cx-text); font-size:14px; font-family:inherit; outline:none; transition:border-color .2s; }
#searchInput:focus { border-color:var(--cx-accent); background:rgba(10,8,20,.85); }
#searchInput::placeholder { color:var(--cx-text-light); }
.search-clear { position:absolute; right:12px; top:50%; transform:translateY(-50%); background:none; border:none; color:var(--cx-text-light); cursor:pointer; font-size:18px; display:none; line-height:1; padding:2px 6px; border-radius:6px; }
.search-clear:hover { color:var(--cx-accent); background:var(--cx-dim); }
.search-results-count { font-size:12px; color:var(--cx-text-light); margin-top:7px; height:16px; }
mark { background:rgba(198,48,232,.35); color:#fff; border-radius:3px; padding:0 2px; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.container { display:grid; grid-template-columns:minmax(180px,auto) 1fr; min-height:calc(100vh - 138px); }

.toc { position:sticky; top:138px; height:calc(100vh - 138px); overflow-y:auto; background:rgba(15,12,30,0.95); border-right:1px solid var(--cx-dim); padding:20px 0; width:100%; }
.toc-title { font-size:11px; font-weight:700; color:var(--cx-accent-light); text-transform:uppercase; letter-spacing:1px; padding:0 20px 10px; margin-bottom:4px; border-bottom:1px solid var(--cx-dim); }
.toc-item { display:block; padding:12px 20px; color:var(--cx-text-light); text-decoration:none; font-size:13px; transition:all .18s; border-left:3px solid transparent; white-space:nowrap; }
.toc-item:hover { background:var(--cx-dim); color:var(--cx-accent-light); border-left-color:var(--cx-accent); }
.toc-item.active { background:var(--cx-dim); color:var(--cx-accent-light); border-left-color:var(--cx-accent); font-weight:600; }
.toc-item.hidden { display:none; }
.toc-all { font-weight:600; }

.content-area { padding:36px 48px 80px; min-width:0; }
.page-hero { margin-bottom:28px; }
.page-hero h1 { font-size:30px; font-weight:800; color:var(--cx-accent-light); margin-bottom:6px; }
.page-hero p { color:var(--cx-text-light); font-size:14px; line-height:1.6; }
.last-updated { font-size:11px; color:var(--cx-text-light); margin-top:6px; opacity:.7; }

/* ── SECTION CARDS ──────────────────────────────────────── */
.section-card { background:linear-gradient(180deg,rgba(34,27,66,.96),rgba(20,16,40,.96)); border:1px solid var(--cx-border); border-radius:16px; padding:28px; margin-bottom:22px; scroll-margin-top:145px; transition:border-color .2s; }
.section-card:hover { border-color:rgba(198,48,232,.55); }
.section-card.no-match { display:none; }
.section-card.filter-hidden { display:none; }
.section-card-header { display:flex; align-items:flex-start; gap:14px; margin-bottom:18px; padding-bottom:14px; border-bottom:1px solid var(--cx-dim); }
.section-logo { max-height:56px; max-width:160px; object-fit:contain; flex-shrink:0; }
.section-title { font-size:20px; font-weight:800; color:var(--cx-accent-light); line-height:1.3; }
.section-num { display:inline-block; background:var(--cx-dim); border:1px solid var(--cx-border); color:var(--cx-accent-light); font-size:11px; font-weight:800; padding:4px 10px; border-radius:4px; margin-bottom:8px; letter-spacing:.3px; }

/* ── RICH CONTENT ───────────────────────────────────────── */
.rw-content { color:var(--cx-text); line-height:1.8; font-size:14px; }
.rw-content h1 { font-size:20px; color:var(--cx-accent-light); margin:18px 0 8px; padding-bottom:5px; border-bottom:1px solid var(--cx-dim); }
.rw-content h2 { font-size:17px; color:var(--cx-accent-light); margin:16px 0 7px; }
.rw-content h3 { font-size:15px; color:var(--cx-accent-2); margin:13px 0 6px; }
.rw-content h4, .rw-content h5, .rw-content h6 { color:var(--cx-accent-2); margin:11px 0 5px; }
.rw-content p { margin-bottom:11px; }
.rw-content ul, .rw-content ol { margin:7px 0 11px 22px; }
.rw-content li { margin-bottom:5px; }
.rw-content strong, .rw-content b { color:#fff; font-weight:700; }
.rw-content em, .rw-content i { color:var(--cx-text-light); font-style:italic; }
.rw-content a { color:var(--cx-accent-light); text-decoration:underline; }
.rw-content a:hover { color:var(--cx-accent); }
.rw-content blockquote { border-left:3px solid var(--cx-accent); padding:9px 14px; color:var(--cx-text-light); font-style:italic; margin:13px 0; background:var(--cx-dim); border-radius:0 8px 8px 0; }
.rw-content hr { border:none; border-top:1px solid var(--cx-dim); margin:18px 0; }
.rw-content table { border-collapse:collapse; width:100%; margin:13px 0; }
.rw-content th { background:var(--cx-dim); color:var(--cx-accent-light); font-weight:700; padding:9px 12px; border:1px solid var(--cx-border); text-align:left; }
.rw-content td { padding:9px 12px; border:1px solid rgba(198,48,232,.09); }
.rw-content tr:nth-child(even) td { background:rgba(21,18,45,.35); }
.rw-content img { max-width:100%; border-radius:8px; margin:9px 0; }
.rw-content code { background:rgba(10,8,20,.8); border:1px solid var(--cx-dim); color:var(--cx-accent-light); padding:2px 6px; border-radius:4px; font-size:12px; font-family:monospace; }
.rw-content pre { background:rgba(10,8,20,.8); border:1px solid var(--cx-dim); border-radius:8px; padding:14px; overflow-x:auto; margin:11px 0; }
.rw-content pre code { background:none; border:none; padding:0; }

/* ── EMPTY / NO RESULTS ─────────────────────────────────── */
.no-results { display:none; text-align:center; padding:60px 20px; color:var(--cx-text-light); }
.no-results .icon { font-size:48px; margin-bottom:12px; }
.no-results h3 { font-size:18px; color:var(--cx-text); margin-bottom:6px; }
.empty-state { text-align:center; padding:70px 40px; color:var(--cx-text-light); }
.empty-state .icon { font-size:56px; margin-bottom:14px; }
.empty-state h2 { font-size:20px; color:var(--cx-text); margin-bottom:8px; }

/* ── BACK TO TOP ────────────────────────────────────────── */
.back-to-top { position:fixed; bottom:28px; right:28px; background:linear-gradient(135deg,var(--cx-accent-2),var(--cx-accent)); color:#fff; border:none; border-radius:50%; width:44px; height:44px; font-size:18px; cursor:pointer; display:none; align-items:center; justify-content:center; box-shadow:0 4px 18px var(--cx-glow); z-index:200; transition:all .2s; }
.back-to-top:hover { transform:translateY(-3px); }
.back-to-top.visible { display:flex; }

/* ── LOGIN CARD ─────────────────────────────────────────── */
.cx-auth-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.cx-auth-card { width:100%; max-width:400px; background:linear-gradient(180deg,rgba(34,27,66,.96),rgba(20,16,40,.96)); border:1px solid var(--cx-border); border-top:2px solid var(--cx-accent); border-radius:18px; padding:38px 34px; box-shadow:0 0 60px rgba(198,48,232,.15); }
.cx-auth-logo { text-align:center; font-size:24px; font-weight:800; margin-bottom:6px; background:linear-gradient(90deg,#e8eaf0 0%,var(--cx-accent-2) 50%,var(--cx-accent) 100%); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.cx-auth-sub { text-align:center; color:var(--cx-text-light); font-size:13px; margin-bottom:28px; }
.cx-auth-footer { text-align:center; margin-top:20px; font-size:12px; color:var(--cx-text-light); }
.cx-auth-footer a { color:var(--cx-accent-light); text-decoration:none; }
.cx-auth-footer a:hover { text-decoration:underline; }

/* ── TABS (Dashboard) ───────────────────────────────────── */
.cx-tabs { display:flex; gap:6px; border-bottom:1px solid var(--cx-dim); margin-bottom:28px; }
.cx-tab { padding:12px 22px; background:none; border:none; border-bottom:2px solid transparent; color:var(--cx-text-light); font-family:inherit; font-size:14px; font-weight:700; cursor:pointer; transition:all .18s; text-decoration:none; display:inline-block; }
.cx-tab:hover { color:var(--cx-accent-light); }
.cx-tab.active { color:var(--cx-accent-light); border-bottom-color:var(--cx-accent); }

/* ── ADMIN LIST / EDITOR ────────────────────────────────── */
.admin-toolbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; gap:12px; flex-wrap:wrap; }
.admin-list-item { background:linear-gradient(180deg,rgba(34,27,66,.9),rgba(20,16,40,.9)); border:1px solid var(--cx-dim); border-radius:12px; padding:16px 20px; margin-bottom:12px; display:flex; align-items:center; justify-content:space-between; gap:14px; transition:border-color .18s; }
.admin-list-item:hover { border-color:var(--cx-border); }
.admin-list-item.filter-hidden { display:none; }
.admin-list-item .meta { min-width:0; display:flex; align-items:center; gap:12px; }
.admin-list-item .para-badge { flex-shrink:0; background:var(--cx-dim); border:1px solid var(--cx-border); color:var(--cx-accent-light); font-size:11px; font-weight:800; padding:4px 9px; border-radius:6px; }
.admin-list-item .meta .t { font-weight:700; color:var(--cx-text); }
.admin-list-item .meta .s { font-size:12px; color:var(--cx-text-light); margin-top:3px; }
.admin-list-item .actions { display:flex; gap:8px; flex-shrink:0; }
.editor-box { background:linear-gradient(180deg,rgba(34,27,66,.96),rgba(20,16,40,.96)); border:1px solid var(--cx-border); border-top:2px solid var(--cx-accent); border-radius:16px; padding:28px; margin-bottom:28px; }
.editor-box h2 { font-size:18px; color:var(--cx-accent-light); margin-bottom:20px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

/* ── DASHBOARD: STAT- & FEATURE-KÄSTCHEN ────────────────────── */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:32px; }
.stat-card { background:linear-gradient(180deg,rgba(34,27,66,.9),rgba(20,16,40,.9)); border:1px solid var(--cx-dim); border-radius:14px; padding:20px 22px; }
.stat-card .stat-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--cx-text-light); margin-bottom:8px; }
.stat-card .stat-value { font-size:26px; font-weight:800; background:linear-gradient(90deg,#e8eaf0 0%,var(--cx-accent-2) 50%,var(--cx-accent) 100%); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; line-height:1.2; }
.stat-card .stat-sub { font-size:12px; color:var(--cx-text-light); margin-top:6px; }

.feature-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:20px; margin-bottom:12px; }
.feature-card { position:relative; display:block; text-decoration:none; color:var(--cx-text); background:linear-gradient(180deg,rgba(34,27,66,.96),rgba(20,16,40,.96)); border:1px solid var(--cx-border); border-top:2px solid var(--cx-accent); border-radius:18px; padding:26px 26px 24px; transition:all .2s; overflow:hidden; }
.feature-card:hover { border-color:var(--cx-accent); box-shadow:0 0 40px rgba(198,48,232,.22); transform:translateY(-2px); }
.feature-card .feature-icon { font-size:30px; margin-bottom:14px; display:inline-block; }
.feature-card h3 { font-size:19px; font-weight:800; color:var(--cx-text); margin-bottom:8px; }
.feature-card p { font-size:13px; color:var(--cx-text-light); line-height:1.6; margin-bottom:16px; }
.feature-card .feature-meta { display:flex; gap:16px; flex-wrap:wrap; font-size:12px; color:var(--cx-text-light); border-top:1px solid var(--cx-dim); padding-top:14px; }
.feature-card .feature-meta b { color:var(--cx-accent-light); font-weight:700; }
.feature-card .feature-go { position:absolute; top:24px; right:24px; color:var(--cx-accent-light); font-size:18px; opacity:.6; transition:all .2s; }
.feature-card:hover .feature-go { opacity:1; transform:translateX(3px); }
.feature-card.is-placeholder { opacity:.75; }
.feature-card .feature-tag { position:absolute; top:20px; right:20px; background:var(--cx-dim); border:1px solid var(--cx-border); color:var(--cx-accent-light); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; padding:3px 9px; border-radius:999px; }

.cx-breadcrumb { display:flex; align-items:center; gap:8px; margin-bottom:18px; font-size:13px; }
.cx-breadcrumb a { color:var(--cx-text-light); text-decoration:none; }
.cx-breadcrumb a:hover { color:var(--cx-accent-light); }
.cx-breadcrumb span { color:var(--cx-text-light); opacity:.5; }
.cx-breadcrumb strong { color:var(--cx-accent-light); }

.admin-search-wrap { position:relative; max-width:360px; width:100%; }
.admin-search-wrap svg { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:15px; height:15px; color:var(--cx-text-light); pointer-events:none; z-index:1; }
.admin-search-wrap input {
    width:100%;
    padding:11px 14px 11px 38px;
    background:rgba(10,8,20,.7);
    border:1px solid var(--cx-border);
    border-radius:10px;
    color:var(--cx-text);
    font-size:14px;
    font-family:inherit;
    outline:none;
    transition:border-color .2s, box-shadow .2s;
}
.admin-search-wrap input::placeholder { color:var(--cx-text-light); }
.admin-search-wrap input:focus { border-color:var(--cx-accent); box-shadow:0 0 0 3px var(--cx-dim); }

.author-badge {
    display:inline-flex;
    align-items:center;
    gap:5px;
    font-size:11px;
    font-weight:700;
    color:var(--cx-accent-light);
    background:var(--cx-dim);
    border:1px solid var(--cx-border);
    padding:3px 9px;
    border-radius:999px;
    white-space:nowrap;
}

.placeholder-block { text-align:center; padding:90px 40px; color:var(--cx-text-light); background:linear-gradient(180deg,rgba(34,27,66,.7),rgba(20,16,40,.7)); border:1px dashed var(--cx-border); border-radius:18px; }
.placeholder-block .icon { font-size:50px; margin-bottom:16px; opacity:.8; }
.placeholder-block h2 { font-size:20px; color:var(--cx-text); margin-bottom:8px; }

/* ── PERMISSION CHECKBOXES ──────────────────────────────── */
.perm-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:10px; }
.perm-item {
    display:flex; align-items:center; gap:9px;
    background:rgba(10,8,20,.6);
    border:1px solid var(--cx-dim);
    border-radius:10px;
    padding:11px 14px;
    cursor:pointer;
    transition:border-color .15s, background .15s;
    font-size:13px;
}
.perm-item:hover { border-color:var(--cx-border); }
.perm-item input[type=checkbox] { width:16px; height:16px; accent-color:var(--cx-accent); flex-shrink:0; cursor:pointer; }
.perm-item:has(input:checked) { border-color:var(--cx-accent); background:var(--cx-dim); }

@media print {
    header, .search-wrap, .toc, .back-to-top, .cx-tabs { display:none !important; }
    .container { grid-template-columns:1fr; }
    .content-area { padding:0; }
    .section-card { break-inside:avoid; border:1px solid #ccc; }
}

/* ── MOBILE ─────────────────────────────────────────────── */
@media (max-width:768px) {
    .container { grid-template-columns:1fr; }
    .toc { display:none; }
    header.cx-header { padding:0 16px; }
    .search-wrap { padding:12px 16px; top:70px; }
    .content-area { padding:16px 14px 60px; }
    .section-card { padding:18px; }
    .page-hero h1 { font-size:22px; }
    .form-row { grid-template-columns:1fr; }
    .admin-list-item { flex-direction:column; align-items:flex-start; }
}
