/* ==================================================================================
   notifications.css — Notification bell + dropdown panel
   Covers: bell button, badge, panel, items (messages, future: claims, system),
           empty state, animations. All panel styles scoped to .notif-* classes.
   ================================================================================== */

/* ==================== BELL BUTTON ==================== */
.notif-bell-btn {
    position: relative;
    background: none;
    border: none;
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
    color: #6b7280;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notif-bell-btn:hover {
    background: #F4F0E9;
    color: #1E6332;
}

.notif-bell-btn.has-unread {
    color: #1E6332;
}

.notif-bell-btn.active {
    background: #F4F0E9;
    color: #1E6332;
}

/* Bell shake animation on new staff message */
@keyframes notifBellShake {
    0%, 100% { transform: rotate(0deg); }
    10%  { transform: rotate(-18deg); }
    20%  { transform: rotate(18deg); }
    30%  { transform: rotate(-14deg); }
    40%  { transform: rotate(14deg); }
    50%  { transform: rotate(-9deg); }
    60%  { transform: rotate(9deg); }
    70%  { transform: rotate(-5deg); }
    80%  { transform: rotate(5deg); }
    90%  { transform: rotate(-2deg); }
}

.notif-bell-shake {
    display: inline-block;
    animation: notifBellShake 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
    transform-origin: top center;
}

/* ==================== BADGE ==================== */
.notif-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 17px;
    height: 17px;
    background: #dc2626;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    border-radius: 10px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    line-height: 1;
    pointer-events: none;
    transform-origin: center;
}

