/* ── In-app notifications: the bell and its panel (admin topbar, teacher header) ── */
.notif-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-wrap[hidden] { display: none; }
.notif-wrap .notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); cursor: pointer;
}
.notif-wrap .notif-bell:hover { background: var(--card-hover); }
.notif-wrap .notif-bell:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.notif-bell svg { width: 20px; height: 20px; }
.notif-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; pointer-events: none;
}
.notif-count[hidden] { display: none; }

.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000;
  width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 520px);
  display: flex; flex-direction: column; overflow: hidden; text-align: left;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-head h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.notif-panel .notif-markall {
  width: auto; border: 0; border-radius: 6px; background: none; color: var(--primary);
  font-size: 13px; font-weight: 600; padding: 4px 6px; cursor: pointer;
}
.notif-panel .notif-markall:disabled { color: var(--text-faint); cursor: default; }
.notif-actions { display: inline-flex; align-items: center; gap: 4px; }
.notif-panel .notif-close {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--text-muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.notif-panel .notif-close:hover { background: var(--card-hover); color: var(--text); }
.notif-panel .notif-markall:focus-visible, .notif-panel .notif-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.notif-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.notif-panel .notif-item {
  position: relative; display: grid; gap: 2px; width: 100%; margin: 0; padding: 10px 16px 10px 30px;
  border: 0; border-bottom: 1px solid var(--border-light); border-radius: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.notif-panel .notif-item:hover, .notif-panel .notif-item:focus-visible { background: var(--card-hover); outline: none; }
.notif-panel .notif-item:focus-visible { box-shadow: inset 3px 0 0 var(--primary); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 13px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.notif-title { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-body {
  font-size: 13px; color: var(--text-secondary); white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-time { font-size: 12px; color: var(--text-muted); }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }

@media (max-width: 639px) {
  /* --notif-top is set from the bell's position when the panel opens, so the
     panel sits under the bell in the admin topbar and the taller teacher header. */
  .notif-panel {
    position: fixed; left: 16px; right: 16px; top: var(--notif-top, 64px); width: auto;
    max-height: max(200px, calc(100vh - var(--notif-top, 64px) - 16px));
  }
}
