:root {
  --dnd-accent: #8b1e1e;
  --dnd-bg: #f4f1ea;
}

body {
  background-color: var(--dnd-bg);
}

.app-header {
  background-color: #2a1f1a;
  border-bottom: 3px solid var(--dnd-accent);
}

.app-header .navbar-brand,
.app-header .nav-link {
  color: #f4f1ea;
}

.app-header .nav-link.active {
  color: #ffd88a;
  font-weight: 600;
}

.campaign-selector {
  max-width: 320px;
  min-width: 180px;
  background-color: #3b2a22;
  color: #f4f1ea;
  border-color: #5a3f31;
}

.campaign-selector:focus {
  background-color: #3b2a22;
  color: #f4f1ea;
}

.module-tile {
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
  border-top: 3px solid transparent;
}

.module-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
  border-top-color: var(--dnd-accent);
}

.module-icon {
  font-size: 1.8rem;
  color: var(--dnd-accent);
  line-height: 1;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2a1f1a 0%, #4a2c2c 100%);
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.season-indicator {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.02em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(var(--days-per-week, 7), minmax(0, 1fr));
  gap: 4px;
  background-color: #e9ecef;
  padding: 4px;
  border-radius: 6px;
}

.calendar-weekday-header {
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 4px;
  color: #555;
  background-color: #fff;
  border-radius: 4px;
}

.calendar-cell {
  position: relative;
  min-height: 100px;
  padding: 6px 6px 6px 10px;
  background-color: #fff;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    box-shadow 0.12s ease,
    transform 0.12s ease;
}

.calendar-cell-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  min-height: 1.2em;
}

.calendar-cell-body {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 2px;
  overflow: hidden;
}

.calendar-cell-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4px;
  margin-top: 4px;
  min-height: 10px;
}

.calendar-cell-footer-left,
.calendar-cell-footer-right {
  display: flex;
  gap: 2px;
  align-items: center;
  min-height: 10px;
}

.calendar-notes-indicator {
  font-size: 0.75rem;
  color: #6c757d;
}

.calendar-notes-indicator.has-notes {
  color: var(--dnd-accent);
}

.calendar-cell:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
  color: inherit;
  text-decoration: none;
}

