/* notifications.css — ATLAS Notification Center (Wave 10-W101).
 *
 * The top-bar bell (#btn-notifications) opens a single inbox panel
 * (#notif-center) aggregating every draft/alert surface.
 *
 * NO-SCROLL RULE (atlas-dashboard.md #3): the panel is position:fixed — it is
 * an OVERLAY and never participates in the .main-col flex flow, so the outer
 * 1080 frame is untouched. Only the panel's own list scrolls internally.
 *
 * BOTH THEMES (#4): every color is a theme var (--panel/--border/--text/
 * --accent/--good/--warn/--bad …) so light + dark + per-tenant brand theming
 * (W82, which overrides --accent*) all read correctly with zero hardcoded hues.
 */

/* ── bell badge (replaces the static "8") ───────────────────────────────── */
/* The bell reuses .sa-btn; we only need the live badge + a subtle unread cue. */
#notif-badge[hidden] { display: none !important; }
.sa-notif {
  position: relative;           /* anchor for the absolute-positioned badge */
}
.sa-notif[data-unread="1"] {
  border-color: rgba(var(--accent-rgb), .5);
  color: var(--accent);
}
.sa-notif .sa-badge {           /* live count pill — position: absolute overlay on bell */
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  border-radius: 8px;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

/* ── panel shell — SIDE PANEL (slides in from right) ─────────────────── */
.notif-center {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 92vw);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: -10px 0 40px rgba(0, 0, 0, .50);
  z-index: 1200;               /* above canvas; below full-screen modals */
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono, "JetBrains Mono", system-ui, sans-serif);
  animation: notif-slide-in 280ms cubic-bezier(.4,0,.2,1) both;
}
.notif-center[hidden] { display: none !important; }
.notif-center.is-closing {
  animation: notif-slide-out 240ms cubic-bezier(.4,0,.2,1) both;
}

@keyframes notif-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes notif-slide-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .notif-center,
  .notif-center.is-closing { animation: none; }
}

/* ── backdrop ────────────────────────────────────────────────────────────── */
.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  z-index: 1199;
  animation: notif-bd-in 280ms ease both;
}
.notif-backdrop[hidden] { display: none !important; }
.notif-backdrop.is-closing {
  animation: notif-bd-out 240ms ease both;
}
@keyframes notif-bd-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes notif-bd-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .notif-backdrop,
  .notif-backdrop.is-closing { animation: none; }
}

/* ── header ─────────────────────────────────────────────────────────────── */
.notif-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .05), transparent);
  flex-shrink: 0;
}
.notif-head .nh-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text);
}
.notif-head .nh-scope {
  font-size: 8.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 7px;
  border: 1px solid rgba(var(--accent-rgb), .3);
  border-radius: 999px;
}
.notif-head .nh-spacer { flex: 1; }
.notif-head .nh-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 8.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 8px;
  cursor: pointer;
  transition: all .14s;
}
.notif-head .nh-btn:hover:not(:disabled) { border-color: rgba(var(--accent-rgb), .45); color: var(--accent); }
.notif-head .nh-btn:disabled { opacity: .4; cursor: default; }
.notif-head .nh-close {
  width: 24px; height: 24px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
}

/* ── scroll body ────────────────────────────────────────────────────────── */
.notif-list {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: 4px 0 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), .3) transparent;
}
.notif-list::-webkit-scrollbar { width: 8px; }
.notif-list::-webkit-scrollbar-thumb {
  background: rgba(var(--accent-rgb), .25);
  border-radius: 8px;
}

/* ── source group ───────────────────────────────────────────────────────── */
.notif-group { padding: 2px 0; }
.notif-group + .notif-group { border-top: 1px solid var(--border2, var(--border)); }
.notif-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 4px;
}
.notif-group-head .ng-icon { font-size: 11px; line-height: 1; opacity: .9; }
.notif-group-head .ng-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: 1;
}
.notif-group-head .ng-count {
  font-size: 8px;
  font-weight: 700;
  background: var(--accent);
  color: var(--bg, #04080f);
  border-radius: 999px;
  min-width: 15px;
  text-align: center;
  padding: 1px 5px;
}
/* priority category chip (W441) — surfaces why an item ranks where it does */
.notif-group-head .ng-cat {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 5px;
  margin-right: 2px;
}
.notif-group-head .ng-cat-security { color: var(--bad);  border-color: rgba(var(--bad-rgb, 220,60,60), .5); }
.notif-group-head .ng-cat-deal     { color: var(--good); border-color: rgba(var(--good-rgb, 60,180,120), .5); }
.notif-group-head .ng-cat-client   { color: var(--accent); border-color: rgba(var(--accent-rgb), .45); }

/* ── item row ───────────────────────────────────────────────────────────── */
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 13px;
  position: relative;
  transition: background .12s;
}
.notif-row[data-url] { cursor: pointer; }
.notif-row[data-url]:hover { background: rgba(var(--accent-rgb), .07); }
.notif-row[data-url]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.notif-row .nr-dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
  background: var(--accent);
}
.notif-row.sev-warning .nr-dot  { background: var(--warn); }
.notif-row.sev-critical .nr-dot { background: var(--bad); }
.notif-row.sev-success .nr-dot  { background: var(--good, #3cb478); }

.notif-row .nr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-row .nr-title {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text);
  font-family: var(--sans, system-ui, sans-serif);
  word-break: break-word;
}
.notif-row .nr-sub {
  font-size: 8.5px;
  letter-spacing: .04em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.notif-row .nr-age {
  font-size: 8.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.notif-row .nr-read {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color .12s;
}
.notif-row .nr-read:hover:not(:disabled) { color: var(--accent); }
.notif-row .nr-read:disabled { color: var(--good); cursor: default; }

/* read items: dimmed, dot hollowed */
.notif-row.is-read { opacity: .5; }
.notif-row.is-read .nr-dot { background: transparent; border: 1px solid var(--text-muted); }

/* stub rows (not wired / unreachable / all clear) */
.notif-row.is-stub { padding: 6px 13px 9px; }
.notif-row.is-stub .nr-note {
  font-size: 9px;
  line-height: 1.45;
  color: var(--text-muted);
  font-style: italic;
}
.notif-row.is-stub.is-warn .nr-note { color: var(--warn); font-style: normal; }

/* ── footer ─────────────────────────────────────────────────────────────── */
.notif-foot {
  flex-shrink: 0;
  padding: 8px 13px;
  border-top: 1px solid var(--border);
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg2, transparent);
}

/* ── light theme: soften the side shadow ────────────────────────────────── */
[data-theme="light"] .notif-center {
  box-shadow: -8px 0 32px rgba(36, 66, 50, .18);
}
[data-theme="light"] .notif-backdrop {
  background: rgba(0, 0, 0, .18);
}
[data-theme="light"] .notif-group-head .ng-count { color: #fff; }

/* ── mobile — full-width side panel ──────────────────────────────────────── */
@media (max-width: 600px) {
  .notif-center {
    top: 0;
    right: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
  }
  /* let the 4 header actions wrap instead of overflowing a narrow panel */
  .notif-head { flex-wrap: wrap; row-gap: 6px; }
  .notif-head .nh-btn { font-size: 8px; padding: 4px 6px; }
  /* roomier tap targets for the per-row mark-read + bigger title on phones */
  .notif-row { padding: 10px 13px; }
  .notif-row .nr-read { font-size: 16px; padding: 0 6px; }
  .notif-row .nr-title { font-size: 12px; }
}