@keyframes notifBadgePop {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.notif-badge-pop {
    animation: notifBadgePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Bell loading spinner — shown while messages stream is still loading */
.notif-bell-spinner {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(30, 99, 50, 0.25);
    border-top-color: #1E6332;
    border-radius: 50%;
    animation: progressSpin 0.8s linear infinite;
    pointer-events: none;
}

/* ==================== WRAPPER (positions the panel) ==================== */
.notif-dropdown-wrap {
    position: relative;
}

/* ==================== PANEL ==================== */
/* position:fixed escapes the sticky header's stacking context (z-index:1030)
   so the panel always sits above all page content. JS sets top/right on open. */
.notif-panel {
    position: fixed;
    top: 60px;    /* sensible fallback — JS overrides with bell button position */
    right: 16px;  /* sensible fallback */
    width: 390px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 20px 48px rgba(0, 0, 0, 0.16);
    z-index: 1055;
    overflow: hidden;
    transform-origin: top right;
}

@keyframes notifPanelIn {
    0%   { opacity: 0; transform: scale(0.88) translateY(-10px); }
    65%  { opacity: 1; transform: scale(1.01) translateY(1px); }
    100% { opacity: 1; transform: scale(1)    translateY(0px); }
}

@keyframes notifPanelOut {
    0%   { opacity: 1; transform: scale(1)    translateY(0px); }
    100% { opacity: 0; transform: scale(0.92) translateY(-8px); }
}

.notif-panel.panel-entering {
    animation: notifPanelIn 0.25s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

.notif-panel.panel-leaving {
    animation: notifPanelOut 0.18s ease-in forwards;
}

/* ==================== PANEL HEADER ==================== */
.notif-panel-header {
    background: linear-gradient(135deg, #1E6332 0%, #0d6b44 100%);
    padding: 16px 18px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.notif-panel-title-group {}

.notif-panel-title {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.notif-panel-title i {
    font-size: 0.88rem;
    opacity: 0.9;
}

.notif-panel-subtitle {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.71rem;
    margin-top: 3px;
    padding-left: 22px;
}

.notif-panel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-mark-all-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.notif-mark-all-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.notif-panel-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: rgba(255, 255, 255, 0.85);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
    flex-shrink: 0;
}

.notif-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: scale(1.1);
}

/* ==================== TYPE FILTER TABS ==================== */
.notif-type-tabs {
    display: flex;
    gap: 0;
    background: #f8fffe;
    border-bottom: 1px solid #e5f3eb;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.notif-type-tabs::-webkit-scrollbar { display: none; }

.notif-type-tab {
    flex-shrink: 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 9px 12px 8px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    margin-bottom: -1px;
}

.notif-type-tab:hover {
    color: #1E6332;
    background: rgba(30, 99, 50, 0.05);
}

.notif-type-tab.active {
    color: #1E6332;
    border-bottom-color: #1E6332;
    background: transparent;
}

.notif-type-tab-count {
    background: #F4F0E9;
    color: #1E6332;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.notif-type-tab.active .notif-type-tab-count {
    background: #1E6332;
    color: #ffffff;
}

/* ==================== PANEL BODY (scrollable) ==================== */
.notif-panel-body {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #ffffff;
}

.notif-panel-body::-webkit-scrollbar { width: 4px; }
.notif-panel-body::-webkit-scrollbar-track { background: #ffffff; }
.notif-panel-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* ==================== SECTION HEADERS ==================== */
.notif-section-header {
    padding: 10px 16px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1E6332;
    background: #f8fffe;
    border-bottom: 1px solid #edfaf4;
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-section-header.is-read {
    color: #9ca3af;
    background: #f9fafb;
    border-bottom-color: #f3f4f6;
}

.notif-section-count {
    font-weight: 600;
    font-size: 0.68rem;
    color: #1E6332;
    background: #F4F0E9;
    padding: 1px 7px;
    border-radius: 10px;
}

.notif-section-header.is-read .notif-section-count {
    color: #9ca3af;
    background: #f3f4f6;
}

/* ==================== NOTIFICATION ITEM ==================== */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px 12px;
    cursor: pointer;
    transition: background 0.12s;
    border-left: 3px solid transparent;
    position: relative;
    text-decoration: none;
}

.notif-item:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

.notif-item:hover {
    background: #f9fafb;
}

/* Unread item — green accent + tinted background */
.notif-item.is-unread {
    background: #F4F0E9;
    border-left-color: #1E6332;
}

.notif-item.is-unread:hover {
    background: #F4F0E9;
}

/* Slide-in animation for new Realtime items */
@keyframes notifItemSlideIn {
    0%   { opacity: 0; transform: translateX(12px); }
    100% { opacity: 1; transform: translateX(0); }
}

.notif-item.notif-item-new {
    animation: notifItemSlideIn 0.3s ease-out forwards;
}

/* ==================== ITEM AVATAR ==================== */
.notif-item-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    letter-spacing: -0.01em;
    color: #ffffff;
}

/* Type-based avatar colors */
.notif-item-avatar.type-message {
    background: linear-gradient(135deg, #1E6332 0%, #0d6b44 100%);
    box-shadow: 0 2px 8px rgba(30, 99, 50, 0.3);
}

.notif-item-avatar.type-claim {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.notif-item-avatar.type-system {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

/* Activity-type avatar colors (Claims notification tab) */
.notif-item-avatar.activity-funded {
    background: linear-gradient(135deg, #2F8542 0%, #1E6332 100%);
    box-shadow: 0 2px 8px rgba(30, 99, 50, 0.3);
}

.notif-item-avatar.activity-status {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.notif-item-avatar.activity-withdrawn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.notif-item-avatar.activity-document {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

/* Activity avatar icons centered */
.notif-item-avatar[class*="activity-"] {
    font-size: 0.85rem;
    color: #fff;
}

/* Announcement pinned/media inline icons */
.notif-ann-pinned {
    color: #d97706;
    font-size: 0.7rem;
    margin-left: 4px;
}

.notif-ann-media-icon {
    color: #6b7280;
    font-size: 0.7rem;
    margin-left: 4px;
}

/* System tab — category chip */
.notif-ann-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    margin-bottom: 2px;
}

/* System tab — priority indicators */
.notif-ann-pri {
    font-size: 0.7rem;
    margin-left: 4px;
}

.notif-ann-pri.important {
    color: #d97706;
}

.notif-ann-pri.urgent {
    color: #dc2626;
}

/* System tab — acknowledge required chip */
.notif-ann-ack-req {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #1E6332, #28a745);
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    margin-top: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(30,99,50,0.25);
}
.notif-ann-ack-req:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(30,99,50,0.35);
}

/* Unread green dot on avatar */
.notif-avatar-unread-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 11px;
    height: 11px;
    background: #18A74B;
    border-radius: 50%;
    border: 2px solid #F4F0E9;
}

.notif-item.is-unread:hover .notif-avatar-unread-dot {
    border-color: #F4F0E9;
}

/* ==================== ITEM CONTENT ==================== */
.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-top-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
}

.notif-item-sender {
    font-size: 0.83rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item.is-read .notif-item-sender {
    color: #6b7280;
    font-weight: 500;
}

.notif-item-time {
    font-size: 0.67rem;
    color: #9ca3af;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Claim chip */
.notif-item-claim-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item-claim-chip i {
    font-size: 0.58rem;
    opacity: 0.8;
}

/* Message preview */
.notif-item-preview {
    font-size: 0.78rem;
    color: #4b5563;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item.is-read .notif-item-preview {
    color: #9ca3af;
}

/* Unread pulse dot (right side of item) */
.notif-item-unread-dot {
    width: 8px;
    height: 8px;
    background: #1E6332;
    border-radius: 50%;
    flex-shrink: 0;
    align-self: center;
    margin-left: 2px;
}

@keyframes notifDotBreath {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.78); }
}

.notif-item-unread-dot {
    animation: notifDotBreath 2.2s ease-in-out infinite;
}

/* ==================== EMPTY STATE ==================== */
.notif-empty {
    text-align: center;
    padding: 44px 28px 36px;
}

.notif-empty-icon-wrap {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, #F4F0E9, #F4F0E9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: #1E6332;
    box-shadow: 0 4px 12px rgba(30, 99, 50, 0.15);
}

.notif-empty-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 7px;
}

.notif-empty-text {
    font-size: 0.78rem;
    color: #9ca3af;
    line-height: 1.6;
    max-width: 240px;
    margin: 0 auto;
}

/* ==================== LOADING STATE ==================== */
.notif-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 44px 28px 36px;
    gap: 12px;
}

.notif-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(30, 99, 50, 0.2);
    border-top-color: #1E6332;
    border-radius: 50%;
    animation: progressSpin 0.8s linear infinite;
}

.notif-loading-state span {
    font-size: 0.82rem;
    color: #1E6332;
    font-weight: 500;
}

/* ==================== PANEL FOOTER ==================== */
.notif-panel-footer {
    padding: 11px 14px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-view-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 9px 16px;
    background: linear-gradient(135deg, #1E6332 0%, #2F8542 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.notif-view-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(30, 99, 50, 0.35);
}

.notif-view-all-btn:active {
    transform: translateY(0);
}

/* No backdrop needed — outside-click handled by document listener in JS */
