/* ──────────────────────────────────────────────────────────────────
   Notifications Bell (Header) — Dropdown auf Desktop, Sheet auf Mobile
   ────────────────────────────────────────────────────────────────── */

.notif-bell-wrap {
  position: relative;
  display: inline-flex;
}

.notif-bell-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .75);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s, color .2s;
  position: relative;
}
.notif-bell-btn:hover {
  background: rgba(178, 120, 255, .1);
  border-color: rgba(178, 120, 255, .35);
  color: #fff;
}
.notif-bell-btn:active { transform: scale(.96); }

.notif-bell-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff6b6b, #ff4757);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 71, 87, .45);
  border: 2px solid var(--color-primary, #000);
  pointer-events: none;
}
.notif-bell-badge.is-visible { display: inline-flex; }

/* ── Panel (Desktop: Dropdown via JS-positioning / Mobile: Bottom-Sheet) ── */
.notif-bell-panel {
  position: fixed;
  top: 76px;            /* default — wird per JS relativ zur Bell überschrieben */
  right: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100dvh - 90px));
  background: rgba(18, 14, 28, .98);
  border: 1px solid rgba(178, 120, 255, .2);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 9550;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: notif-pop .25s cubic-bezier(.22,1,.36,1) both;
}
.notif-bell-panel.is-open { display: flex; }

/* ── Backdrop (Mobile only) ──────────────────────────────────────── */
.notif-bell-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9540;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  display: none;
}
@keyframes notif-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.notif-bell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem .8rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.notif-bell-title {
  font-size: .98rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
.notif-bell-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.notif-bell-mark-all {
  background: none;
  border: none;
  color: rgba(178, 120, 255, .85);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  padding: .35rem .55rem;
  border-radius: 8px;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.notif-bell-mark-all:hover {
  background: rgba(178, 120, 255, .1);
  color: #fff;
}
.notif-bell-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
  border: none;
  color: rgba(255, 255, 255, .55);
  font-size: .78rem;
  cursor: pointer;
  display: none; /* Desktop: ausgeblendet */
  align-items: center;
  justify-content: center;
}
.notif-bell-close:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

/* List */
.notif-bell-list {
  flex: 1 1 auto;
  min-height: 0;          /* kritisch für flex-children mit overflow */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: .35rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(178, 120, 255, .25) transparent;
}
.notif-bell-list::-webkit-scrollbar { width: 4px; }
.notif-bell-list::-webkit-scrollbar-thumb { background: rgba(178, 120, 255, .25); border-radius: 4px; }

.notif-group-label {
  padding: .85rem 1.1rem .35rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(178, 120, 255, .65);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  width: 100%;
  padding: .75rem 1.1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  position: relative;
  transition: background .15s;
  border-bottom: 1px solid rgba(255, 255, 255, .03);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(178, 120, 255, .06); }
.notif-item--unread { background: rgba(178, 120, 255, .04); }

.notif-item__icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  border: 1px solid rgba(255, 255, 255, .06);
}

.notif-item__body {
  flex: 1;
  min-width: 0;
}
.notif-item__msg {
  font-size: .87rem;
  color: rgba(255, 255, 255, .9);
  line-height: 1.4;
  margin-bottom: .2rem;
  letter-spacing: -.005em;
}
.notif-item--unread .notif-item__msg { font-weight: 600; color: #fff; }
.notif-item__time {
  font-size: .72rem;
  color: rgba(255, 255, 255, .4);
}

.notif-item__dot {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #b278ff;
  box-shadow: 0 0 8px rgba(178, 120, 255, .55);
}

/* Empty state */
.notif-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, .55);
}
.notif-empty i {
  font-size: 1.6rem;
  color: rgba(178, 120, 255, .35);
  display: block;
  margin-bottom: .65rem;
}
.notif-empty p {
  font-size: .92rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .75);
  margin: 0 0 .25rem;
}
.notif-empty span {
  font-size: .8rem;
  color: rgba(255, 255, 255, .4);
}

/* ── Mobile / kleine Desktop-Skalen: Bottom-Sheet ─────────────────── */
@media (max-width: 900px) {
  .notif-bell-panel {
    position: fixed;
    top: 14vh;             /* 14% vom Top — gibt definitive Höhe via top+bottom */
    top: 14dvh;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: none;      /* Höhe wird durch top + bottom bestimmt */
    height: auto;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.32, .72, 0, 1);
    animation: none;
    z-index: 9550;
    overflow: hidden;
    /* WICHTIG: kein display:flex by default — sonst greift es immer */
  }
  .notif-bell-panel.is-open {
    display: flex;
    transform: translateY(0);
  }
  .notif-bell-close { display: inline-flex; }
  .notif-bell-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  body.notif-bell-open {
    overflow: hidden;
    touch-action: none;     /* Body-Touch-Scroll deaktivieren */
  }
  body.notif-bell-open .notif-bell-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
}
