/* ─────────────────────────────────────────────────────────
   Park Ministry — Notifications inbox styles
   ---------------------------------------------------------
   Self-contained. Reads design-tokens.css via var() with
   fallbacks so the module works standalone (admin/fan
   portals don't all load design-tokens today).

   Naming: every selector lives under .pm-notif-* so the
   module never collides with host portal classes. No
   global resets, no body modifications.

   Z-index strategy: drawer + backdrop sit at 9000/8999
   to escape any portal modal layer (which max out at
   ~3000 in existing CSS). If a future portal needs to
   stack ON TOP of notifications (e.g., a hard-blocking
   confirm), it must bump above 9001.
   ───────────────────────────────────────────────────────── */

/* ── Bell ────────────────────────────────────────────────── */
.pm-notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--navy-ink, #060d22);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.pm-notif-bell:hover {
  background: var(--paper-2, #f0ebe0);
  border-color: var(--paper-3, #d4cfc0);
}
.pm-notif-bell:focus-visible {
  outline: 2px solid var(--navy, #0a1530);
  outline-offset: 2px;
}
.pm-notif-bell svg { display: block; }

.pm-notif-bell--has-unread {
  color: var(--navy, #0a1530);
}
.pm-notif-bell--stalled {
  opacity: 0.6;
}
.pm-notif-bell--stalled::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning, #b8770a);
}

/* ── Badge ───────────────────────────────────────────────── */
.pm-notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger, #b3311f);
  color: var(--white, #ffffff);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  box-shadow: 0 0 0 2px var(--paper, #faf7f0);
}

/* ── Backdrop ────────────────────────────────────────────── */
.pm-notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 13, 34, 0.32);
  z-index: 8999;
  opacity: 0;
  transition: opacity 160ms ease;
}
.pm-notif-backdrop[hidden] { display: none !important; }
.pm-notif-backdrop:not([hidden]) { opacity: 1; }

/* ── Drawer ──────────────────────────────────────────────── */
.pm-notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--paper, #faf7f0);
  color: var(--navy-ink, #060d22);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--text-sm, 14px);
  border-left: 1px solid var(--paper-3, #d4cfc0);
  box-shadow: -8px 0 32px rgba(6, 13, 34, 0.18);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 200ms ease;
}
.pm-notif-drawer[hidden] { display: none !important; }
.pm-notif-drawer--open { transform: translateX(0); }

.pm-notif-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--paper-3, #d4cfc0);
  background: var(--paper-2, #f0ebe0);
}
.pm-notif-header h2 {
  flex: 1;
  margin: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--text-base, 16px);
  font-weight: 700;
  color: var(--navy-ink, #060d22);
}
.pm-notif-mark-all,
.pm-notif-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--slate, #6b7a8d);
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.pm-notif-mark-all:hover,
.pm-notif-close:hover {
  background: var(--paper-3, #d4cfc0);
  color: var(--navy-ink, #060d22);
}
.pm-notif-mark-all:focus-visible,
.pm-notif-close:focus-visible {
  outline: 2px solid var(--navy, #0a1530);
  outline-offset: 1px;
}
.pm-notif-close {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.pm-notif-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── List ────────────────────────────────────────────────── */
.pm-notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pm-notif-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 20px;
  border-bottom: 1px solid var(--paper-2, #f0ebe0);
  cursor: pointer;
  transition: background-color 120ms ease;
}
.pm-notif-row:hover {
  background: var(--paper-2, #f0ebe0);
}
.pm-notif-row--unread {
  background: rgba(46, 125, 246, 0.04);
}
.pm-notif-row--unread::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--navy, #0a1530);
  flex: 0 0 6px;
}
.pm-notif-row:not(.pm-notif-row--unread)::before {
  content: '';
  width: 6px;
  flex: 0 0 6px;
}
.pm-notif-row-main {
  flex: 1;
  min-width: 0;
}
.pm-notif-row-title {
  font-weight: 600;
  color: var(--navy-ink, #060d22);
  margin-bottom: 2px;
  line-height: 1.35;
}
.pm-notif-row-body {
  color: var(--slate, #6b7a8d);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 6px;
}
.pm-notif-row-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--slate-2, #8a96a6);
}
.pm-notif-kind {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.pm-notif-time { margin-left: auto; }

.pm-notif-row[data-severity="warning"] .pm-notif-row-title { color: var(--warning, #b8770a); }
.pm-notif-row[data-severity="error"]   .pm-notif-row-title { color: var(--danger, #b3311f); }

.pm-notif-row-action {
  flex: 0 0 auto;
  align-self: center;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy, #0a1530);
  background: var(--paper, #faf7f0);
  border: 1px solid var(--navy, #0a1530);
  border-radius: 6px;
  text-decoration: none;
}
.pm-notif-row-action:hover {
  background: var(--navy, #0a1530);
  color: var(--paper, #faf7f0);
}

/* ── Skeleton + empty + error ────────────────────────────── */
.pm-notif-skeleton[hidden] { display: none !important; }
.pm-notif-row--skeleton {
  height: 56px;
  background: linear-gradient(90deg, var(--paper-2, #f0ebe0) 0%, var(--paper-3, #d4cfc0) 50%, var(--paper-2, #f0ebe0) 100%);
  background-size: 200% 100%;
  animation: pm-notif-shimmer 1.4s linear infinite;
  margin: 4px 20px;
  border-radius: 6px;
}
@keyframes pm-notif-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pm-notif-empty,
.pm-notif-error {
  padding: 32px 20px;
  text-align: center;
  color: var(--slate, #6b7a8d);
  font-size: 14px;
}
.pm-notif-error {
  color: var(--danger, #b3311f);
  border-top: 1px solid var(--paper-3, #d4cfc0);
  margin-top: 8px;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pm-notif-drawer,
  .pm-notif-backdrop {
    transition: none;
  }
  .pm-notif-row--skeleton {
    animation: none;
  }
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .pm-notif-drawer {
    width: 100vw;
  }
}
