﻿/* ==========================================================================
   Coject — Notification center (Opus 5.5): layout bell + dropdown, dashboard
   Notifications card, notification popup.
   Load in _LayoutOpus after layout-opus.css (every page has the bell):
       <link rel="stylesheet" href="@UrlAssets/css/opus/notification-center.css?v=1.0" />
   Source of truth: canvas "Coject Notifications Redesign" → Dashboard.dc.html, Popup.dc.html.
   --cj-* tokens only, so body.dark just works. Logical properties for RTL. Prefix "nc-".
   ========================================================================== */

body.cj-body {
    --nc-tone0-bg: #E2F5EF;
    --nc-tone0-t: #007561;
    --nc-tone1-bg: #E6E8FF;
    --nc-tone1-t: #00015D;
    --nc-tone2-bg: #FFE3E8;
    --nc-tone2-t: #9B1035;
    --nc-tone3-bg: #EEF1F7;
    --nc-tone3-t: #3A4166;
    --nc-warn-bg: #FFF1DE;
    --nc-warn-t: #8A4B00;
    --nc-unread: #09C895;
}

    body.cj-body.dark {
        --nc-tone0-bg: rgba(0,255,195,.12);
        --nc-tone0-t: #00FFC3;
        --nc-tone1-bg: rgba(140,150,255,.16);
        --nc-tone1-t: #C9CDFF;
        --nc-tone2-bg: rgba(255,107,140,.16);
        --nc-tone2-t: #FFB3C4;
        --nc-tone3-bg: #22254A;
        --nc-tone3-t: #C3CAE6;
        --nc-warn-bg: rgba(255,170,60,.14);
        --nc-warn-t: #FFC27A;
        --nc-unread: #00FFC3;
    }

.nc-tone0 {
    background: var(--nc-tone0-bg);
    color: var(--nc-tone0-t);
}

.nc-tone1 {
    background: var(--nc-tone1-bg);
    color: var(--nc-tone1-t);
}

.nc-tone2 {
    background: var(--nc-tone2-bg);
    color: var(--nc-tone2-t);
}

.nc-tone3 {
    background: var(--nc-tone3-bg);
    color: var(--nc-tone3-t);
}

.nc-warn {
    background: var(--nc-warn-bg);
    color: var(--nc-warn-t);
}

[dir="rtl"] .nc-flip {
    transform: scaleX(-1);
}

.nc-muted {
    color: var(--cj-t3);
    font-size: 12px;
}

.nc-bell .cj-ic, .nc-dash .cj-ic, .nc-pop .cj-ic {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* ---------- shared list row ---------- */
.nc-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    border-radius: 10px;
}

    .nc-item:hover {
        background: var(--cj-s1);
    }

.nc-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 10px;
    padding: 10px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
    border-radius: 10px;
}

    .nc-item-main:focus-visible {
        outline: 3px solid var(--cj-focus);
        outline-offset: -2px;
    }

.nc-av {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.nc-av-lg {
    width: 44px;
    height: 44px;
    font-size: 13px;
}

.nc-item-tx {
    flex: 1;
    min-width: 0;
}

.nc-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;
    color: var(--cj-t1);
}

.nc-item[data-state="unread"] .nc-item-title {
    font-weight: 700;
}

.nc-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: 12px;
    color: var(--cj-t3);
}

.nc-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.nc-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    flex: none;
    border-radius: 50%;
}

.nc-item[data-state="unread"] .nc-dot {
    background: var(--nc-unread);
}

.nc-x {
    width: 36px;
    height: 36px;
    flex: none;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--cj-t3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .nc-x:hover {
        background: var(--cj-hover);
        color: var(--cj-check);
    }

    .nc-x:focus-visible {
        outline: 3px solid var(--cj-focus);
    }

.nc-x-sm {
    width: 32px;
    height: 32px;
    margin: 8px 4px 0 0;
    opacity: .7;
}

    .nc-x-sm .cj-ic {
        width: 14px;
        height: 14px;
    }

    .nc-item:hover .nc-x-sm, .nc-x-sm:focus-visible {
        opacity: 1;
    }

.nc-day {
    padding: 10px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cj-t3);
}

.nc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 32px 16px;
    color: var(--cj-t3);
    text-align: center;
}

    .nc-empty .cj-ic {
        width: 30px;
        height: 30px;
        color: var(--cj-t4);
    }

    .nc-empty strong {
        color: var(--cj-t1);
        font-size: 13px;
    }

.nc-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(199,13,58,.08);
    color: var(--cj-danger);
    font-size: 13px;
    font-weight: 600;
}

.nc-textbtn {
    border: 0;
    background: none;
    padding: 4px 0;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--cj-accent);
    text-decoration: underline;
    cursor: pointer;
}

    .nc-textbtn:disabled {
        opacity: .45;
        cursor: not-allowed;
        text-decoration: none;
    }

.nc-loading {
    padding: 6px;
}

    .nc-loading i {
        display: block;
        height: 52px;
        margin: 6px 4px;
        border-radius: 10px;
        background: linear-gradient(90deg, var(--cj-s1), var(--cj-s3), var(--cj-s1));
        background-size: 200% 100%;
        animation: nc-sk 1.2s linear infinite;
    }

