/* Notification badge from transitions-dev. */
:root {
  --badge-slide-dur: 260ms;
  --badge-pop-dur: 500ms;
  --badge-pop-close-dur: 180ms;
  --badge-fade-dur: 400ms;
  --badge-fade-close-dur: 180ms;
  --badge-blur: 2px;
  --badge-offset-x: -8.2px;
  --badge-offset-y: 12.4px;
  --badge-slide-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --badge-pop-ease: cubic-bezier(0.34, 1.36, 0.64, 1);
  --badge-close-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes t-badge-slide-in {
  from { transform: translate(var(--badge-offset-x), var(--badge-offset-y)); }
  to   { transform: translate(0, 0); }
}

/* .t-badge is the absolutely-positioned wrapper for the dot.
   Adjust top/right (or left/bottom) to anchor it on your trigger. */
.t-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  pointer-events: none;
  will-change: transform;
}
.t-badge[data-open="true"] {
  animation: t-badge-slide-in var(--badge-slide-dur) var(--badge-slide-ease);
}

.t-badge-dot {
  display: block;
  transform-origin: center;
  transform: scale(1);
  opacity: 1;
  filter: blur(0);
  transition:
    transform var(--badge-pop-dur)  var(--badge-pop-ease),
    opacity   var(--badge-fade-dur) var(--badge-pop-ease),
    filter    var(--badge-pop-dur)  var(--badge-pop-ease);
  will-change: transform, opacity, filter;
}
.t-badge[data-open="false"] .t-badge-dot {
  transform: scale(0);
  opacity: 0;
  filter: blur(var(--badge-blur));
  transition:
    transform var(--badge-pop-close-dur)  var(--badge-close-ease),
    opacity   var(--badge-fade-close-dur) var(--badge-close-ease),
    filter    var(--badge-pop-close-dur)  var(--badge-close-ease);
}

/* Initial data establishes the badge without replaying the arrival motion. */
.t-badge[data-animate="false"] { animation: none; }
.t-badge[data-animate="false"] .t-badge-dot { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .t-badge, .t-badge-dot { animation: none !important; transition: none !important; }
}

