:root {
  --bg0: #050607;
  --bg1: #07090b;
  --panel: #0c1012;
  --panel2: #0a0e10;
  --border: rgba(255, 255, 255, 0.09);
  --text: rgba(230, 240, 235, 0.92);
  --muted: rgba(230, 240, 235, 0.70);
  --neon: #2cff74;
  --neon2: #00ff9a;
  --neon3: #00d4ff;
  --danger: #ff4d6d;

  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);

  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(51, 255, 102, .12), transparent 60%),
    radial-gradient(1100px 650px at 85% 0%, rgba(0, 255, 154, .10), transparent 62%),
    radial-gradient(900px 600px at 50% 120%, rgba(140, 80, 255, .06), transparent 55%),
    linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 35%, var(--bg0) 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

.wrap {
  width: min(1200px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0;
}

a {
  color: var(--neon2);
}

a:hover {
  color: var(--neon);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 8, 9, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 210px;
}

.brand-link {
  font-weight: 900;
  letter-spacing: .2px;
  text-decoration: none;
  color: var(--neon);
  font-size: 20px;
}

.brand-tag {
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: var(--text);
  opacity: .9;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.nav a:hover {
  opacity: 1;
  border-color: rgba(0, 255, 154, 0.22);
  background: rgba(0, 255, 154, 0.06);
}

.nav .nav-accent {
  border-color: rgba(0, 255, 154, 0.18);
  background: rgba(0, 255, 154, 0.05);
}

.userbox {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-meta {
  text-align: right;
  line-height: 1.1;
}

.user-name {
  font-weight: 800;
}

.user-roles {
  font-size: 12px;
  color: var(--muted);
}

.panel {
  background: rgba(12, 16, 18, 0.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 10px 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
  color: var(--neon2);
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.kbd {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 12px;
}

.hr {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 14px 0;
}

.btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 255, 154, 0.25);
  background: rgba(0, 255, 154, 0.08);
  color: var(--neon);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.btn:hover {
  background: rgba(0, 255, 154, 0.12);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-outline:hover {
  border-color: rgba(0, 255, 154, 0.25);
  background: rgba(0, 255, 154, 0.06);
}

.btn-danger {
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.35);
  color: #ffd1d9;
}
/* Suche – Neon-Zielfernrohr */
.search-btn {
  padding: 6px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon {
  width: 16px;
  height: 16px;
  border: 2px solid var(--neon2);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 6px var(--neon2);
}

.search-icon::before,
.search-icon::after {
  content: "";
  position: absolute;
  background: var(--neon2);
  box-shadow: 0 0 6px var(--neon2);
}

.search-icon::before {
  width: 2px;
  height: 10px;
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
}

.search-icon::after {
  height: 2px;
  width: 10px;
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
}

/* Hover: etwas mehr Glow */
.search-btn:hover .search-icon {
  box-shadow: 0 0 10px var(--neon2);
}


label {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 15px;
}

select option {
  background: #cccccc;
  /* Gray background */
  color: #000000;
  /* Black text */
  padding: 12px;
}

/* Specific fix for browser defaults in dropdowns */
select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Wiki Article Styling (WYSIWYG / Content) */
.wikiArticle {
  line-height: 1.6;
  font-size: 16px;
  /* pre-line collapses multiple spaces but keeps newlines */
  white-space: pre-line;
  word-wrap: break-word;
}

.wikiArticle p {
  margin: 0.8em 0;
  white-space: normal;
  /* No pre-processing inside p if explicitly tagged */
}

.wikiArticle ul,
.wikiArticle ol {
  margin: 10px 0;
  padding-left: 25px;
  white-space: normal;
  /* Crucial: Ignore newlines between <li> tags */
}

.wikiArticle li {
  margin-bottom: 2px;
}

.wikiArticle h1,
.wikiArticle h2,
.wikiArticle h3,
.wikiArticle h4,
.wikiArticle h5,
.wikiArticle h6 {
  margin: 1.25em 0 0.6em 0;
  padding-bottom: 4px;
  white-space: normal;
}

.wikiArticle h2,
.wikiArticle h3 {
  color: var(--neon2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wikiArticle img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 15px 0;
  border: 1px solid var(--border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.wikiArticle iframe {
  max-width: 100%;
  border-radius: 12px;
}


textarea {
  min-height: 250px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--neon2);
  box-shadow: 0 0 10px rgba(0, 255, 154, 0.15);
}

/* Video & Media */
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  /* 16:9 */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid var(--border);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 10px 0;
  transition: all .2s;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--neon2);
  background: rgba(0, 255, 154, 0.05);
}

.upload-zone .small {
  display: block;
  margin-top: 5px;
}


.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
}

.table th,
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.notice {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 255, 154, 0.18);
  background: rgba(0, 255, 154, 0.06);
}

.error {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 77, 109, 0.35);
  background: rgba(255, 77, 109, 0.10);
  color: #ffd1d9;
}

/* Home grid */
.grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* --- Wiki Layout --- */
.wikiLayout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1000px) {
  .wikiLayout {
    grid-template-columns: 1fr;
  }

  /* Mobile Fix: Sidebar darf nicht sticky über dem Artikel liegen */
  .wikiSide {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
  }
}
.wikiSide {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.wikiMain {
  min-width: 0;
}

.wikTree {
  list-style: none;
  padding-left: 10px;
  margin: 8px 0;
}

.wikTreeItem {
  margin: 4px 0;
}

.wikTreeRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tocToggle,
.tocSpacer {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tocToggle {
  border: 1px solid rgba(0, 255, 154, 0.28);
  background: rgba(0, 255, 154, 0.06);
  color: var(--neon2);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 8px rgba(0, 255, 154, 0.12);
}

.tocToggle:hover {
  background: rgba(0, 255, 154, 0.10);
  box-shadow: 0 0 10px rgba(0, 255, 154, 0.18);
}

/* Eingeklappte Knoten: Children ausblenden */
.wikTreeItem.collapsed > ul {
  display: none;
}


.wikTreeItem a {
  display: block;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.wikTreeItem.active>a {
  background: rgba(0, 255, 140, 0.10);
  border: 1px solid rgba(0, 255, 140, 0.22);
}

.wikToc {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.wikToc li {
  margin: 4px 0;
}

.wikToc li a {
  color: var(--text);
  text-decoration: none;
  opacity: .92;
}

.wikToc li a:hover {
  opacity: 1;
}

.wikToc .lvl3 {
  padding-left: 10px;
}

.wikToc .lvl4 {
  padding-left: 20px;
}

.wikToc .lvl5 {
  padding-left: 30px;
}

.wikToc .lvl6 {
  padding-left: 40px;
}

.wikiHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.wikiActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.breadcrumbs a:hover {
  color: var(--neon2);
  border-color: rgba(0, 255, 154, 0.18);
  background: rgba(0, 255, 154, 0.06);
}

.breadcrumbs .bc-sep {
  opacity: .55;
}

.breadcrumbs .bc-current {
  color: #ff5c5c; /* Rot wie Löschbutton */
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 92, 92, 0.45);
  background: rgba(255, 92, 92, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 92, 92, 0.25),
    0 0 12px rgba(255, 92, 92, 0.15);
}
.breadcrumbs .bc-current:hover {
  color: #ff5c5c;
}

.wikiArticle img.wikImg {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin: 10px 0;
}

.wikiEditor {
  min-height: 360px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  white-space: pre-wrap;
  line-height: 1.55;
}

/* helper grid */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 900px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

.footer {
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(6, 8, 9, 0.55);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  flex-wrap: wrap;
}

/* Timeline Horizontal */
.timeline-wrap {
  padding: 105px 60px 10px 60px;
  overflow-x: auto;
  min-height: 100px;
  position: relative;
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--neon2) rgba(255, 255, 255, 0.05);
}

.timeline-wrap::-webkit-scrollbar {
  height: 6px;
}

.timeline-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.timeline-wrap::-webkit-scrollbar-thumb {
  background: var(--neon2);
  border-radius: 10px;
  box-shadow: 0 0 10px var(--neon2);
}

.timeline-track {
  position: relative;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  margin-top: 10px;
  /* width is controlled by PHP */
}

.timeline-item {
  position: absolute;
  top: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg0);
  border: 2px solid var(--neon2);
  cursor: pointer;
  z-index: 10;
  transition: transform .2s, border-color .2s;
  transform: translateX(-50%);
}

/* Overlap-Handling: wenn Punkte sehr nah beieinander liegen */
.timeline-item.overlap-back {
  z-index: 9; /* hinter den normalen Punkten */
}

.timeline-item.overlap-big {
  width: 20px;      /* +2px */
  height: 20px;     /* +2px */
  top: -9px;        /* minimal angepasst, damit er sauber auf der Linie sitzt */
  border-width: 2px;
}


.timeline-item:hover {
  transform: translateX(-50%) scale(1.3);
  background: var(--neon2);
  box-shadow: 0 0 10px var(--neon2);
}
/* Timeline: markierte (rot) Events */
.timeline-item-danger {
  border-color: var(--danger);
}

.timeline-item-danger:hover {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

.timeline-item-danger .tooltip {
  border-color: var(--danger);
}

.timeline-item-danger .tooltip::after {
  border-color: var(--danger) transparent transparent transparent;
}

.timeline-item-danger .tooltip-title {
  color: var(--danger);
}

.timeline-item .tooltip {
  position: absolute;
  bottom: 24px;
  left: 50%;
  width: max-content;
  max-width: 250px;
  transform: translateX(-50%) translateY(5px);
  background: rgba(10, 14, 16, 0.98);
  border: 1px solid var(--neon2);
  border-radius: 8px;
  padding: 8px 14px;
  text-align: center;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
}

/* Alignment overrides for tooltips near edges */
.timeline-item .tooltip.tooltip-left {
  left: 0;
  transform: translateX(-15px) translateY(5px);
  text-align: left;
}

.timeline-item:hover .tooltip.tooltip-left {
  transform: translateX(-15px) translateY(0);
}

.timeline-item .tooltip.tooltip-left::after {
  left: 20px;
  margin-left: 0;
}

.timeline-item .tooltip.tooltip-right {
  left: auto;
  right: 0;
  transform: translateX(15px) translateY(5px);
  text-align: right;
}

.timeline-item:hover .tooltip.tooltip-right {
  transform: translateX(15px) translateY(0);
}

.timeline-item .tooltip.tooltip-right::after {
  left: auto;
  right: 20px;
  margin-left: 0;
}

.timeline-item:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.timeline-item .tooltip-title {
  font-weight: bold;
  color: var(--neon2);
  margin-bottom: 2px;
}

.timeline-item .tooltip-date {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

/* Arrow for tooltip */
.timeline-item .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--neon2) transparent transparent transparent;
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}

.editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.editor-btn:hover {
  background: rgba(0, 255, 154, 0.1);
  border-color: var(--neon2);
  color: var(--neon2);
}

.editor-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 4px 4px;
}

.wiki-editor-textarea {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}