/* P3KPI - Notifikasi: lonceng topbar (CMS & Portal Anggota), halaman "Semua notifikasi",
 * dan tombol Pasang Aplikasi / Aktifkan Notifikasi di halaman login.
 * Token warna (--brand, --line, dst.) mengikuti cms/theme.css & portal/member-area.css (dengan fallback). */

/* ---------- Lonceng ---------- */
.notif-bell { position: relative; flex-shrink: 0; --notif-top: 4.25rem; }
.notif-bell[data-variant="portal"] { margin-left: auto; --notif-top: var(--topbar-h, 4rem); }
.notif-bell[data-variant="portal"] + .mp-user { margin-left: 0; }
.notif-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid var(--line, #e3e8ef);
    border-radius: 50%;
    background: var(--surface, #fff);
    color: var(--ink-2, #3c4a5e);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.notif-bell-btn:hover { background: var(--canvas, #f4f6fa); color: var(--ink, #142033); }
.notif-bell-btn:focus { outline: 0; box-shadow: 0 0 0 3px rgba(0, 89, 173, .18); }
.notif-bell-btn::after { display: none; }
.notif-bell.has-unread .notif-bell-btn { color: var(--brand, #0059ad); }
.notif-badge {
    /* Ukuran px tetap agar tidak membesar mengikuti font dasar & tidak menutupi ikon lonceng */
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger, #c0392b);
    color: #fff;
    border: 1.5px solid var(--surface, #fff);
    font-size: 10px;
    font-weight: 700;
    line-height: 13px;
    letter-spacing: 0;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
    pointer-events: none;
}
.notif-badge[hidden] { display: none; }

/* ---------- Dropdown ---------- */
.notif-menu.dropdown-menu {
    width: 22rem;
    max-width: calc(100vw - 1.5rem);
    padding: 0 !important;
    margin-top: .45rem;
    border: 1px solid var(--line, #e3e8ef);
    border-radius: var(--radius-sm, 8px);
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(10, 31, 60, .12));
    overflow: hidden;
    font-size: var(--fs-base, .875rem);
}
.notif-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--line-2, #eef1f6);
}
.notif-menu-head strong { color: var(--ink, #142033); font-size: var(--fs-base, .875rem); }
.notif-link {
    border: 0;
    background: none;
    padding: 0;
    color: var(--brand, #0059ad);
    font-size: var(--fs-xs, .72rem);
    font-weight: 600;
    cursor: pointer;
}
.notif-link:hover { text-decoration: underline; }
.notif-link[hidden] { display: none; }
.notif-menu .notif-list { max-height: min(26rem, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.notif-menu-foot {
    display: block;
    padding: .65rem 1rem;
    border-top: 1px solid var(--line-2, #eef1f6);
    text-align: center;
    font-weight: 600;
    font-size: var(--fs-sm, .8rem);
    color: var(--brand, #0059ad) !important;
    text-decoration: none !important;
}
.notif-menu-foot:hover { background: var(--canvas, #f4f6fa); }

/* ---------- Item ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list > li + li { border-top: 1px solid var(--line-2, #eef1f6); }
.notif-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    color: var(--ink-2, #3c4a5e) !important;
    text-decoration: none !important;
    white-space: normal;
}
.notif-item:hover, .notif-item:focus { background: var(--canvas, #f4f6fa); outline: 0; }
.notif-item.is-unread { background: var(--brand-50, #eef5fc); }
.notif-item.is-unread:hover { background: var(--brand-100, #d9e8f7); }
.notif-icon {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    background: var(--info-bg, #e8f3fb);
    color: var(--info, #1c7bb8);
}
.notif-icon.tone-success { background: var(--success-bg, #e7f5ee); color: var(--success, #1f8a5b); }
.notif-icon.tone-warning { background: var(--warning-bg, #fdf4e3); color: var(--warning, #b7791f); }
.notif-icon.tone-danger { background: var(--danger-bg, #fbeceb); color: var(--danger, #c0392b); }
.notif-text { min-width: 0; flex: 1; line-height: 1.35; }
.notif-text strong { display: block; color: var(--ink, #142033); font-weight: 600; font-size: var(--fs-sm, .8rem); }
.notif-item:not(.is-unread) .notif-text strong { font-weight: 500; }
.notif-body {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: .1rem;
    color: var(--muted, #6b778a);
    font-size: var(--fs-xs, .72rem);
}
.notif-text time { display: block; margin-top: .2rem; color: var(--muted, #6b778a); font-size: .68rem; }
.notif-dot {
    flex-shrink: 0;
    width: .5rem;
    height: .5rem;
    margin-top: .45rem;
    border-radius: 50%;
    background: var(--brand, #0059ad);
}
.notif-empty, .notif-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted, #6b778a);
    font-size: var(--fs-sm, .8rem);
}
.notif-empty i { display: block; font-size: 2rem; margin-bottom: .4rem; opacity: .6; }
.notif-empty p { margin: 0; }

/* ---------- Halaman Semua notifikasi ---------- */
.notif-page .notif-list-page .notif-item { padding: .9rem 1.25rem; }
.notif-page .notif-list-page .notif-body { -webkit-line-clamp: unset; display: block; }
.notif-page .card-header h5 { font-size: var(--fs-md, 1rem); }
.notif-push-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .85rem 1.25rem;
    background: var(--canvas, #f4f6fa);
    border-bottom: 1px solid var(--line, #e3e8ef);
}
.notif-push-row[hidden] { display: none; }
.notif-push-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg, #e6f1fd);
    color: var(--brand, #0059ad);
    font-size: 1.1rem;
}
.notif-push-text { flex: 1; min-width: 12rem; line-height: 1.3; }
.notif-push-text strong { display: block; font-size: var(--fs-sm, .8rem); color: var(--ink, #142033); }
.notif-push-text small { color: var(--muted, #6b778a); font-size: var(--fs-xs, .72rem); }

/* Mobile: dropdown selebar layar tepat di bawah topbar */
@media (max-width: 575.98px) {
    .notif-bell-btn { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
    .notif-menu.dropdown-menu {
        position: fixed !important;
        top: calc(var(--notif-top) + env(safe-area-inset-top, 0px)) !important;
        left: .5rem !important;
        right: .5rem !important;
        width: auto;
        max-width: none;
        transform: none !important;
        margin-top: .25rem;
    }
    .notif-menu .notif-list { max-height: calc(100vh - var(--notif-top) - 8rem); }
}

/* ---------- Login: Pasang Aplikasi / Aktifkan Notifikasi ---------- */
.pwa-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.pwa-actions[hidden], .pwa-actions [hidden] { display: none !important; }
.pwa-actions .btn { flex: 1 1 12rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.pwa-msg { width: 100%; margin: .25rem 0 0; color: var(--muted, #6b778a); font-size: .78rem; text-align: center; }
.pwa-ios-hint {
    width: 100%;
    padding: .75rem .9rem;
    border: 1px solid var(--line, #e3e8ef);
    border-radius: var(--radius-sm, 8px);
    background: var(--canvas, #f4f6fa);
    font-size: .8rem;
    color: var(--ink-2, #3c4a5e);
    line-height: 1.45;
}
.pwa-ios-hint ol { margin: .35rem 0 0; padding-left: 1.2rem; }
.pwa-ios-hint i { color: var(--brand, #0059ad); }