@keyframes nc-sk {
    to {
        background-position: -200% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nc-loading i {
        animation: none;
    }
}

.nc-bell [hidden], .nc-dash [hidden], .nc-pop [hidden] {
    display: none !important;
}

/* ---------- bell + dropdown (notificationBellEntry) ---------- */
.nc-bell {
    position: relative;
}

.nc-bell-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--cj-t2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .nc-bell-btn:hover, .nc-bell-btn[aria-expanded="true"] {
        background: var(--cj-hover);
        color: var(--cj-check);
    }

    .nc-bell-btn:focus-visible {
        outline: 3px solid var(--cj-focus);
    }

    .nc-bell-btn .cj-ic {
        width: 20px;
        height: 20px;
    }

.nc-bell-count {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    border: 2px solid var(--cj-panel);
    background: var(--cj-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
}

.nc-bell-btn[aria-expanded="true"] ~ .cj-tip {
    display: none;
}

.nc-menu {
    width: 400px;
    max-width: calc(100vw - 24px);
    margin-top: 8px !important;
    border: 1px solid var(--cj-line-2);
    border-radius: 14px;
    background: var(--cj-panel);
    box-shadow: var(--cj-shadow-menu);
    overflow: hidden;
    z-index: 1060;
}

.nc-menu-h {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cj-line);
}

    .nc-menu-h h2 {
        font-size: 15px;
        font-weight: 800;
        color: var(--cj-t1);
    }

.nc-pill {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--nc-tone0-bg);
    color: var(--nc-tone0-t);
    font-size: 12px;
    font-weight: 700;
}

.nc-menu-body {
    max-height: min(420px, calc(100vh - 200px));
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.nc-menu-f {
    border-top: 1px solid var(--cj-line);
}

    .nc-menu-f a {
        height: 46px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        color: var(--cj-accent);
        text-decoration: none;
    }

        .nc-menu-f a:hover {
            background: var(--cj-hover);
        }

        .nc-menu-f a:focus-visible {
            outline: 3px solid var(--cj-focus);
            outline-offset: -3px;
        }

.nc-menu-gear {
    width: 52px;
    flex: none;
    border-inline-start: 1px solid var(--cj-line);
    color: var(--cj-t2) !important;
}

/* ---------- dashboard card (#ncDash) ---------- */
.nc-dash {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    min-height: 0;
    max-height: 640px;
}

.nc-dash-h {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--cj-line);
}

    .nc-dash-h h2 {
        font-size: 17px;
        font-weight: 800;
        color: var(--cj-title);
    }

.nc-seg {
    display: inline-flex;
    align-self: flex-start;
    gap: 4px;
    padding: 3px;
    border-radius: 10px;
    background: var(--cj-s3);
}

    .nc-seg button {
        height: 30px;
        padding: 0 14px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--cj-t2);
        font: inherit;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
    }

        .nc-seg button[aria-selected="true"] {
            background: var(--cj-btn);
            color: var(--cj-btn-t);
        }

        .nc-seg button:focus-visible {
            outline: 3px solid var(--cj-focus);
        }

.nc-dash-b {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.nc-dash-f {
    height: 48px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid var(--cj-line);
    font-weight: 700;
    color: var(--cj-accent);
    text-decoration: none;
    border-radius: 0 0 var(--cj-r-lg, 16px) var(--cj-r-lg, 16px);
}

    .nc-dash-f:hover {
        background: var(--cj-hover);
    }

/* ---------- popup (#ncPopup) ---------- */
.nc-pop .modal-dialog {
    max-width: 560px;
}

.nc-pop .modal-content {
    border: 1px solid var(--cj-line);
    border-radius: 16px;
    background: var(--cj-panel);
    color: var(--cj-t1);
    box-shadow: 0 24px 60px rgba(0,1,93,.22);
    overflow: hidden;
    font-family: var(--cj-font);
}

.nc-pop-h {
    padding: 12px 14px 12px 20px;
    border-bottom: 1px solid var(--cj-line);
}

[dir="rtl"] .nc-pop-h {
    padding: 12px 20px 12px 14px;
}

.nc-pop-b {
    padding: 20px;
}

    .nc-pop-b h2 {
        flex: 1;
        min-width: 0;
        max-height: 240px;
        overflow-y: auto;
        font-size: 17px;
        line-height: 1.5;
        font-weight: 700;
        color: var(--cj-t1);
    }

    .nc-pop-b .nc-error {
        margin: 0;
    }

.nc-pop-meta {
    font-size: 13px;
}

    .nc-pop-meta span {
        display: block;
        font-size: 12px;
        color: var(--cj-t3);
    }

    .nc-pop-meta bdi {
        font-weight: 700;
    }

.nc-pop-f {
    padding: 14px 20px;
    border-top: 1px solid var(--cj-line);
    background: var(--cj-s1);
}

    .nc-pop-f > a {
        font-size: 13px;
        font-weight: 700;
        color: var(--cj-accent);
    }

    .nc-pop-f .cj-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
