/* ─────────────────────────────────────────────────────────────────────────
   PipChat! Web — Notifications: the nav bell + popover, and the /notifications
   inbox.

   One rule carries the look: every notification has a --nt tone taken from its
   own type, and the icon tile, the kind label, the unread wash and the left
   rail all inherit it. A list of forty reads as a coloured index rather than
   forty identical grey rows.

   Reminder (see app.css): icons are inline <svg> with a viewBox and no
   width/height, so every component here declares its own svg size.
   ───────────────────────────────────────────────────────────────────────── */

.nt-orange { --nt: var(--orange);       --nt-soft: var(--orange-soft);    --nt-ink: var(--orange-deep); }
.nt-blue   { --nt: var(--blue);         --nt-soft: var(--blue-soft);      --nt-ink: var(--type-biz-2); }
.nt-green  { --nt: var(--green);        --nt-soft: var(--green-soft);     --nt-ink: var(--green); }
.nt-amber  { --nt: var(--amber);        --nt-soft: var(--amber-soft);     --nt-ink: #9A5F00; }
.nt-red    { --nt: var(--red);          --nt-soft: var(--red-soft);       --nt-ink: var(--red); }
.nt-violet { --nt: var(--type-gov);     --nt-soft: var(--type-gov-soft);  --nt-ink: var(--type-gov-2); }
.nt-pink   { --nt: #DB2777;             --nt-soft: #FCE7F3;               --nt-ink: #9D174D; }
.nt-cyan   { --nt: #0891B2;             --nt-soft: #DDF2F8;               --nt-ink: #0E7490; }
.nt-grey   { --nt: var(--subtle);       --nt-soft: var(--bg-2);           --nt-ink: var(--muted); }

/* ── Nav bell ─────────────────────────────────────────────────────────── */
/* The button itself is a .tray-btn (app.css) — shared with Messages and Cart so
   the three read as one control family. Only the unread fill and the popover
   anchoring are bell-specific. */
.bell { position: relative; flex-shrink: 0; }
/* A warm fill while something is waiting — the cue that the count belongs to
   this control. Declared after .tray-btn:hover so it wins at equal specificity,
   with its own hover to keep the control feeling live. */
.bell-btn.has-unread {
  color: var(--ink); background: var(--orange-soft);
  border-color: color-mix(in srgb, var(--orange) 22%, #fff);
}
.bell-btn.has-unread:hover { background: color-mix(in srgb, var(--orange) 22%, #fff); }

.bell-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 384px;
  background: var(--paper); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); z-index: 70; display: none; overflow: hidden;
}
.bell-menu.open { display: block; animation: bell-in .18s cubic-bezier(.2,.9,.3,1); }
@keyframes bell-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

.bell-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--divider); background: var(--bg-2);
}
.bell-head h3 { font-size: 13.5px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; flex: 1; }
.bell-all {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted);
  transition: background .12s, color .12s;
}
.bell-all:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.bell-all:disabled { opacity: .5; cursor: default; }
.bell-all svg { width: 14px; height: 14px; }

.bell-body { max-height: min(440px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.bell-skel { padding: 6px 0; }

.bp-row {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 16px;
  border-bottom: 1px solid var(--divider); position: relative;
  transition: background .12s;
}
.bp-row:last-child { border-bottom: none; }
a.bp-row:hover { background: var(--bg-2); }
.bp-row.is-unread { background: color-mix(in srgb, var(--nt) 5%, var(--paper)); }
a.bp-row.is-unread:hover { background: color-mix(in srgb, var(--nt) 9%, var(--paper)); }
.bp-ic {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--nt-soft); color: var(--nt-ink);
}
.bp-ic svg { width: 16px; height: 16px; }
.bp-skel-ic { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; }
.bp-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bp-kind {
  font-size: 10px; font-weight: 800; color: var(--nt-ink);
  text-transform: uppercase; letter-spacing: .07em;
}
.bp-title {
  font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bp-msg {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bp-time { font-size: 11.5px; color: var(--subtle); font-weight: 600; margin-top: 2px; }
.bp-dot {
  width: 8px; height: 8px; border-radius: 999px; background: var(--nt);
  flex-shrink: 0; margin-top: 12px;
}

.bell-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 40px 26px; text-align: center;
}
.bell-empty-ic {
  width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center;
  background: var(--bg-2); color: var(--subtle); margin-bottom: 4px;
}
.bell-empty-ic svg { width: 21px; height: 21px; }
.bell-empty b { font-size: 14px; font-weight: 800; color: var(--ink); }
.bell-empty span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.bell-foot {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 16px; border-top: 1px solid var(--divider); background: var(--bg-2);
  font-size: 13px; font-weight: 700; color: var(--ink);
}
.bell-foot:hover { background: var(--divider); }
.bell-foot svg { width: 14px; height: 14px; color: var(--muted); }

/* ── Needs-action strip ───────────────────────────────────────────────── */
.ntf-actions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.nta {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px;
  background: var(--paper); border: 1px solid var(--hairline); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
a.nta:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--nt) 40%, var(--hairline)); }
.nta.is-static { cursor: default; }
.nta-ic {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--nt-soft); color: var(--nt-ink);
}
.nta-ic svg { width: 19px; height: 19px; }
.nta-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.nta-count {
  font-size: 21px; font-weight: 900; color: var(--ink);
  letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.nta-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.nta-go { color: var(--subtle); flex-shrink: 0; }
.nta-go svg { width: 16px; height: 16px; }

/* ── Inbox list ───────────────────────────────────────────────────────── */
.ntf-head { align-items: center; }

/* `clip`, not `hidden`. Same reason as body in app.css: hidden would make this
   a scroll container and the sticky day headers below would stick to it — i.e.
   never move — instead of to the viewport. */
.ntf-list {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: clip;
}

.ntf-day {
  position: sticky; top: var(--nav-h); z-index: 4;
  padding: 9px 18px; font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  background: rgba(251,250,248,.92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--divider); border-top: 1px solid var(--divider);
}
.ntf-day:first-child { border-top: none; }

.ntf {
  position: relative; display: flex; align-items: flex-start; gap: 13px;
  padding: 15px 18px 15px 20px; border-bottom: 1px solid var(--divider);
  transition: background .13s;
}
.ntf:last-child { border-bottom: none; }
.ntf:hover { background: var(--bg-2); }
.ntf.is-unread { background: color-mix(in srgb, var(--nt) 4%, var(--paper)); }
.ntf.is-unread:hover { background: color-mix(in srgb, var(--nt) 8%, var(--paper)); }

/* The rail is the fastest read on the page: colour says what kind of thing
   happened, presence says it is still unread. */
.ntf-rail {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--nt); opacity: 0; transition: opacity .13s;
}
.ntf.is-unread .ntf-rail { opacity: 1; }

