/* Notifications under the bell (.nf-*): site navbar (students, educators, organizations)
 * and the admin header. One quiet list; the accent is spent on the unread dot and the
 * count on the bell. Motion: the bell rings once when there is something unread, and
 * the panel drops in when it opens. Nothing loops.
 */

.nf-scope {
    --nf-accent: var(--theme-color, #af990a);
    --nf-accent-soft: color-mix(in srgb, var(--nf-accent) 10%, #fff);
    --nf-ink: #1f2430;
    --nf-muted: #687083;
    --nf-line: #ebe8e0;
    --nf-hover: #f8f7f3;
    --nf-badge: #d92d20;
}
.admin-notification-menu.nf-scope {
    --nf-accent: var(--aui-brand, #25441f);
    --nf-line: #e4e6eb;
    --nf-hover: #f6f7fa;
}

/* ---------- The bell ---------- */
.nf-bell { position: relative; }
.nf-bell svg { display: block; transform-origin: 50% 3px; }
.nf-scope.has-unread .nf-bell svg { animation: nf-ring 1.1s cubic-bezier(.36, .07, .19, .97) .8s 1 both; }
.nf-badge { position: absolute; top: -6px; right: -8px; min-width: 19px; height: 19px; padding: 0 5px; display: inline-grid; place-items: center;
    border-radius: 999px; background: var(--nf-badge); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
    font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px #fff; pointer-events: none;
    animation: nf-pop .4s cubic-bezier(.3, 1.5, .5, 1) .6s both; }
.direction-rtl .nf-badge { right: auto; left: -8px; }
.nf-bell:focus-visible { outline: 3px solid color-mix(in srgb, var(--nf-accent) 55%, #fff) !important; outline-offset: 2px; }

/* ---------- The panel ---------- */
.nf-scope .nf-panel { width: 380px; max-width: calc(100vw - 24px); min-width: 0; padding: 0 !important; overflow: hidden; border: 0 !important;
    border-radius: 18px !important; background: #fff; box-shadow: 0 18px 48px -12px rgba(16, 24, 40, .28), 0 0 0 1px rgba(16, 24, 40, .06) !important;
    transform-origin: top right; }
.direction-rtl .nf-scope .nf-panel { transform-origin: top left; }
/* It is shown by hover (desktop navbar), .show (Bootstrap) or .nf-open (tap / keyboard) */
.nf-scope:hover > .nf-panel, .nf-scope .nf-panel.show, .nf-scope.nf-open > .nf-panel { animation: nf-drop .2s cubic-bezier(.2, .8, .3, 1) both; }
.nf-scope.nf-open > .nf-panel { display: block; }

.nf-panel__head { padding: 18px 20px 12px; }
.nf-panel__title { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--nf-ink); }
.nf-panel__sub { margin: 2px 0 0; font-size: 13px; color: var(--nf-muted); }

/* Tabs (educators / organizations): a segmented control whose highlight slides */
.nf-tabs { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); margin: 0 16px 6px; padding: 4px; border-radius: 12px;
    background: var(--nf-hover); box-shadow: 0 0 0 1px var(--nf-line) inset; }
.nf-tabs__thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n)); border-radius: 9px; background: #fff;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .12), 0 0 0 1px rgba(16, 24, 40, .04); transform: translateX(calc(100% * var(--at)));
    transition: transform .3s cubic-bezier(.3, 1.25, .5, 1); }
.direction-rtl .nf-tabs__thumb { left: auto; right: 4px; transform: translateX(calc(-100% * var(--at))); }
.nf-tab { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 10px;
    border: 0; background: transparent; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--nf-muted); cursor: pointer;
    transition: color .2s ease; }
.nf-tab.is-active { color: var(--nf-ink); }
.nf-tab:focus-visible { outline: 2px solid var(--nf-accent); outline-offset: 1px; }
.nf-tab__count { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--nf-badge);
    color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nf-pane.is-in { animation: nf-fade .22s ease both; }

