/* Notification bell + dropdown (js/notifications.js). Colours come from the
   css/base.css variables so it follows the theme toggle. The dropdown is a
   popover like the account menu; the list inside is plain rows with dividers. */

.notif { position: relative; display: inline-flex; }

.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.notif-bell:hover,
.notif.open .notif-bell { background: var(--surface-2); color: var(--text); }
.notif-bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.notif-count {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--sp-1);
  border-radius: 8px;
  background: var(--danger);
  /* --on-danger: white on the light theme's red, dark on the dark theme's
     light red (#fff there was 2.9:1; issue #16 F-34). */
  color: var(--on-danger);
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: var(--lh);
  text-align: center;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 30;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 35, 59, 0.14);
  animation: rise 0.13s ease both;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.notif-heading { font-weight: 600; font-size: var(--fs-sm); }

.notif-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--fs-xs);
  min-height: 24px;
  cursor: pointer;
}
.notif-link:hover { text-decoration: underline; }
.notif-link:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item + .notif-item { border-top: 1px solid var(--border); }

.notif-open {
  display: flex;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.notif-open:hover { background: var(--surface-2); }

.notif-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  /* Centres the 7px dot on the title's first line: an alignment offset,
     not a spacing step, so it stays literal. */
  margin-top: 6px;
  border-radius: 50%;
  background: transparent;
}
.notif-item.unread .notif-dot { background: var(--accent); }

.notif-text { display: flex; flex-direction: column; gap: var(--sp-0); min-width: 0; }
.notif-title { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.notif-item.unread .notif-title { font-weight: 600; }
.notif-body {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-meta { font-size: var(--fs-2xs); color: var(--text-muted); }

.notif-empty { margin: 0; padding: var(--sp-4) var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
/* A failed load is not "nothing new" (issue #16 F-95): danger colour and a
   Retry that runs the same load again. */
.notif-empty.notif-error { color: var(--danger); display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-2); }
.notif-retry { font-size: var(--fs-sm); }

.notif-push { padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border); }

/* Phones: full width of the top bar's gutter, opening below the bar (and so
   below the bell) instead of over it. .topbar is the positioned ancestor. */
@media (max-width: 760px) {
  .notif { position: static; }
  .notif-panel { position: absolute; top: calc(100% + 6px); right: var(--gutter); left: var(--gutter); width: auto; max-width: none; }
}
