/* ==========================================================================
   wissen.css — Section-Layout-SSOT fuer den Wissen-Tab.
   Konsument: web/js/sections/wissen.js (+ wissen-gast.js) · Prefix: wissen-
   Detail-/Bearbeiten-Aktionen laufen ueber LoDWnDrawer (components/drawers/wn-drawer.css).
   ========================================================================== */

/* ── Tab-Container Override (wie Anfragen/Projekte) ── */
#tab-content-wissen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
#tab-content-wissen.hidden { display: none; }

/* Listenansicht braucht Flex-Column damit der Inhalt die volle Höhe füllt */
#wissen-list-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Basis-Layout (display:flex/flex:1/min-height:0/height:100%) + .lod-section-panel
   liegen in layout.css. Hier nur Toolbar-Border + Wissen-spezifische
   Compound-Regeln (Master-Detail-Flex, Dashboard-Scroll-Host). */
#tab-content-wissen > .app-scope > .app-kanban-toolbar {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

/* .dash-scroll-host-Basis (Flex-Spalte + Kind-Mount + Mobile-Scroll) lebt
   zentral in domain/dashboard/dashboard.css — hier kein Duplikat mehr. */

/* Microsoft-Modus (Option C): Filter / Sort / Counter / Primary ausblenden
   — nur Ansicht-Switcher + Suche bleiben sichtbar. Die Toggle-Klasse wird
   vom JS (_wissenApplyMicrosoftModeVisibility) am Toolbar-Host gesetzt. */
.app-scope .app-toolbar.wissen-toolbar-microsoft [data-toolbar-action="open-filter"],
.app-scope .app-toolbar.wissen-toolbar-microsoft [data-toolbar-action="open-sort"],
.app-scope .app-toolbar.wissen-toolbar-microsoft [data-toolbar-action="new-task"],
.app-scope .app-toolbar.wissen-toolbar-microsoft .app-counter-block {
  display: none !important;
}
/* Dashboard-Modus: NUR Source-Switcher (Dynamics 365 / Microsoft) ausblenden.
   Filter + Sort + Counter + Primary bleiben sichtbar — Filter wirken jetzt
   auch aufs Dashboard. Toggle-Klasse wird in switchWissenView gesetzt. */
.app-scope .app-toolbar.wissen-toolbar-dash .wissen-source-switcher {
  display: none !important;
}

/* Paket NAV-2.4 Polish 2026-05-01: Source-Switcher auf Mobile <600px
   komplett ausblenden — auf engem Viewport gibts nur noch die D365-
   Wissensartikel. JS forciert beim Mobile-Init zusaetzlich
   activeSource='intern', falls URL-Snapshot was anderes hatte. */
@media (max-width: 599px) {
  .app-scope .wissen-source-switcher,
  .lod-section-mobile-toolbar .wissen-source-switcher {
    display: none !important;
  }
}

/* ── Grid (Ergebnisliste) — Multi-Column wie Kontingente/Projekte ── */
.wissen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  gap: var(--space-3);
}

/* ── Empty State ─────────────────────────────────────────── */
.wissen-empty {
  padding: var(--space-10) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--fs-body);
}

/* ── Badges (Status + Externe) ────────────────────────────── */
.wissen-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-xxs) var(--space-2);
  font-size: var(--fs-badge);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-circular);
  white-space: nowrap;
}
.wissen-badge--entwurf {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.wissen-badge--review {
  background: var(--status-warning-bg);
  color: var(--status-warning-fg);
}
.wissen-badge--genehmigt {
  background: var(--status-success-bg);
  color: var(--status-success-fg);
}
.wissen-badge--veroeffentlicht {
  background: var(--brand-light);
  color: var(--brand-default);
}
.wissen-badge--archiviert {
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.wissen-badge--abgelehnt {
  background: var(--status-danger-bg);
  color: var(--status-danger-fg);
}
.wissen-badge--extern {
  background: color-mix(in srgb, var(--ms-docs-purple) 12%, white);
  color: var(--ms-docs-purple);
}

/* ── Mehr-Laden Button ── */
.wissen-load-more {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: var(--space-3);
}
.wissen-load-more-btn {
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--brand-default);
  background: var(--brand-light);
  border: 1px solid color-mix(in srgb, var(--brand-default) 20%, transparent);
  border-radius: var(--radius-circular);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.wissen-load-more-btn:hover {
  background: var(--brand-default);
  color: var(--brand-text-on);
}

/* ── Trenner zwischen intern/extern in "Alle"-Modus ── */
.wissen-extern-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0 var(--space-1);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
}
.wissen-extern-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--color-border-light);
}

/* ── Leerzustand externe Suche ── */
.wissen-extern-empty {
  grid-column: 1 / -1;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--fs-body);
}

/* Ladezustand externe Suche */
.wissen-extern-loading {
  grid-column: 1 / -1;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--fs-body);
}

/* ── Card-V2-Variante fuer Wissensartikel ────────────────── */

/* Microsoft-Docs-Karte: Lila-Accent + dezenter Tint, klar als extern markiert. */
.app-scope .card-v2.wissen-card-extern-app {
  --card-app-accent-color: var(--ms-docs-purple);
}
.app-scope .card-v2.wissen-card-extern-app .wissen-badge--extern {
  background: var(--ms-docs-purple);
  color: var(--brand-text-on);
  font-weight: 600;
}
.app-scope .wissen-extern-link-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-badge);
  color: var(--ms-docs-purple);
  font-weight: 500;
}
.app-scope .wissen-extern-link-badge img { opacity: 0.75; }

/* Responsive */
@media (max-width: 999px) {
  .app-scope .card-v2.wissen-card-app { height: 170px; min-height: 170px; }
}
@media (max-width: 599px) {
  .app-scope .card-v2.wissen-card-app { height: 160px; min-height: 160px; }
}
