/* ==========================================================================
   Notification bell (navbar)
   Shared by the public navbar and the dashboard/admin topbars.
   ========================================================================== */

.notif-menu {
    position: relative;
    flex-shrink: 0;
}

.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.notif-bell svg {
    width: 100%;
    height: 100%;
}

.notif-bell:hover,
.notif-bell[aria-expanded="true"] {
    background: rgba(128, 128, 128, .14);
    border-color: rgba(128, 128, 128, .25);
}

/* the unread counter */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #d94b4b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-sizing: border-box;
    pointer-events: none;
}

.notif-badge[hidden] {
    display: none;
}

/* ---- panel ------------------------------------------------------------- */

/*
 * The panel sits inside a DARK navbar, so every colour here is stated
 * explicitly — never inherited. Without an opaque background and an explicit
 * text colour the hero text shows through and the row titles render in the
 * navbar's white (i.e. invisible on white).
 */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: #fffefa !important;
    color: #252923 !important;
    border: 1px solid rgba(0, 0, 0, .1) !important;
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(20, 24, 18, .16), 0 0 0 1px rgba(20, 24, 18, .04);
    z-index: 320;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    isolation: isolate;
    text-align: left;
}

.notif-panel[hidden] {
    display: none;
}

.notif-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px 11px;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
}

.notif-panel-head strong {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .01em;
    color: #252923 !important;
}

.notif-panel-count {
    font-size: 11.5px;
    color: #7a756b !important;
}

/*
 * THE SCROLLABLE BOX
 * Fixed max height so any number of notifications stays contained; the list
 * scrolls inside instead of stretching the navbar or the page.
 */
.notif-list {
    max-height: 360px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #fffefa;
    color: #252923;
}

/* slim scrollbar (WebKit/Blink) */
.notif-list::-webkit-scrollbar {
    width: 8px;
}

.notif-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .16);
    border-radius: 8px;
}

.notif-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, .28);
}

.notif-list::-webkit-scrollbar-track {
    background: transparent;
}

/* Firefox */
.notif-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, .2) transparent;
}

/* ---- rows -------------------------------------------------------------- */

.notif-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 16px;
    text-decoration: none !important;
    /* explicit: the navbar this sits in is white-on-dark */
    color: #252923 !important;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    transition: background .15s ease;
    background: #fffefa;
}

.notif-row:last-child {
    border-bottom: 0;
}

.notif-row:hover {
    background: #f6f4ec;
}

.notif-row.is-unread {
    background: #fdf6df;
}

.notif-row.is-unread:hover {
    background: #faf0cc;
}

.notif-row.is-unread .notif-row-body strong::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: #e3b72f;
    vertical-align: middle;
}

.notif-row-ico {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(0, 0, 0, .05);
    color: #4a4a44;
}

.notif-row-ico svg {
    width: 16px;
    height: 16px;
}

.notif-row-body {
    flex: 1 1 auto;
    min-width: 0;
}

.notif-row-body strong {
    display: block;
    font-size: 12.8px;
    font-weight: 650;
    line-height: 1.35;
    overflow-wrap: anywhere;
    color: #1d211c !important;
}

.notif-row-body small {
    display: block;
    margin-top: 2px;
    font-size: 11.8px;
    color: #6f6a61 !important;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.notif-row-when {
    flex: 0 0 auto;
    font-size: 10.8px;
    color: #8d887e !important;
    white-space: nowrap;
    padding-top: 1px;
}

.notif-empty {
    margin: 0;
    padding: 26px 16px;
    text-align: center;
    font-size: 12.5px;
    color: #7a756b !important;
    background: #fffefa;
}

.notif-panel-foot {
    padding: 10px 16px;
    border-top: 1px solid rgba(0, 0, 0, .07);
    text-align: center;
}

.notif-panel-foot a {
    font-size: 12px;
    font-weight: 600;
    color: #252923;
    text-decoration: none;
}

.notif-panel-foot a:hover {
    text-decoration: underline;
}

/* ---- placement --------------------------------------------------------- */

/* sits between the nav links and the account burger on the public navbar */
.site-nav .notif-menu {
    margin-left: auto;
    margin-right: 4px;
}

/* on the dashboards the bell is a normal item in the topbar's right-hand row,
   next to the profile chip and the menu burger (no fixed positioning) */
.dash-body .notif-menu,
.admin-body .notif-menu {
    position: relative;
    margin-left: 0;
    margin-right: 0;
}

.dash-body .notif-bell,
.admin-body .notif-bell {
    background: #fffefa;
    border-color: var(--buai-border, #e4e5dc);
    color: var(--buai-text, #252923);
}

.dash-body .notif-panel,
.admin-body .notif-panel {
    top: 50px;
    right: 0;
}

/* dark navbar variant */
.market-nav .notif-bell {
    color: #f4f4f2;
}

.market-nav .notif-bell:hover,
.market-nav .notif-bell[aria-expanded="true"] {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .2);
}

/* ---- small screens ----------------------------------------------------- */

@media (max-width: 900px) {
    .notif-panel {
        position: fixed;
        top: 62px;
        right: 8px;
        width: min(330px, calc(100vw - 16px));
    }

    .notif-list {
        max-height: min(360px, calc(100vh - 180px));
    }

    .dash-body .notif-panel,
    .admin-body .notif-panel {
        top: 62px;
        right: 8px;
    }
}