.ntf-ic {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--nt-soft); color: var(--nt-ink);
}
.ntf-ic svg { width: 19px; height: 19px; }
.ntf-skel-ic { width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0; }

.ntf-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
a.ntf-main:hover .ntf-title { color: var(--nt-ink); }

.ntf-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ntf-kind {
  font-size: 10.5px; font-weight: 800; color: var(--nt-ink);
  text-transform: uppercase; letter-spacing: .07em;
}
.ntf-new {
  font-size: 9.5px; font-weight: 900; color: #fff; background: var(--nt);
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em;
}
.ntf-time { font-size: 11.5px; color: var(--subtle); font-weight: 600; margin-left: auto; }
.ntf-title {
  font-size: 14.5px; font-weight: 800; color: var(--ink);
  letter-spacing: -.012em; line-height: 1.35; overflow-wrap: anywhere;
  transition: color .12s;
}
.ntf-msg {
  font-size: 13.5px; color: var(--body); line-height: 1.5; overflow-wrap: anywhere;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.ntf-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 5px; }
.ntf-actor { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.ntf-actor b { color: var(--body); font-weight: 700; }
.ntf-app {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; background: var(--bg-2); border: 1px solid var(--hairline);
  font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.ntf-app:hover { background: var(--paper); color: var(--ink); border-color: var(--subtle); }
.ntf-app svg { width: 12px; height: 12px; }

/* Row actions stay out of the way on a mouse and stay put on touch, where
   there is no hover to reveal them. */
.ntf-acts { display: flex; align-items: center; gap: 4px; flex-shrink: 0; opacity: 0; transition: opacity .13s; }
.ntf:hover .ntf-acts, .ntf:focus-within .ntf-acts { opacity: 1; }
.ntf-act {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  color: var(--muted); transition: background .12s, color .12s;
}
.ntf-act:hover { background: var(--divider); color: var(--ink); }
.ntf-act.danger:hover { background: var(--red-soft); color: var(--red); }
.ntf-act svg { width: 15px; height: 15px; }
.ntf-act:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, #fff); outline-offset: 1px; }

.ntf.is-skel { pointer-events: none; }
.ntf.is-skel .ntf-main { gap: 0; padding-top: 3px; }

.ntf-end { text-align: center; color: var(--subtle); font-size: 12.5px; margin-top: 18px; }

a.ntf-main:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, #fff);
  outline-offset: 3px; border-radius: 6px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Anchored to the button, a 384px panel would hang off the left of a 360px
     screen. Below this width it becomes a full-width sheet under the nav
     instead — the account menu next to it stays exactly as it was. */
  .bell { position: static; }
  .bell-menu {
    position: fixed; left: 8px; right: 8px; width: auto;
    top: calc(var(--nav-h) + 8px);
  }
  .bell-body { max-height: 62vh; }

  .ntf { padding: 13px 12px 13px 15px; gap: 11px; }
  .ntf-day { padding-left: 15px; }
  .ntf-ic { width: 34px; height: 34px; border-radius: 11px; }
  .ntf-ic svg { width: 16px; height: 16px; }
  .ntf-title { font-size: 14px; }
  .ntf-msg { font-size: 13px; -webkit-line-clamp: 2; }
  /* No hover on touch, so the actions have to be visible to be usable. */
  .ntf-acts { opacity: 1; }
  .ntf-time { margin-left: 0; }
  .ntf-actions { grid-template-columns: 1fr; gap: 10px; }
}

@media (pointer: coarse) {
  .ntf-acts { opacity: 1; }
  .ntf-act { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .bell-menu.open { animation: none; }
  a.nta:hover { transform: none; }
}
