/* topbar-dropdowns.css — ALLE Topbar-Panels rechts oben.
 aus layout.css extrahiert.

 Aktivitaet, Hinweise, Neuigkeiten, Kontext und Profil nutzen .notif-dropdown
 als gemeinsame Basis-Klasse:
 - Desktop: Panel angedockt an Topbar-Unterkante (rechts)
 - Mobile (<600): Bottom-Sheet mit Drag-Handle, slide-from-bottom
 EINHEITLICHE Breite + Hoehe ueber das Token --topbar-panel-w auf .notif-dropdown
 (+ Breakpoints) — KEINE per-Panel-Width-Overrides, damit alle Icons gleich breit
 oeffnen. Profile-Dropdown ergaenzt nur eigene Head-Section + Items.
 ========================================================================== */

/* ── Notifications Dropdown (Panel — angedockt an Topbar-Unterkante) ── */
.notif-bell-wrap { position: static; display: flex; align-items: center; }
.notif-dropdown {
  /* EINHEITLICHE Breite + Hoehe fuer ALLE Topbar-Panels (Aktivitaet, Hinweise,
     Neuigkeiten, Kontext, Profil). Zentral hier (+ Breakpoints unten) tunen —
     KEINE per-Panel-Breiten-Overrides mehr, sonst oeffnen sie unterschiedlich. */
  --topbar-panel-w: 400px;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: var(--z-nav-rail);
  width: var(--topbar-panel-w);
  max-width: min(var(--topbar-panel-w), 100vw);
  max-height: min(600px, calc(100vh - var(--topbar-height) - env(safe-area-inset-top, 0px) - 40px));
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-right: none;
  border-radius: 0 0 0 var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), -2px 4px 12px rgba(0, 0, 0, 0.06);
}
/* Entrance (Charakter B) — Desktop-Panel erschien instant. Waechst dezent aus
   der Topbar-Unterkante (oben rechts). Mobile = Bottom-Sheet mit eigenem Slide. */
@media (min-width: 600px) {
  .notif-dropdown:not(.hidden) {
    transform-origin: top right;
    animation: notifDropIn var(--motion-quick) var(--ease-enter) both;
  }
}
@keyframes notifDropIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Panel header */
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}
.notif-dropdown-title {
  font-size: var(--font-size-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
}
.notif-reload-btn {
  width: 28px; height: 28px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--duration-fast);
}
.notif-reload-btn:hover { background: var(--color-bg-subtle); }
.notif-dropdown-body { padding: 0; }

/* Tab-Leiste im Glocken-Dropdown (Benachrichtigungen V2.0):
   Ungelesen / Alle / Aktionen — sticky unter dem Dropdown-Header. */
.notif-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.notif-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-circular);
  background: none;
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.notif-tab:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.notif-tab.is-active {
  background: var(--brand-light);
  border-color: color-mix(in srgb, var(--brand-default) 30%, transparent);
  color: var(--brand-default);
}
.notif-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-circular);
  background: var(--color-bg-muted);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1;
}
.notif-tab.is-active .notif-tab-count {
  background: var(--brand-default);
  color: var(--brand-text-on);
}

/* Lade-Zustand im Dropdown: Skeleton-Zeilen in Item-Form (SSOT .sk-list aus
   skeleton.css); .notif-loading ist nur der Text-Fallback ohne Skeleton-Modul. */
.notif-skeleton {
  padding: var(--space-3) var(--space-4);
}
.notif-skeleton .sk-list-row { padding: var(--space-2) 0; }
.notif-loading {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

/* "×N"-Badge fuer gebuendelte Ereignisse (Unread-Collapse) */
.notif-event-anzahl {
  flex-shrink: 0;
  padding: var(--space-px) var(--space-1-5);
  border-radius: var(--radius-circular);
  background: var(--brand-light);
  color: var(--brand-default);
  font-size: var(--font-size-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}
/* Kategorie-Sektion */
.notif-kat-section { padding: 0; }
.notif-kat-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-1);
}
.notif-kat-strich {
  width: 3px; height: 14px;
  border-radius: var(--radius-xxs); flex-shrink: 0;
}
.notif-kat-label {
  flex: 1;
  font-size: var(--fs-badge);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.notif-kat-count {
  font-size: 10px;
  padding: var(--space-px) 7px;
  border-radius: var(--radius-circular);
  font-weight: var(--fw-semibold);
}
/* Item */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  transition: background var(--duration-fast);
}
.notif-item:hover { background: var(--color-bg-subtle); }
.notif-item--clickable:hover { background: var(--brand-light); }
.notif-item--clickable .notif-item-titel { color: var(--brand-default); }
.notif-item-dot {
  width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
  margin-top: var(--space-1);
}
.notif-item-text { flex: 1; min-width: 0; }
.notif-item-titel {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-meta {
  font-size: var(--fs-badge);
  color: var(--color-text-muted);
  margin-top: var(--space-px);
}
/* Mehr-Button */
.notif-mehr-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: var(--space-1) var(--space-4);
  font-size: var(--fs-badge);
  color: var(--brand-default);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
}
.notif-mehr-btn:hover { text-decoration: underline; }
/* Footer */
.notif-footer {
  /* Unten angeheftet (analog sticky Header oben) — bleibt sichtbar, auch wenn
     die Liste lang ist (z.B. Neuigkeiten-Feed). */
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  color: var(--brand-default);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast);
}
.notif-footer:hover { background: var(--color-bg-subtle); }
/* Leer-State */
.notif-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
@media (max-width: 1399px) {
  .notif-dropdown { --topbar-panel-w: 380px; }
}
@media (max-width: 999px) {
  .notif-dropdown { --topbar-panel-w: 360px; }
  .notif-reload-btn { min-height: 44px; min-width: 44px; }
}