.calendar-cell.empty {
  min-height: 0;
  background-color: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.calendar-cell.today {
  background-color: #fff8e7;
  box-shadow: inset 0 0 0 2px var(--dnd-accent);
}

.calendar-cell.today .calendar-day-number::after {
  content: " · heute";
  color: var(--dnd-accent);
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}

.calendar-season-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.calendar-day-number {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
}

.calendar-holidays {
  font-size: 0.7rem;
  color: #8b1e1e;
  line-height: 1.15;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-birthdays {
  font-size: 0.7rem;
  color: #a67017;
  line-height: 1.15;
  margin-top: 2px;
  overflow: hidden;
}

.calendar-birthday {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-birthday .bi {
  font-size: 0.78em;
  vertical-align: -0.05em;
}

.calendar-birthday-more {
  color: #6c757d;
  font-style: italic;
  white-space: nowrap;
}

.calendar-moons {
  display: flex;
  gap: 2px;
  align-items: center;
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 1px;
}

.calendar-stars {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
}

.calendar-star-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.season-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  vertical-align: middle;
}

.season-swatch-sm {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}

.moon-svg-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
}

.calendar-moon {
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1;
  margin-right: 3px;
}

.calendar-moon-lg {
  font-size: 2rem;
}

/* ===== NPC Race-Picker ===== */

.race-picker {
  z-index: 10;
}

.race-dropdown {
  z-index: 1050;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.race-option {
  cursor: pointer;
}

.race-option:hover,
.race-option.active {
  background-color: #f0e9de;
}

.race-option.active {
  font-weight: 600;
}

/* ===== Codex ===== */
.codex-article {
  line-height: 1.65;
}

.codex-article h1 {
  font-size: 1.6rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.codex-article h2 {
  font-size: 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e9ecef;
}
.codex-article h3 {
  font-size: 1.15rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.codex-article h4 {
  font-size: 1.05rem;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
.codex-article h5,
.codex-article h6 {
  font-size: 1rem;
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
}

.codex-article h1:first-child,
.codex-article h2:first-child,
.codex-article h3:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.codex-article p {
  margin-bottom: 0.9rem;
}
.codex-article ul,
.codex-article ol {
  margin-bottom: 0.9rem;
}
.codex-article code {
  background-color: #f1ede5;
  color: #7a2828;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}
.codex-article pre {
  background-color: #2a1f1a;
  color: #f4f1ea;
  padding: 0.9rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
}
.codex-article pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
}
.codex-article blockquote {
  border-left: 4px solid var(--dnd-accent);
  padding-left: 1rem;
  color: #6c757d;
  margin: 1rem 0;
}
.codex-article table {
  margin-bottom: 1rem;
}
.codex-article a {
  color: var(--dnd-accent);
}

.codex-page-list a:hover {
  background-color: #f4f1ea;
  border-radius: 4px;
  padding-left: 4px;
  padding-right: 4px;
  margin-left: -4px;
  margin-right: -4px;
}

/* TOC als Inlay oben rechts im Artikel */
.codex-article-body {
  display: flow-root; /* enthält den Float, verhindert Durchlaufen */
}

.codex-toc-inline {
  float: right;
  max-width: 280px;
  width: 100%;
  margin: 0 0 1rem 1.5rem;
}

.codex-toc-inline-inner {
  background-color: #faf8f3;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 0.75rem 1rem;
}

.codex-toc-inline-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.codex-toc-inline ul li {
  font-size: 0.875rem;
  line-height: 1.35;
  margin-bottom: 0.15rem;
}

.codex-toc-inline a {
  color: var(--dnd-accent);
  text-decoration: none;
}

.codex-toc-inline a:hover {
  text-decoration: underline;
}

/* ===== Chip-Picker ===== */

.chip-picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #fff;
  min-height: 38px;
  align-items: center;
  cursor: text;
}

.chip-picker:focus-within {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.chip-picker-chips {
  display: contents;
}

.chip-picker-input {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  padding: 2px 4px;
  background: transparent;
  font-size: 0.9rem;
}

.chip-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 8px;
  background: #e7f1ff;
  border: 1px solid #b6d4fe;
  border-radius: 12px;
  font-size: 0.85rem;
  color: #084298;
  line-height: 1.2;
  max-width: 100%;
}

.chip-picker-chip-deleted {
  background: #f8f9fa;
  border-color: #dee2e6;
  color: #6c757d;
}

.chip-picker-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-picker-chip-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 1em;
  line-height: 1;
  opacity: 0.7;
}

.chip-picker-chip-remove:hover {
  opacity: 1;
}

.chip-picker-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
}

.chip-picker-option {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.chip-picker-option:hover,
.chip-picker-option.highlighted {
  background: #e7f1ff;
}

.chip-picker-empty {
  padding: 6px 12px;
  color: #6c757d;
  font-size: 0.85rem;
  font-style: italic;
}

/* ===== NPC-Stammbaum ===== */

.npc-tree-wrapper {
  position: relative;
  padding: 30px 20px;
  background: #faf8f3;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  overflow-x: auto;
  min-height: 200px;
}

.npc-tree-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.npc-tree-nodes {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
  z-index: 1;
  min-width: max-content;
  padding: 0 20px;
}

.npc-tree-row {
  display: flex;
  gap: 30px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}

.npc-tree-group {
  display: flex;
  gap: 15px;
}

.npc-tree-node {
  background: #fff;
  border: 2px solid #ced4da;
  border-radius: 6px;
  padding: 8px 14px;
  min-width: 140px;
  max-width: 200px;
  text-align: center;
  font-size: 0.875rem;
  position: relative;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.npc-tree-node-male   { border-left: 4px solid #4a90e2; }
.npc-tree-node-female { border-left: 4px solid #d9534f; }
.npc-tree-node-other-gender { border-left: 4px solid #6c757d; }

.npc-tree-node-focus {
  border-color: #8b1e1e;
  border-width: 3px;
  background: #fff8e7;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(139, 30, 30, 0.2);
}

.npc-tree-node-other {
  opacity: 0.55;
  border-style: dashed;
  cursor: not-allowed !important;
}

.npc-tree-node-dead {
  text-decoration: line-through;
  color: #6c757d;
}

.npc-tree-node-unborn {
  font-style: italic;
  color: #6c757d;
}

.npc-tree-node:not(.npc-tree-node-focus):not(.npc-tree-node-other) {
  cursor: pointer;
}

.npc-tree-node:not(.npc-tree-node-focus):not(.npc-tree-node-other):hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
  border-color: #8b1e1e;
}

/* ===== Markdown-Editor ===== */
.markdown-editor {
  position: relative;
}

.markdown-editor-toolbar .btn {
  color: #555;
}

.markdown-editor-toolbar .btn:hover {
  color: var(--dnd-accent);
}

.markdown-editor-preview {
  min-height: 100px;
}

.markdown-editor-autocomplete {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: max-content;
  min-width: 200px;
}

.markdown-editor-input.markdown-editor-drop-active {
  border-color: #86b7fe;
  background-color: #f0f8ff;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== Bilder / Media ===== */

.codex-img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0.75rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.image-upload-picker .image-upload-preview {
  /* Container-Styles sind inline, weil die Größe 96px beträgt */
}

.image-upload-picker .image-upload-preview-img {
  transition: opacity 0.15s ease;
}

@media (min-width: 768px) {
  .markdown-editor-wrapper {
    display: flex;
    gap: 15px;
  }
  .markdown-editor-wrapper > * {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 576px) {
  .npc-tree-node {
    min-width: 110px;
    font-size: 0.8rem;
    padding: 6px 10px;
  }
  .npc-tree-row {
    gap: 15px;
  }
  .npc-tree-nodes {
    gap: 35px;
  }
}

/* Auf Mobil keine Float-Spalte — TOC volle Breite oben */
@media (max-width: 768px) {
  .codex-toc-inline {
    float: none;
    max-width: none;
    margin: 0 0 1rem 0;
  }
}

@media (max-width: 576px) {
  .calendar-cell {
    min-height: 82px;
    padding: 4px 4px 4px 8px;
  }
  .calendar-moon {
    font-size: 0.72rem;
  }
  .calendar-cell.today .calendar-day-number::after {
    content: none;
  }
  .calendar-day-number {
    font-size: 0.9rem;
  }
  .calendar-holidays {
    font-size: 0.62rem;
  }
  .calendar-birthdays {
    font-size: 0.62rem;
  }
}