.notification-bell { position: relative; }
.notification-group-anchor { position: absolute; inset: 0; pointer-events: none; }
.notification-bell .t-badge { top: .1rem; right: 0; }
.notification-bell .t-badge-dot { box-sizing: border-box; min-width: .875rem; height: .875rem; padding-inline: .125rem; border-radius: 1rem; background: #fff; color: #000; font-size: .5625rem; line-height: .875rem; font-weight: var(--weight-semibold); text-align: center; }
.group-topbar-actions .notification-bell .t-badge {
  scale: 1;
  transform-origin: top right;
  transition: scale var(--resize-dur) var(--resize-ease);
}
.group-display[data-group-header-visible] .notification-bell .t-badge { scale: calc(12 / 14); }
.notification-bell-floating { position: fixed; top: 1.5rem; right: 1.5rem; z-index: 15; background: var(--color-surface); border-radius: var(--radius-control); }
body:has(.dev-playground-banner) .notification-bell-floating { top: 4rem; }
.menu-surface.notification-inbox { position: relative; z-index: 40; isolation: isolate; width: min(20rem, calc(100vw - 1.5rem)); max-height: min(30rem, calc(100dvh - 6rem)); padding: .5rem; overflow: auto; border-radius: var(--radius-control); background: transparent; will-change: transform; transform-origin: var(--radix-popover-content-transform-origin); }
.notification-inbox::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: color-mix(in srgb, var(--color-background) 80%, transparent); backdrop-filter: blur(8px); pointer-events: none; }
.notification-inbox-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .375rem .625rem 0; }
.notification-inbox-header h2 { color: color-mix(in srgb, var(--color-text) 36%, var(--color-background)); font-size: .75rem; line-height: 1rem; font-weight: 400; margin: 0; outline: none; }
.notification-inbox :is(a,button):focus-visible { outline: 1px solid var(--color-text-muted); outline-offset: -1px; }
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification-list a { display: grid; gap: .125rem; padding: .5rem .625rem; border-radius: .4375rem; color: color-mix(in srgb, var(--color-text) 64%, var(--color-background)); font-size: var(--text-sm); line-height: 1.125rem; text-decoration: none; }
.notification-inbox .notification-list > li:first-child a { padding-top: .25rem; }
.notification-list a:hover, .notification-list a:focus-visible { background: color-mix(in srgb, var(--color-text) 3%, transparent); }
.notification-item-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; }
.notification-item-title { display: flex; align-items: center; gap: .375rem; min-width: 0; font-weight: var(--weight-semibold); }
.notification-item-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-item-body { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: color-mix(in srgb, var(--color-text) 40%, var(--color-background)); font-size: .75rem; line-height: 1rem; }
.notification-list time { flex: none; font-size: .6875rem; line-height: 1rem; color: var(--color-text-muted); white-space: nowrap; }
.notification-list li[data-unread="false"] .notification-item-title { font-weight: var(--weight-regular); }
.notification-unread-dot { flex: none; width: .4rem; height: .4rem; border-radius: 50%; background: var(--color-accent); }
.notification-mark-all { flex: none; margin: 0; min-height: 1.5rem; padding: 0; border: 0; background: transparent; color: color-mix(in srgb, var(--color-text) 36%, var(--color-background)); font-family: inherit; font-size: .75rem; line-height: 1rem; font-weight: 400; white-space: nowrap; cursor: pointer; }
.notification-mark-all:not(:disabled):hover { color: color-mix(in srgb, var(--color-text) 64%, var(--color-background)); }
.notification-mark-all:disabled { opacity: .5; cursor: default; }
.notification-empty { margin: 0; padding: .375rem .625rem .625rem; color: color-mix(in srgb, var(--color-text) 64%, var(--color-background)); line-height: 1.25rem; }
.notification-load-more { width: calc(100% - 2rem); margin: 0 1rem 1rem; }
.notification-empty-notes { display: grid; gap: .5rem; }
.notification-empty p { margin: 0; }
.notification-preferences .group-settings-card { gap: 1.25rem; }
.notification-preferences-row { flex-wrap: nowrap; }
.notification-preferences-row .group-settings-copy { flex-basis: auto; }
.notification-preferences-row .ui-switch { flex: none; }
.notification-preferences-retry { flex: none; white-space: nowrap; }
.notification-preferences .group-settings-feedback { margin-top: .25rem; }
.notification-error { color: var(--color-error); padding: .75rem 1.25rem; }

.review-notification-viewport {
  position: fixed;
  z-index: 60;
  inset-inline-end: max(.75rem, env(safe-area-inset-right));
  inset-block-end: max(.75rem, env(safe-area-inset-bottom));
  width: min(21rem, calc(100vw - 1.5rem));
  padding: 0;
  margin: 0;
  list-style: none;
}
.review-notification {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .5rem;
  padding: .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 8px 24px rgb(0 0 0 / .18);
  font-size: var(--text-sm);
}
.review-notification-copy { display: grid; gap: .125rem; overflow-wrap: anywhere; }
.review-notification-copy > :first-child { font-weight: var(--weight-semibold); }
.review-notification-copy > :last-child { color: var(--color-text-secondary); }
.review-notification-close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.review-notification-close:hover { background: var(--menu-item-highlight); }
.review-notification-close svg { width: 1rem; height: 1rem; }

.review-notification {
  --toast-open: 350ms;
  --toast-close: 250ms;
  --toast-distance: 16px;
  --toast-blur: 2px;
  --toast-scale: .97;
  --toast-ease: cubic-bezier(.22, 1, .36, 1);
}
.review-notification[data-state="open"] { animation: review-notification-in var(--toast-open) var(--toast-ease); }
.review-notification[data-state="closed"] { animation: review-notification-out var(--toast-close) var(--toast-ease); }
@keyframes review-notification-in {
  from { opacity: 0; transform: translateY(var(--toast-distance)) scale(var(--toast-scale)); filter: blur(var(--toast-blur)); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes review-notification-out {
  to { opacity: 0; transform: translateY(var(--toast-distance)) scale(var(--toast-scale)); filter: blur(var(--toast-blur)); }
}
@media (prefers-reduced-motion: reduce) {
  .review-notification { animation: none !important; }
}