/* ── Mobile Bottom-Sheet Overlay (gemeinsamer Backdrop fuer alle Topbar-Sheets) ──
   Kein display:none in der Basis-Regel: Sichtbarkeit steuert allein die
   .hidden-Utility (init.js toggelt sie) — display:none hier machte den Backdrop
   dauerhaft unsichtbar und den Backdrop-Tap-Close (onclick) zu totem Code. */
.topbar-sheet-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: var(--lod-scrim);  /* Scrim-SSOT (tokens.css) */
  z-index: var(--z-bottom-sheet-backdrop);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-soft);
}
.topbar-sheet-overlay.open { opacity: 1; }

@media (max-width: 599px) {
  /* Alle Dropdowns werden Bottom Sheets (profile-dropdown nutzt jetzt auch .notif-dropdown) */
  .notif-dropdown {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    max-height: 70vh;
    margin: 0;
    border: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15);
    z-index: var(--z-bottom-sheet);
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(100%);
    transition: transform var(--motion-overlay) var(--ease-drawer);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .notif-dropdown.sheet-open {
    transform: translateY(0);
  }
  /* Hidden-Klasse darf transform nicht blockieren */
  .notif-dropdown.hidden {
    display: flex;
    flex-direction: column;
    visibility: hidden;
    pointer-events: none;
  }
  .notif-dropdown:not(.hidden) {
    display: flex;
    flex-direction: column;
    visibility: visible;
    pointer-events: auto;
  }
  /* Drag-Handle (Pille oben) */
  .notif-dropdown::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--color-border-pressed);
    border-radius: var(--radius-xxs);
    margin: var(--space-2) auto var(--space-1);
    flex-shrink: 0;
  }
  /* Header im Sheet: padding anpassen */
  .notif-dropdown-header {
    padding: var(--space-1) var(--space-4) var(--space-3);
    border-radius: 0;
  }
  .notif-dropdown-body { flex: 1; overflow-y: auto; }
  /* Profil-Sheet: groesserer Avatar im Mobile-Sheet (v2-Slot) */
  #profile-dropdown #profile-dd-avatar > .avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 16px !important;
  }
  #profile-dropdown .profile-dropdown-item { min-height: 48px; padding: var(--space-3) var(--space-4); font-size: var(--font-size-base); }
}

/* Badge Pulse Animation */
@keyframes notifPulse { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
.notif-pulse { animation: notifPulse var(--duration-slower) var(--ease-soft); }

/* Highlight Animation for navigated cards */
@keyframes notifGlow { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-default) 30%, transparent); } 100% { box-shadow: none; } }
.notif-highlight { animation: notifGlow var(--duration-glow) var(--ease-out-soft); }

/* ── Profile Dropdown — nutzt jetzt .notif-dropdown Basis-Klasse ─── */
/* Spezifische Profil-Styles (Head-Section, Items).
   Head-Section ist ein <a href="/mein-bereich"> — clickable.
   Reset des Link-Defaults + Hover-State, damit es nicht aussieht wie ein Link. */
.profile-dropdown-head-section {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast);
}
.profile-dropdown-head-section:hover,
.profile-dropdown-head-section:focus-visible {
  background: var(--color-surface-hover, var(--lod-gray-50));
  outline: none;
}
/* Avatar-Modul: #profile-dd-avatar ist ein .avatar-slot. Avatar.html() liefert
   Inline-Sizing in 40px (siehe init.js). Hier nur Layout-Anpassung des Slots
   (flex-shrink im Head-Section). Pixel-Mass kommt vom Modul. */
#profile-dd-avatar { flex-shrink: 0; }
.profile-dropdown-info { min-width: 0; flex: 1; }
.profile-dropdown-name { font-weight: var(--fw-semibold); font-size: var(--font-size-base); color: var(--color-text); line-height: 1.3; }
.profile-dropdown-email { font-size: var(--font-size-sm); color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.profile-dropdown-divider { border-top: 1px solid var(--color-border); margin: var(--space-1) 0; }
.profile-dropdown-item {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; text-align: left;
  padding: var(--space-2) var(--space-4);
  border: none; background: none; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--font-size-sm);
  color: var(--color-text); text-decoration: none;
  transition: background var(--duration-fast);
  min-height: 44px;
}
.profile-dropdown-item:hover { background: var(--color-bg-subtle); }
.profile-dropdown-item--danger { color: var(--status-danger-fg); }
.profile-dropdown-item--danger:hover { background: var(--status-danger-bg); }

