/* =========================================
   COMPONENTS.CSS
   Buttons, Boxen, Thread-Cards, Form-Controls
   ========================================= */

/* ---------- Grundboxen ---------- */
.box {
  background: var(--np-soft);
  border: 1px solid var(--np-border);
  border-radius: var(--np-radius);
  padding: var(--np-pad);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* Abstand zwischen Boxen global kleiner */
.box + .box { margin-top: 0.7rem; }

/* ---------- Thread-/Message-Listen: Marker & Abstände neutralisieren ---------- */
.thread-list,
.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Einträge neutralisieren (damit kein Einzug entsteht) */
.thread-item,
.message-list > li {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- Karten für Index/Search & Thread-Ansicht ---------- */
/* Gemeinsame Basis für beide Kartentypen */
.thread-card,
.thread-box {
  position: relative;               /* für evtl. Pseudo-Elemente */
  display: block;                   /* sichere Block-Darstellung */
  background: var(--np-card);
  border: 1px solid var(--np-border);
  border-radius: var(--np-radius);
  padding: var(--np-pad);           /* sicheres Innenpadding */
  box-shadow: var(--np-shadow);
  transition: background .2s ease-in-out;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

/* Falls irgendwo noch linke Zierleisten (::before) gesetzt werden: deaktivieren */
.thread-card::before,
.thread-box::before {
  content: none !important;
  display: none !important;
}

.thread-card:hover,
.thread-box:hover { background: rgba(255,255,255,0.03); }

/* Titel & Link in Cards */
.thread-title {
  font-size: var(--np-fs-lg);
  font-weight: 600;
  color: var(--np-link);
  text-decoration: none;
}
.thread-title:hover { text-decoration: underline; }

/* Den Klickbereich nicht bis ganz links „kleben“ lassen */
.thread-link {
  display: inline-block;    /* kein full-width Link */
  text-decoration: none;
}

.thread-card__meta {
  font-size: var(--np-fs-sm);
  color: var(--np-text-dim);
}

/* ---------- Tags ---------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.tag {
  background: var(--np-accent);
  color: #1a1a1a;
  border-radius: var(--np-radius-sm);
  font-size: var(--np-fs-sm);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
}

/* ---------- Discord-CTA-Box ---------- */
.discord-cta {
  background: #5865F2;
  color: #fff;
  border-radius: var(--np-radius);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--np-shadow);
}
.discord-cta:hover { filter: brightness(0.95); }
.discord-cta__icon { width: 22px; height: 22px; }
.discord-cta__text { font-size: var(--np-fs-md); }

/* ---------- Buttons allgemein ---------- */
.btn {
  display: inline-block;
  padding: .45rem .85rem;
  background: var(--np-accent);
  color: #1a1a1a;
  border: 1px solid var(--np-accent);
  border-radius: var(--np-radius-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .2s ease-in-out;
}
.btn:hover { filter: brightness(0.95); }

/* ---------- Formularfelder ---------- */
input[type="text"], select {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- Links ---------- */
a {
  color: var(--np-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--np-link-hover); }

/* =========================================
   THREAD-VIEW RESPONSIVE FIXES
   ========================================= */

/* Erzwingt automatisches Umbrechen von langen Wörtern und URLs */
.thread-body,
.thread-body * {
  overflow-wrap: break-word;      /* moderner Standard */
  word-wrap: break-word;          /* älterer Fallback */
  word-break: break-word;         /* bricht auch lange URLs */
}

/* Falls ein Inline-Code- oder Pre-Block vorhanden ist */
.thread-body pre,
.thread-body code {
  white-space: pre-wrap;          /* bricht Zeilen in <pre> um */
  word-wrap: break-word;
}

/* Sicherheitshalber global: kein horizontales Scrollen */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* ===============================
   Pagination (global)
   =============================== */
.pagination {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.page-link,
.page-status,
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-surface);
  color: var(--c-text);
  text-decoration: none;
  line-height: 1;
}

.page-link:hover { background: var(--c-surface-2); }
.page-link.is-disabled { opacity: 0.5; pointer-events: none; }

.page-link.is-active {
  border-color: var(--c-accent, #5aa7ff);
  background: var(--c-accent, #5aa7ff);
  color: var(--c-on-accent, #0b0b0b);
  pointer-events: none;
}

.page-ellipsis {
  border: none;
  background: transparent;
  padding: 0 0.25rem;
}

/* Distanzen-Klassen für Mobile-Filterung (werden serverseitig vergeben) */
.page-link.is-number.is-edge { /* erste/letzte Seite */ }
.page-link.is-number.is-near { /* Nachbarseiten */ }
.page-link.is-number.is-mid  { /* +-2 Seiten */ }
.page-link.is-number.is-far  { /* weiter entfernte Seiten */ }

/* Mobile: reduziere die Sichtbarkeit entfernter Seitenlinks */
@media (max-width: 420px) {
  .pagination .page-link.is-number.is-far,
  .pagination .page-link.is-number.is-mid {
    display: none;
  }
  .pagination { gap: 0.4rem; }
  .page-link, .page-ellipsis {
    min-width: 2rem;
    padding: 0.4rem 0.55rem;
    border-radius: 7px;
  }
}

/* Thread card tags line: typografisch an die Meta-Zeile angleichen */
.thread-card__tagsline {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font: inherit;          /* gleiche Schrift wie Zeile darüber */
  color: inherit;         /* gleiche Farbe wie Zeile darüber */
}

/* Tag-Badges: Links ohne Unterstreichung + konsistente Farbe */
.tag-badge {
  display: inline-flex;          /* bessere Vertikal-Ausrichtung */
  align-items: center;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2, rgba(255,255,255,0.04));
  border-radius: 999px;
  line-height: 1.1;
  font-size: 0.95em;
  color: var(--c-text);
  white-space: nowrap;
  text-decoration: none !important; /* <a> ohne Unterstreichung */
}

.tag-badge:hover,
.tag-badge:focus,
.tag-badge:active,
.tag-badge:visited {
  color: var(--c-text);
  text-decoration: none !important;
}

/* Optional: dezenter Hover, ohne Text-Deko */
.tag-badge:hover {
  background: var(--c-surface-3, rgba(255,255,255,0.07));
  border-color: var(--c-border-strong, var(--c-border));
}

/* Optional: Tastaturfokus sichtbar halten */
.tag-badge:focus-visible {
  outline: 2px solid var(--c-accent, #5aa7ff);
  outline-offset: 2px;
  text-decoration: none !important;
}

/* --- Title: single-line with ellipsis, but allow shrinking in flex/grid --- */
.thread-card,
.thread-card__title {
  min-width: 0; /* wichtig in Flex/Grid-Layouts */
}

.thread-card__title a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* falls Meta/Tags neben dem Titel in einer Zeile stehen (Flex/Grid) */
.thread-card__meta,
.thread-card__tagsline {
  min-width: 0;
}

/* Safety: Box bleibt responsiv, nie durch Inhalt verbreitert */
.thread-card {
  width: 100%;
}