.nf-caught { display: flex; align-items: center; gap: 8px; margin: 8px 16px 2px; padding: 10px 12px; border-radius: 12px; background: var(--nf-accent-soft);
    color: color-mix(in srgb, var(--nf-accent) 75%, #1a1300); font-size: 13.5px; font-weight: 700; }
.nf-panel__foot { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--nf-line); display: flex; justify-content: center; }
.nf-panel__foot .nf-link-btn { width: 100%; justify-content: center; min-height: 40px; }
.nf-scope .nf-item.is-read .nf-item__name { font-weight: 600; color: #4a5263; }
.nf-scope .nf-item.is-read .nf-item__text { color: var(--nf-muted); }
.nf-scope .nf-item.is-read .nf-item__img { filter: saturate(.6); opacity: .85; }
.nf-link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px;
    background: var(--nf-accent-soft); color: color-mix(in srgb, var(--nf-accent) 75%, #1a1300); font-size: 13px; font-weight: 700;
    white-space: nowrap; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.nf-link-btn:hover { background: var(--nf-accent); color: #fff; }
.nf-link-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--nf-accent) 55%, #fff); outline-offset: 2px; }

.nf-panel__body { max-height: min(420px, 60vh); overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 10px; }
.nf-group { margin: 0; padding: 12px 20px 4px; font-size: 12.5px; font-weight: 700; color: var(--nf-muted); }
.nf-list { margin: 0; padding: 0 8px; list-style: none; }

.nf-scope .nf-item { position: relative; display: flex; align-items: flex-start; gap: 12px; width: 100%; margin: 0; padding: 10px 28px 10px 12px !important;
    border: 0; border-radius: 12px; background: transparent; color: var(--nf-ink) !important; text-align: start; text-decoration: none !important;
    white-space: normal; cursor: pointer; transition: background-color .15s ease; }
.nf-scope .nf-item:hover { background: var(--nf-hover); }
.nf-scope .nf-item:focus-visible { outline: 2px solid var(--nf-accent); outline-offset: -2px; }
.nf-scope .nf-item:active { background: var(--nf-accent-soft); }
.nf-item__img { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--nf-hover);
    box-shadow: 0 0 0 1px rgba(16, 24, 40, .06); }
.nf-item__body { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.nf-item__name { font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--nf-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-item__text { font-size: 13.5px; line-height: 1.45; color: #4a5263; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; overflow-wrap: anywhere; }
.nf-item__time { margin-top: 2px; font-size: 12px; color: var(--nf-muted); }
.nf-item__dot { position: absolute; top: 18px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--nf-accent); }
.direction-rtl .nf-item__dot { right: auto; left: 12px; }
.direction-rtl .nf-scope .nf-item { padding: 10px 12px 10px 28px !important; }

.nf-empty { display: grid; justify-items: center; gap: 4px; padding: 34px 28px 36px; text-align: center; }
.nf-empty__icon { width: 60px; height: 60px; margin-bottom: 8px; display: grid; place-items: center; border-radius: 50%;
    background: var(--nf-accent-soft); color: var(--nf-accent); }
.nf-empty__title { margin: 0; font-size: 15px; font-weight: 800; color: var(--nf-ink); }
.nf-empty__text { margin: 0; max-width: 30ch; font-size: 13.5px; line-height: 1.5; color: var(--nf-muted); }

/* The admin header styles every dropdown link, image and span; win those back. */
.header__menu .nf-panel li a.nf-item { display: flex; align-items: flex-start; border-radius: 12px; }
.header__menu .nf-panel li a .nf-item__img { width: 40px; height: 40px; }
.header__menu .nf-panel li a .nf-item__body { display: grid; margin: 0; line-height: normal; }
.header__menu .nf-panel li a .nf-item__name { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--nf-ink); }
.header__menu .nf-panel li a .nf-item__text { margin: 0; font-size: 13.5px; font-weight: 400; line-height: 1.45; color: #4a5263; }
.header__menu .nf-panel li a .nf-item__dot { margin: 0; }
.header__menu .nf-panel .nf-list li { margin: 0; }
.admin-notification-menu .nf-bell { position: relative; }
.admin-notification-menu .nf-badge { top: -7px; right: -9px; }

/* ---------- The preview (tap a notification) ----------
 * It answers a tap, so it may move: the card rises in, the picture pops, then the
 * name, the message and the buttons follow one after another. */
.nf-modal { --nf-m: var(--aui-brand, var(--theme-color, #af990a)); --nf-m-soft: color-mix(in srgb, var(--nf-m) 12%, #fff); }
.nf-modal .modal-dialog { max-width: 460px; padding: 0 12px; }
.nf-modal .modal-content { position: relative; border: 0; border-radius: 24px; padding: 0; overflow: hidden; background: #fff;
    box-shadow: 0 30px 70px -20px rgba(16, 24, 40, .45); }
.nf-modal__close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 34px; height: 34px; padding: 0; border-radius: 50%;
    background-color: rgba(255, 255, 255, .85); background-size: 11px; opacity: .75; transition: opacity .2s ease, transform .2s ease; }
.nf-modal__close:hover { opacity: 1; transform: rotate(90deg); }
.direction-rtl .nf-modal__close { right: auto; left: 14px; }
.nf-modal__top { display: flex; align-items: center; gap: 16px; padding: 28px 56px 20px 24px;
    background: linear-gradient(180deg, var(--nf-m-soft), #fff); }
.nf-modal__img { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #fff;
    box-shadow: 0 0 0 4px #fff, 0 0 0 6px color-mix(in srgb, var(--nf-m) 35%, #fff); }
.nf-modal.is-read .nf-modal__img { box-shadow: 0 0 0 4px #fff, 0 0 0 6px #e3e5ea; }
.nf-modal__who { min-width: 0; flex: 1 1 auto; }
.nf-modal__who h5 { margin: 0 0 6px; font-size: 18px; font-weight: 800; line-height: 1.3; color: #1f2430; overflow-wrap: anywhere; text-wrap: balance; }
.nf-modal__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.nf-chip { padding: 3px 10px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px color-mix(in srgb, var(--nf-m) 30%, #fff) inset;
    color: color-mix(in srgb, var(--nf-m) 75%, #1a1300); font-size: 12px; font-weight: 700; }
.nf-modal__time { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #687083; }
.nf-modal__text { margin: 0; padding: 4px 24px 6px; max-height: 45vh; overflow-y: auto; font-size: 15.5px; line-height: 1.65; color: #39404f; overflow-wrap: anywhere; }
.nf-modal__text p:last-child { margin-bottom: 0; }
.nf-modal__text a { color: color-mix(in srgb, var(--nf-m) 80%, #000); text-decoration: underline; }
.nf-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px 24px; }
.nf-modal__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border: 0; border-radius: 999px;
    font-size: 15px; font-weight: 700; text-decoration: none !important; cursor: pointer; transition: background-color .2s ease, box-shadow .2s ease, transform .15s ease; }
.nf-modal__btn:active { transform: scale(.97); }
.nf-modal__btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--nf-m) 50%, #fff); outline-offset: 2px; }
.nf-modal__btn--quiet { background: transparent; color: #1f2430 !important; box-shadow: 0 0 0 1px #e1ddd2 inset; }
.nf-modal__btn--quiet:hover { box-shadow: 0 0 0 1px var(--nf-m) inset; }
.nf-modal__btn--primary { background: var(--nf-m); color: #fff !important; }
.nf-modal__btn--primary:hover { background: color-mix(in srgb, var(--nf-m) 86%, #000); }
.nf-modal__btn--primary svg { transition: transform .2s ease; }
.nf-modal__btn--primary:hover svg { transform: translate(2px, -2px); }

.nf-modal.fade .modal-dialog { transform: translateY(24px) scale(.94); opacity: 0; transition: transform .38s cubic-bezier(.2, 1.2, .4, 1), opacity .2s ease; }
.nf-modal.show .modal-dialog { transform: none; opacity: 1; }
.nf-modal.show .nf-modal__img { animation: nf-pop .45s cubic-bezier(.3, 1.5, .5, 1) .1s both; }
.nf-modal.show .nf-modal__who { animation: nf-rise .35s cubic-bezier(.2, .8, .3, 1) .16s both; }
.nf-modal.show .nf-modal__text { animation: nf-rise .35s cubic-bezier(.2, .8, .3, 1) .22s both; }
.nf-modal.show .nf-modal__foot { animation: nf-rise .35s cubic-bezier(.2, .8, .3, 1) .28s both; }
@media (max-width: 575.98px) {
    .nf-modal .modal-dialog { margin: 0; min-height: 100%; display: flex; align-items: flex-end; padding: 0; }
    .nf-modal .modal-content { border-radius: 24px 24px 0 0; }
    .nf-modal.fade .modal-dialog { transform: translateY(100%); opacity: 1; }
    .nf-modal__foot { flex-direction: column-reverse; }
    .nf-modal__btn { width: 100%; }
}

@keyframes nf-ring {
    0%, 100% { transform: rotate(0); }
    10% { transform: rotate(14deg); } 22% { transform: rotate(-12deg); } 34% { transform: rotate(9deg); }
    46% { transform: rotate(-6deg); } 58% { transform: rotate(3deg); } 70% { transform: rotate(-1deg); }
}
@keyframes nf-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes nf-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes nf-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes nf-drop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* In the phone menu the panel sits inside the open menu, full width */
@media (max-width: 991.98px) {
    .menu-notification-btn.nf-scope .nf-panel { position: static !important; width: 100%; max-width: none; margin-top: 8px; transform: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .nf-scope *, .nf-scope .nf-panel, .nf-modal .modal-dialog, .nf-modal * { animation: none !important; transition: none !important; }
}

/* A live notification just arrived: the badge pops once with its new number. */
.nf-badge.nf-bump { animation: nf-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@media (prefers-reduced-motion: reduce) { .nf-badge.nf-bump { animation: none; } }