/* ── Header-Action-Gruppe (mehrere Buttons rechts im Dropdown-Header) ── */
.notif-dropdown-head-actions { display: inline-flex; align-items: center; gap: var(--space-1); }

/* ── Aktivitaets-Feed: Diagnose-Block + Kopieren-Button ── */
.act-diag {
  margin-top: var(--space-1);
  display: flex;
  flex-direction: column;
  gap: var(--space-px);
}
.act-diag-head {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-badge);
  color: var(--color-text-muted);
  word-break: break-all;
}
.act-diag-msg {
  font-size: var(--fs-badge);
  color: var(--status-danger-fg);
  white-space: pre-wrap;
  word-break: break-word;
}
.act-copy-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  transition: background var(--duration-fast);
}
.act-copy-btn:hover { background: var(--color-bg-subtle); }

/* ── Changelog / Neuigkeiten-Dropdown (Breite/Hoehe = .notif-dropdown SSOT) ── */
.cl-feed { display: flex; flex-direction: column; }
.cl-divider-label {
  padding: var(--space-3) var(--space-4) var(--space-1);
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-badge);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
/* Dropdown = kompakte Dichte (eine Spalte). Meta-Spalte kollabiert ueber den Inhalt:
   Datum als ruhige Zeile, darunter Titel + Eintraege. Die Vollansicht (mb-nv-feed)
   schaltet dieselbe Struktur auf Karten + Lese-Spalte um. */
/* Copy-Link nur in der Vollansicht — im Dropdown ausgeblendet (gleiche Render-Funktion) */
.cl-copy { display: none; }
.cl-version { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
.cl-version:last-child { border-bottom: none; }
/* Neue (ungesehene) Version: dezenter Marken-Akzent links, ohne Layout-Shift */
.cl-version--new { box-shadow: inset 2px 0 0 var(--brand-default); }
.cl-version-date { font-size: var(--fs-badge); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.cl-version-head { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-px); }
.cl-version-titel { flex: 1; min-width: 0; font-size: var(--font-size-base); font-weight: var(--fw-semibold); color: var(--color-text); }
.cl-new-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: 10px; font-weight: var(--fw-semibold);
  padding: var(--space-px) 7px; border-radius: var(--radius-circular);
  background: var(--brand-light); color: var(--brand-default);
  text-transform: uppercase; letter-spacing: 0.04em;
}
/* Eintrags-Liste: je Eintrag ein echtes getoentes Typ-Badge (Pille) links, Text rechts.
   Pille = natuerliche Breite; durch die Typ-Gruppierung sind gleiche Typen untereinander
   gleich breit → Text bleibt innerhalb eines Clusters sauber ausgerichtet. */
.cl-list { list-style: none; margin: var(--space-2-5) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.cl-entry { display: flex; align-items: flex-start; gap: var(--space-2); }
.cl-entry-badge {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-px) 8px var(--space-px) 6px; border-radius: var(--radius-circular);
  font-size: 10px; font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.03em;
}
/* Typ-Icon farbig getintet via CSS-Mask (statt monochromem <img>) */
.cl-entry-ico {
  flex-shrink: 0;
  width: 13px; height: 13px;
  background-color: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 13px 13px; mask-size: 13px 13px;
}
.cl-entry-typ { white-space: nowrap; }
.cl-entry-text { flex: 1; min-width: 0; font-size: var(--font-size-sm); color: var(--color-text); line-height: 1.5; }
/* Semantisches Typ-Mapping: Neu=Gruen(success) · Verbessert=Blau(info) · Behoben=Amber(warning).
   Badge traegt bg + fg; Label erbt color, Icon nimmt currentColor (mask-tint). */
.cl-entry--feature .cl-entry-badge { background: var(--status-success-bg); color: var(--status-success-fg); }
.cl-entry--feature .cl-entry-ico { -webkit-mask-image: url(/assets/icons/fluent/sparkle_24_regular.svg); mask-image: url(/assets/icons/fluent/sparkle_24_regular.svg); }
.cl-entry--verbesserung .cl-entry-badge { background: var(--status-info-bg); color: var(--status-info-fg); }
.cl-entry--verbesserung .cl-entry-ico { -webkit-mask-image: url(/assets/icons/fluent/star_24_regular.svg); mask-image: url(/assets/icons/fluent/star_24_regular.svg); }
.cl-entry--fix .cl-entry-badge { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.cl-entry--fix .cl-entry-ico { -webkit-mask-image: url(/assets/icons/fluent/wrench_24_regular.svg); mask-image: url(/assets/icons/fluent/wrench_24_regular.svg); }

@media (max-width: 999px) {
  .act-copy-btn { min-height: 44px; min-width: 44px; }
}
