/* wwwroot/css/notifications.css
   Fully token-based — all colours use CSS vars set by _applyTheme
   Works correctly in both dark and light themes automatically
*/

/* ── Bell Button ─────────────────────────────────────────────────────────── */
.notif-bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notif-bell-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background .15s, color .15s;
}

    .notif-bell-btn:hover,
    .notif-bell-btn.notif-has-items {
        background: rgba(79,142,247,.1);
        color: var(--accent);
    }

.notif-bell-icon {
    width: 22px;
    height: 22px;
}

/* ── Badge ───────────────────────────────────────────────────────────────── */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: var(--cat3);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--surface);
    font-family: var(--font);
    animation: notif-pop .25s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes notif-pop {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Dropdown Panel ──────────────────────────────────────────────────────── */
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
    animation: notif-slide-in .18s ease;
}

@keyframes notif-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Panel header ─────────────────────────────────────────────────────────── */
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.notif-panel-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    font-family: var(--font);
    letter-spacing: .01em;
}

.notif-refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--muted);
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}

    .notif-refresh-btn:hover {
        background: rgba(79,142,247,.1);
        color: var(--accent);
    }

/* ── Panel body ───────────────────────────────────────────────────────────── */
.notif-panel-body {
    overflow-y: auto;
    flex: 1;
    max-height: 440px;
}

    .notif-panel-body::-webkit-scrollbar {
        width: 5px;
    }

    .notif-panel-body::-webkit-scrollbar-thumb {
        background: rgba(100,116,139,.25);
        border-radius: 3px;
    }

/* ── Notification Items ───────────────────────────────────────────────────── */
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
    cursor: default;
    border-left: 3px solid transparent;
}

    .notif-item:hover {
        background: rgba(79,142,247,.04);
    }

    .notif-item:last-child {
        border-bottom: none;
    }

/* Type accent colours */
.notif-type-0 {
    border-left-color: var(--accent);
}
/* DocumentAssigned  */
.notif-type-1 {
    border-left-color: var(--cat2);
}
/* ActionPending     */
.notif-type-2 {
    border-left-color: var(--cat1);
}
/* DocumentApproved  */
.notif-type-3 {
    border-left-color: var(--cat4);
}
/* NewDrawing        */

.notif-item-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
    padding-top: 2px;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 3px;
    font-family: var(--font);
}

.notif-item-msg {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
    margin-bottom: 6px;
    word-break: break-word;
}

.notif-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.notif-chip {
    background: var(--surface2);
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.notif-time {
    font-size: 10px;
    color: var(--muted);
    margin-left: auto;
    white-space: nowrap;
    opacity: .7;
}

/* ── Empty & Loading States ───────────────────────────────────────────────── */
.notif-empty, .notif-loading {
    padding: 36px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.notif-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: .5;
}

/* ── Toast (uses CSS custom props set by theme toggle) ────────────────────── */
/* vars used in JS: --toast-err-bg, --toast-err-text, --toast-ok-bg, --toast-ok-text */
:root {
    --toast-err-bg: #2a1515;
    --toast-err-text: #fca5a5;
    --toast-ok-bg: #152a15;
    --toast-ok-text: #86efac;
}

body[data-theme="light"] {
    --toast-err-bg: #fef2f2;
    --toast-err-text: #b91c1c;
    --toast-ok-bg: #f0fdf4;
    --toast-ok-text: #15803d;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .notif-panel {
        width: calc(100vw - 24px);
        right: -60px;
    }
}

/* ── Submit date notification types ──────────────────────────────────────────*/
.notif-item.notif-type-overdue {
    border-left: 3px solid #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.notif-item.notif-type-soon {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.06);
}

.notif-item.notif-type-1 {
    border-left: 3px solid #3b82f6;
    background: rgba(59, 130, 246, 0.06);
}

.notif-item.notif-type-4 {
    border-left: 3px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.06);
}

.notif-chip.doc-chip {
    font-family: var(--font);
    font-size: 9px;
    background: rgba(79, 142, 247, 0.15);
    color: var(--accent, #4f8ef7);
    border: 1px solid rgba(79, 142, 247, 0.3);
}

/* Project chip — surfaces the project name on every notification so users
   can tell at a glance which project a notification belongs to. Especially
   important when notifications span multiple projects: previously the
   notification just said "Pending Signatures" with no project context. */
.notif-chip.notif-chip-project {
    background: rgba(0, 212, 180, 0.12);
    color: var(--cat1, #22c55e);
    border: 1px solid rgba(0, 212, 180, 0.35);
    font-size: 10px;
    font-weight: 500;
    max-width: 200px;
}

.notif-item.notif-type-7 {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}
