/* ================================================================
   Benachrichtigungen — Glocke am rechten Rand der Menüleiste,
   aufklappende Liste und Hinweise

   Zwei Fallen aus style.css, die hier ausdrücklich ausgehebelt werden:
     * style.css:407  `input, button, select { width: 100% }`
       → jeder Knopf setzt width und margin zurück.
     * .header hat `overflow: hidden`
       → deshalb sitzt die Glocke in .tabs und nicht in der Kopfzeile;
         dort würde die Liste abgeschnitten.
   ================================================================ */

/* ---------- Platz in der Menüleiste ---------- */

.bn-huelle {
  position: relative;
  display: flex;
  /* schiebt die Glocke ans rechte Ende, ohne sie zu dehnen */
  margin-left: auto;
  flex: none;
  /* Oben bündig, nicht gedehnt.
     "flex-start" ist bewusst gewählt: die Knöpfe der Menügruppen sitzen
     ebenfalls oben in ihrem Behälter. Wäre die Glocke zentriert oder
     gedehnt, stünde sie gegenüber genau diesen Nachbarn versetzt. */
  align-self: flex-start;
  align-items: stretch;
}

/* 💬-Knopf Team-Chat (js/anlagen/anlagen-chat.js): links neben der Glocke, sieht aus wie sie.
   Er übernimmt das margin-left:auto; ist er ausgeblendet, schiebt wieder die Glocke. */
.bn-chat-huelle[hidden] { display: none; }
.bn-chat-huelle:not([hidden]) + .bn-huelle { margin-left: 6px; }
.bn-chat-knopf[aria-current="page"] {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
}

/* ---------- Glocke ---------- */

.bn-glocke {
  position: relative;
  width: auto !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Die tatsächliche Höhe setzt hoeheAngleichen_() beim Aufbau als
     Inline-Stil — gemessen am Nachbarknopf. Rechnen half hier nicht:
     ein Emoji spannt eine andere Zeile auf als Text, und
     "line-height: normal" fällt je nach Schrift unterschiedlich aus.
     Die Angaben hier sind nur der Stand, bis gemessen wurde. */
  min-height: 44px;
  padding: 0 18px;
  line-height: 1;
  /* Das Zeichen ragt bewusst über den Rand — nicht abschneiden. */
  overflow: visible;

  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  font-size: 17px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bn-glocke:hover {
  background: #e2e8f0;
}

.bn-glocke[aria-expanded="true"] {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
}

.bn-glocke-icon {
  display: block;
  line-height: 1;
}

/* Zeichen an der Glocke:
   rote Zahl    = neu seit dem letzten Hinschauen
   gelber Punkt = nichts Neues, aber es liegt noch etwas offen
   nichts       = alles erledigt */
.bn-zeichen {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
}

.bn-zeichen--neu {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px #fff;
  animation: bn-puls 1.6s ease-in-out 3;
}

.bn-zeichen--offen {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px #fff;
}

@keyframes bn-puls {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* Rückfall: sitzt die Glocke doch in der Kopfzeile, muss sie hell sein
   und braucht eigene Maße — dort gibt es keine Zeile zum Anlehnen. */
.bn-huelle--kopf {
  margin-left: 0;
  align-self: center;
  align-items: center;
}

.bn-huelle--kopf .bn-glocke {
  height: auto;
  min-height: 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.bn-huelle--kopf .bn-glocke:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ---------- Aufklappende Liste ---------- */

.bn-liste {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 400px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  z-index: 9500;
  text-align: left;
  color: #1f2937;
  animation: bn-auf 0.16s ease-out;
}

.bn-liste[hidden] { display: none; }

@keyframes bn-auf {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bn-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
  border-radius: 16px 16px 0 0;
  font-size: 14px;
  color: #0f172a;
  flex: none;
}

.bn-link {
  width: auto !important;
  margin: 0 !important;
  padding: 0;
  border: none;
  background: none;
  color: #6d28d9;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.bn-link:hover { color: #4c1d95; text-decoration: underline; }

.bn-rollen {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.bn-zeile {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid #f4f6fa;
  cursor: pointer;
  transition: background 0.15s;
}

.bn-zeile:last-child { border-bottom: none; }
.bn-zeile:hover { background: #f7f5ff; }

/* Neue Vorgänge bekommen einen violetten Balken an der Kante —
   dieselbe Farbe wie der aktive Knopf in der Menüleiste. */
.bn-zeile--neu {
  background: #f6f4ff;
  box-shadow: inset 3px 0 0 #7c3aed;
}

.bn-zeile--neu:hover { background: #efeaff; }

.bn-zeile--fehler {
  cursor: default;
  background: #fff7ed;
  box-shadow: inset 3px 0 0 #f59e0b;
}

.bn-icon {
  font-size: 18px;
  line-height: 1.25;
  flex: none;
}

.bn-inhalt { min-width: 0; flex: 1; }

.bn-titel {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}

.bn-neu-marke {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 7px;
  border-radius: 8px;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  vertical-align: 1px;
}

.bn-text {
  font-size: 12.5px;
  color: #475569;
  overflow-wrap: anywhere;
}

.bn-zeit {
  margin-top: 3px;
  font-size: 11px;
  color: #94a3b8;
}

.bn-leer {
  padding: 30px 18px;
  text-align: center;
  font-size: 13.5px;
  color: #64748b;
}

.bn-fuss {
  padding: 9px 16px;
  border-top: 1px solid #eef2f7;
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
  font-size: 11.5px;
  color: #64748b;
  flex: none;
}

/* ---------- Aufpoppende Hinweise ---------- */

.bn-hinweise {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;      /* über showAlert (10000), damit beides lesbar bleibt */
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.bn-hinweis {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  background: #fff;
  border-left: 4px solid #7c3aed;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.22);
  color: #1f2937;
  pointer-events: auto;
  animation: bn-rein 0.28s ease-out;
}

.bn-hinweis--klickbar { cursor: pointer; }
.bn-hinweis--klickbar:hover { background: #f7f5ff; }

.bn-hinweis--geht {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.3s, transform 0.3s;
}

@keyframes bn-rein {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}

.bn-zu {
  width: auto !important;
  margin: 0 !important;
  padding: 0 4px;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 19px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  flex: none;
}

.bn-zu:hover { color: #475569; }

/* ---------- Schmale Bildschirme ----------
   Die Menüleiste bricht dort um und die Nav-Knöpfe werden zu vollen
   Zeilen. Die Glocke bleibt eine schmale Schaltfläche, die Liste
   spannt sich über die ganze Breite. */

@media (max-width: 1024px) {
  .bn-liste {
    width: 360px;
  }
}

@media (max-width: 768px) {
  .bn-huelle {
    margin-left: 0;
    width: 100%;
  }

  .bn-glocke {
    width: 100% !important;
    min-height: 48px;
    justify-content: flex-start;
    gap: 10px;
    padding: 16px 20px;
  }

  .bn-glocke::after {
    content: 'Benachrichtigungen';
    font-size: 14px;
    font-weight: 600;
  }

  .bn-chat-knopf::after { content: 'Team-Chat'; }
  .bn-chat-huelle:not([hidden]) + .bn-huelle { margin-left: 0; }

  .bn-zeichen {
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
  }

  .bn-zeichen--neu {
    animation: none;   /* mittig sitzend würde das Pulsen springen */
  }

  /* Die Hülle ist hier volle Breite — die Liste hängt sich direkt
     darunter, statt fixiert im Bild zu kleben. */
  .bn-liste {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: 60vh;
  }

  .bn-hinweise {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}
