/* ════════════════════════════════════════════════════════════════════════
   Notifications UI — header dropdown, badge, rich toast, icon chips
   Shared by workspace.html and notifications.html
   ════════════════════════════════════════════════════════════════════════ */

/* ── Keyframes ── */
@keyframes nxDropIn {
  from { opacity: 0; transform: translateY(-8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes nxItemIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes nxShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@keyframes nxBadgePop {
  0%   { transform: scale(.4); }
  60%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes nxToastBar {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
@keyframes nxSheetUp {
  from { opacity: .4; transform: translateY(32px); }
  to   { opacity: 1; transform: none; }
}
@keyframes nxSheetDown {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(32px); }
}
@keyframes nxFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Icon chips (shared: dropdown + page + toasts) ── */
.nx-ic-bell            { background: rgba(59,130,246,.12);  color: #3b82f6; }
.nx-ic-system          { background: rgba(100,116,139,.14); color: #64748b; }
.nx-ic-project         { background: rgba(139,92,246,.13);  color: #8b5cf6; }
.nx-ic-account         { background: rgba(6,182,212,.13);   color: #06b6d4; }
.nx-ic-billing         { background: rgba(16,185,129,.13);  color: #10b981; }
.nx-ic-admin_broadcast { background: rgba(245,158,11,.14);  color: #f59e0b; }
.nx-ic-alert           { background: rgba(239,68,68,.12);   color: #ef4444; }

/* ── Header badge ── */
.nx-notif-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  background: #f43f5e;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  border: 2px solid #ffffff;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(244, 63, 94, .35);
  animation: nxBadgePop .35s cubic-bezier(.2, .9, .3, 1.4);
}

/* ── Dropdown panel ── */
.nx-notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 400px;
  max-width: calc(100vw - 24px);
  max-height: min(560px, calc(100vh - 110px));
  background: #fff;
  border: 1px solid rgba(15,27,46,.1);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15,27,46,.22), 0 4px 16px rgba(15,27,46,.08);
  z-index: 600;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: nxDropIn .16s cubic-bezier(.2,.9,.3,1.1);
  font-family: 'DM Sans', system-ui, sans-serif;
}
.nx-notif-dropdown.nx-open { display: flex; }

html body.ap-vertical-shell:not(.nx-on-home) .nx-notif-dropdown { display: none !important; }

/* header */
.nx-notif-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(15,27,46,.07);
  flex-shrink: 0;
}
.nx-notif-hdr-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nx-notif-title { font-size: 14px; font-weight: 800; color: #0F1B2E; white-space: nowrap; }
.nx-notif-new {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(36,180,126,.12);
  color: #10b981;
  white-space: nowrap;
}
.nx-notif-markall {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: #24B47E;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nx-notif-markall:hover { background: rgba(36,180,126,.08); color: #18995f; }
.nx-notif-close {
  display: none;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(15,27,46,.1);
  border-radius: 8px;
  background: #fff;
  color: #4D6E91;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .12s;
}
.nx-notif-close:hover { border-color: #ef4444; color: #ef4444; }

/* filter chips */
.nx-notif-chips {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(15,27,46,.07);
  flex-shrink: 0;
  scrollbar-width: none;
}
.nx-notif-chips::-webkit-scrollbar { display: none; }
.nx-notif-chip {
  border: 1px solid rgba(15,27,46,.12);
  background: transparent;
  color: #4D6E91;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .14s;
  flex-shrink: 0;
}
.nx-notif-chip:hover { border-color: #24B47E; color: #24B47E; }
.nx-notif-chip.nx-on { background: #0F1B2E; border-color: #0F1B2E; color: #fff; }

/* list */
.nx-notif-body { overflow-y: auto; flex: 1; min-height: 0; }
.nx-notif-body::-webkit-scrollbar { width: 5px; }
.nx-notif-body::-webkit-scrollbar-track { background: transparent; }
.nx-notif-body::-webkit-scrollbar-thumb { background: rgba(15,27,46,.16); border-radius: 999px; }

/* skeleton */
.nx-notif-sk { display: flex; gap: 12px; padding: 13px 16px; }
.nx-notif-sk-i,
.nx-notif-sk-l div {
  background: linear-gradient(90deg, rgba(15,27,46,.05), rgba(15,27,46,.11), rgba(15,27,46,.05));
  background-size: 200% 100%;
  animation: nxShimmer 1.2s linear infinite;
}
.nx-notif-sk-i { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; }
.nx-notif-sk-l { flex: 1; padding-top: 2px; }
.nx-notif-sk-l div { height: 10px; border-radius: 6px; margin-bottom: 8px; }
.nx-notif-sk-l div:last-child { width: 55%; margin-bottom: 0; }

/* item */
.nx-notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(15,27,46,.05);
  transition: background .12s;
  position: relative;
  animation: nxItemIn .28s ease both;
}
.nx-notif-item:hover { background: rgba(15,27,46,.03); }
.nx-notif-item.nx-unread { background: rgba(36,180,126,.05); }
.nx-notif-item.nx-unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #24B47E;
}
.nx-notif-item.nx-item-out { opacity: 0; transform: translateX(16px); transition: all .18s ease; }

.nx-notif-ic {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nx-notif-ic svg { width: 18px; height: 18px; }

.nx-notif-b { flex: 1; min-width: 0; }
.nx-notif-t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.nx-notif-t span:first-child {
  font-size: 12.5px;
  font-weight: 700;
  color: #0F1B2E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nx-notif-time { font-size: 10.5px; color: #4D6E91; white-space: nowrap; flex-shrink: 0; opacity: .85; }
.nx-notif-m {
  font-size: 11.5px;
  color: #2A2F36;
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nx-notif-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.nx-notif-ty {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #4D6E91;
  background: rgba(15,27,46,.06);
  padding: 2px 7px;
  border-radius: 999px;
}
.nx-notif-pri {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 2px 7px;
  border-radius: 999px;
}
.nx-notif-pri-high  { background: rgba(184,105,62,.14); color: #B8693E; }
.nx-notif-pri-urgent{ background: rgba(239,68,68,.12); color: #ef4444; }

/* actions */
.nx-notif-act { display: flex; gap: 4px; flex-shrink: 0; opacity: 0; transition: opacity .12s; }
.nx-notif-item:hover .nx-notif-act,
.nx-notif-item:focus-within .nx-notif-act { opacity: 1; }
.nx-notif-act button {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(15,27,46,.1);
  background: #fff;
  color: #4D6E91;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: all .1s;
}
.nx-notif-act button:hover { border-color: #24B47E; color: #24B47E; }
.nx-notif-act button.nx-del:hover { border-color: #ef4444; color: #ef4444; }
.nx-notif-act svg { width: 13px; height: 13px; }

/* empty */
.nx-notif-empty { padding: 46px 20px 40px; text-align: center; }
.nx-empty-ic {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: rgba(15,27,46,.05);
  display: grid;
  place-items: center;
  color: #9AA1AA;
}
.nx-empty-ic svg { width: 26px; height: 26px; }
.nx-notif-empty b { display: block; font-size: 13.5px; color: #0F1B2E; margin-bottom: 4px; }
.nx-notif-empty p { font-size: 11.5px; color: #4D6E91; margin: 0; }

/* footer */
.nx-notif-ftr {
  padding: 10px 16px;
  border-top: 1px solid rgba(15,27,46,.07);
  text-align: center;
  flex-shrink: 0;
}
.nx-notif-ftr a {
  font-size: 12px;
  font-weight: 700;
  color: #24B47E;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .12s;
}
.nx-notif-ftr a:hover { color: #18995f; }
.nx-notif-ftr svg { width: 13px; height: 13px; }

/* ── Rich toasts (top-right) ── */
.nx-toasts {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.nx-toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 12px 13px;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(15,27,46,.1);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(15,27,46,.2);
  cursor: pointer;
  opacity: 0;
  transform: translateX(24px) scale(.97);
  transition: opacity .22s ease, transform .22s ease;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.nx-toast.nx-toast-in { opacity: 1; transform: none; }
.nx-toast.nx-toast-out { opacity: 0; transform: translateX(24px) scale(.97); }
.nx-toast::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #24B47E, #10b981);
  transform-origin: left;
  animation: nxToastBar 6s linear forwards;
}
.nx-toast:hover::after { animation-play-state: paused; }
.nx-toast-unread { border-color: rgba(36,180,126,.4); }

.nx-toast-ic {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nx-toast-ic svg { width: 19px; height: 19px; }

.nx-toast-body { flex: 1; min-width: 0; }
.nx-toast-title { font-size: 12.5px; font-weight: 800; color: #0F1B2E; line-height: 1.3; }
.nx-toast-msg {
  font-size: 11.5px;
  color: #2A2F36;
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nx-toast-time { font-size: 10px; color: #4D6E91; opacity: .85; margin-top: 4px; }
.nx-toast-close {
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(15,27,46,.06);
  border-radius: 6px;
  color: #4D6E91;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all .1s;
}
.nx-toast-close:hover { background: rgba(239,68,68,.12); color: #ef4444; }
.nx-toast-close svg { width: 12px; height: 12px; }

/* ── Mobile: full-screen sheet ── */
@media (max-width: 640px) {
  .nx-notif-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2,6,16,.5);
    backdrop-filter: blur(2px);
    z-index: 590;
    animation: nxFadeIn .18s ease;
  }
  .nx-notif-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    max-height: none;
    height: 100dvh;
    border-radius: 0;
    border: none;
    animation: nxSheetUp .24s cubic-bezier(.2,.9,.3,1);
  }
  .nx-notif-dropdown.nx-closing { animation: nxSheetDown .2s ease forwards; }
  .nx-notif-close { display: grid; }
  .nx-notif-body { flex: 1; }
  .nx-notif-hdr { padding-top: 18px; }
  .nx-toasts { top: 68px; right: 10px; width: calc(100vw - 20px); }
}
