/* Notification bell (site-wide, base.html header) ---------------------- */

.notify-bell-wrap {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  order: 1;
}

.notify-bell-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.notify-bell-btn:hover,
.notify-bell-btn:focus-visible {
  border-color: var(--accent2);
  box-shadow: 0 0 10px rgba(255, 0, 230, 0.35);
  outline: none;
}

.notify-bell-btn.has-notify {
  border-color: rgba(0, 230, 255, 0.55);
  animation: notifyBellPulse 2.2s ease-in-out infinite;
}

.notify-bell-btn.has-notify:hover,
.notify-bell-btn.has-notify:focus-visible {
  /* Hover/focus state (magenta) still wins over the idle pulse */
  animation-play-state: paused;
}

@keyframes notifyBellPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 230, 255, 0.45), 0 0 6px rgba(0, 230, 255, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 230, 255, 0), 0 0 16px rgba(0, 230, 255, 0.65);
  }
}

@media (prefers-reduced-motion: reduce) {
  .notify-bell-btn.has-notify {
    animation: none;
    box-shadow: 0 0 10px rgba(0, 230, 255, 0.55);
  }
}

.notify-bell-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.notify-bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent2);
  color: #0a0a12;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 8px rgba(255, 0, 230, 0.55);
}

.notify-bell-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, 88vw);
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: rgba(6, 9, 26, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 40000;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.notify-bell-panel[hidden] {
  display: none !important;
}

.notify-bell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}

.notify-bell-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.notify-bell-close:hover {
  color: var(--text);
}

.notify-bell-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
}

.notify-bell-item {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 4px 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  touch-action: pan-y;
  will-change: transform, opacity;
}

.notify-bell-item-link {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  color: inherit;
  text-decoration: none;
}

.notify-bell-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.04);
}

.notify-bell-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notify-bell-item-badge {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.notify-bell-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notify-bell-item-meta {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notify-bell-dismiss {
  flex: 0 0 auto;
  align-self: center;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}

.notify-bell-dismiss:hover {
  color: var(--danger);
}

.notify-bell-empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.notify-bell-swipe-hint {
  padding: 6px 12px 10px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Mobile: full-width slide-down sheet anchored under the header ------- */
@media (max-width: 768px) {
  /* On mobile the hamburger becomes visible and nav drops out of the header's
     flex flow (position: fixed), leaving just brand / bell / hamburger.
     Brand keeps its default order (0) so it stays far left; bell sits
     between brand and the hamburger, which is pushed after it. Desktop is
     untouched — its own order:1 rule places the bell after the nav links. */
  .notify-bell-wrap {
    order: 2;
    margin-left: auto;
  }

  .hamburger {
    order: 3;
  }

  .notify-bell-panel {
    position: fixed;
    top: calc(3.2rem + env(safe-area-inset-top, 0px));
    left: max(0.5rem, env(safe-area-inset-left, 0px));
    right: max(0.5rem, env(safe-area-inset-right, 0px));
    width: auto;
    max-height: calc(100vh - 4rem - env(safe-area-inset-top, 0px));
    z-index: 30001;
  }
}
