/* ================================================================
   SPLITWISE — Notification System
   Bell + Badge + Panel
   Matches dashboard-v2 design tokens
   ================================================================ */


/* ── BELL BUTTON (Sidebar) ──────────────────────────────────── */
.notification-bell {
    position: relative;
    display: flex !important;
    align-items: center !important;
    cursor: pointer;
    padding: 0.875rem !important;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible !important;
    width: 100%;
    text-decoration: none !important;
    color: white !important;
    opacity: 0.85;
    font-weight: 600;
    margin: 0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1;
    background: rgba(255, 255, 255, 0.05) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: none !important;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    opacity: 1 !important;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.notification-bell {
    -webkit-tap-highlight-color: transparent !important;
    -moz-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    outline: none !important;
}

.notification-bell:active,
.notification-bell:focus,
.notification-bell:focus-visible {
    background: rgba(255, 255, 255, 0.2) !important;
    outline: none !important;
    border: none !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
    -webkit-tap-highlight-color: transparent !important;
}

.notification-bell i {
    font-size: 1.3rem;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    margin-right: 10px;
    width: 22px;
    text-align: center;
}

.notification-bell:hover i {
    transform: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.notification-bell span:not(.notification-badge) {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: white !important;
    font-weight: 600 !important;
}

.sidebar.collapsed .notification-bell span:not(.notification-badge) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

.notification-bell.has-new i {
    animation: bellShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes bellShake {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}



/* ── BADGE ───────────────────────────────────────────────────── */
/* Hidden by default — JS adds .badge-visible to show it.        */
/* NO animation on the base class — prevents bellPulse from      */
/* running while the badge is hidden (invisible animation cost).  */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ff3b30 0%, #e74a3b 100%);
    color: white !important;
    border-radius: 50%;
    font-size: 0.75rem !important;
    font-weight: 900 !important;
    min-width: 20px;
    min-height: 20px;
    width: 20px;
    height: 20px;
    padding: 0;
    box-sizing: border-box;
    display: none;           /* JS adds .badge-visible to change this */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(231, 74, 59, 0.7), 0 0 0 2px rgba(255, 255, 255, 1);
    border: none;
    line-height: 1;
    z-index: 1000 !important;
    transform-origin: center;
    pointer-events: none;
    white-space: nowrap;
    text-align: center;
    /* opacity / visibility NOT set here — class controls them */
}

/* VISIBLE state: JS adds this class when count > 0 */
.notification-badge.badge-visible {
    display: flex !important;
    animation: bellPulse 2s ease-in-out infinite;
}

/* Wide variant for "9+" */
.notification-badge[data-count="9+"] {
    width: auto !important;
    min-width: 24px !important;
    padding: 0 4px !important;
    height: 20px !important;
    border-radius: 10px !important;
}

/* Pop animation: scale only — NO opacity change.                  */
/* Removing opacity:0 from the start is the key fix — it eliminates */
/* the ghost rendering caused by the :not(:empty) opacity:1 war.   */
.notification-badge.badge-pop {
    animation: badgePop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
               bellPulse 2s ease-in-out 0.4s infinite;
}

@keyframes bellPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 3px 10px rgba(231, 74, 59, 0.7), 0 0 0 2px rgba(255, 255, 255, 1);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 5px 15px rgba(231, 74, 59, 0.9), 0 0 0 3px rgba(255, 255, 255, 1), 0 0 15px rgba(231, 74, 59, 0.5);
    }
}

/* badgePop: scale only, no opacity — eliminates the ghost */
@keyframes badgePop {
    0%   { transform: scale(0.6); }
    55%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}


/* ================================================================
   NOTIFICATION PANEL — Matches Dashboard White Card Design
   White header, purple accents, clean typography
   ================================================================ */

/* ── Overlay ── */
.notification-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.40);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.notification-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ── Panel Container ──
   Same style as dashboard cards: white bg, subtle border, rounded */
.notification-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.96);
    width: min(92vw, 440px);
    max-height: 78vh;
    background: var(--db-card-bg, #ffffff);
    border-radius: var(--db-radius, 16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--db-border, rgba(0,0,0,0.06));
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.2s ease,
                visibility 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notification-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ── Header ──
   White background like dashboard cards, purple text accent */
.notification-header {
    padding: 1rem 1.25rem;
    background: var(--db-card-bg, #ffffff);
    border-bottom: 1px solid var(--db-border, rgba(0,0,0,0.06));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.notification-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--db-text-dark, #1e1b4b);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}
.notification-header h3 i {
    font-size: 1rem;
    color: #F59E0B !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: #F59E0B !important;
    background-clip: unset !important;
}

/* Close button — subtle rounded square */
.notification-header .close-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--db-body-bg, #f8f9fc);
    border: 1px solid var(--db-border, rgba(0,0,0,0.06));
    border-radius: 8px;
    color: var(--db-text-light, #9ca3af);
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}
.notification-header .close-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--db-danger, #ef4444);
    border-color: rgba(239, 68, 68, 0.15);
}

/* ── Actions Bar ── */
.notification-actions-bar {
    padding: 0.6rem 1.1rem;
    background: var(--db-card-bg, #ffffff);
    border-bottom: 1px solid var(--db-border, rgba(0,0,0,0.06));
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.notification-actions-bar button {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border-radius: var(--db-radius-sm, 10px);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}
/* Kill old ripple pseudo */
.notification-actions-bar button::before { display: none; }

.notification-actions-bar .btn-mark-all {
    background: var(--db-primary, #6C63FF);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.2);
}
.notification-actions-bar .btn-mark-all:hover {
    box-shadow: 0 3px 14px rgba(108, 99, 255, 0.3);
    filter: brightness(1.06);
}

.notification-actions-bar .btn-clear-all {
    background: var(--db-body-bg, #f8f9fc);
    color: var(--db-text-muted, #6b7280);
    border: 1px solid var(--db-border, rgba(0,0,0,0.06));
}
.notification-actions-bar .btn-clear-all:hover {
    color: var(--db-danger, #ef4444);
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.04);
}

/* ── Notification List ── */
.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    background: var(--db-body-bg, #f8f9fc);
}

/* Slim scrollbar */
.notification-list::-webkit-scrollbar { width: 3px; }
.notification-list::-webkit-scrollbar-track { background: transparent; }
.notification-list::-webkit-scrollbar-thumb {
    background: rgba(108, 99, 255, 0.12);
    border-radius: 6px;
}

/* ── Notification Item ──
   Same as dashboard stat card: white, rounded, bordered */
.notification-item {
    display: flex;
    gap: 0.7rem;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.45rem;
    background: var(--db-card-bg, #ffffff);
    border-radius: var(--db-radius-sm, 10px);
    border: 1px solid var(--db-border, rgba(0,0,0,0.06));
    box-shadow: var(--db-shadow-sm, 0 1px 3px rgba(0,0,0,0.04));
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    animation: notifSlideIn 0.25s ease both;
}
.notification-item:last-child { margin-bottom: 0; }

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Stagger */
.notification-item:nth-child(1) { animation-delay: 0.02s; }
.notification-item:nth-child(2) { animation-delay: 0.05s; }
.notification-item:nth-child(3) { animation-delay: 0.08s; }
.notification-item:nth-child(4) { animation-delay: 0.11s; }
.notification-item:nth-child(5) { animation-delay: 0.14s; }

/* Disable old pseudo-elements */
.notification-item::before { display: none; }
.notification-item::after { display: none; }

.notification-item:hover {
    box-shadow: var(--db-shadow-md, 0 4px 14px rgba(0,0,0,0.07));
    border-color: rgba(108, 99, 255, 0.1);
}

/* Unread — soft purple left border */
.notification-item.unread {
    border-left: 3px solid var(--db-primary, #6C63FF);
}

/* ── Icon ──
   Same size/radius as dashboard stat-icon */
.notification-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--db-radius-sm, 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ── Content ── */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--db-text-dark, #1e1b4b);
    margin-bottom: 0.12rem;
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Unread dot */
.notification-item.unread .notification-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--db-primary, #6C63FF);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 4px rgba(108, 99, 255, 0.35);
}

.notification-message {
    font-size: 0.74rem;
    color: var(--db-text-muted, #6b7280);
    line-height: 1.4;
    margin-bottom: 0.25rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notification-time {
    font-size: 0.62rem;
    color: var(--db-text-light, #9ca3af);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.notification-time::before {
    content: '\f017';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.5rem;
    opacity: 0.6;
}

/* ── Item Action Buttons ── */
.notification-item .notification-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    align-self: center;
}

.notification-item .notification-actions button {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1px solid var(--db-border, rgba(0,0,0,0.06));
    background: var(--db-body-bg, #f8f9fc);
    color: var(--db-text-light, #9ca3af);
    font-size: 0.68rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s ease;
}

.notification-item .notification-actions .btn-mark-read:hover {
    background: rgba(16, 185, 129, 0.08);
    color: var(--db-success, #10b981);
    border-color: rgba(16, 185, 129, 0.2);
}
.notification-item .notification-actions .btn-delete:hover {
    background: rgba(239, 68, 68, 0.06);
    color: var(--db-danger, #ef4444);
    border-color: rgba(239, 68, 68, 0.15);
}

/* ── Empty State ── */
.notification-list .text-center {
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

.notification-list .text-center i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--db-text-light, #9ca3af);
    opacity: 0.35;
}

.notification-list .text-center p {
    font-size: 0.85rem;
    color: var(--db-text-light, #9ca3af);
    font-weight: 600;
}


/* ================================================================
   DARK THEME
   ================================================================ */
body.dark-theme .notification-panel {
    background: #1a1740;
    border-color: rgba(108, 99, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
body.dark-theme .notification-header {
    background: #1a1740;
    border-bottom-color: rgba(108, 99, 255, 0.1);
}
body.dark-theme .notification-header h3 { color: #e4e1f7; }
body.dark-theme .notification-header .close-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #7c7f96;
}
body.dark-theme .notification-actions-bar {
    background: #161330;
    border-bottom-color: rgba(108, 99, 255, 0.08);
}
body.dark-theme .notification-actions-bar .btn-clear-all {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: #7c7f96;
}
body.dark-theme .notification-list {
    background: #12102a;
}
body.dark-theme .notification-item {
    background: #1a1740;
    border-color: rgba(108, 99, 255, 0.06);
}
body.dark-theme .notification-item:hover {
    border-color: rgba(108, 99, 255, 0.15);
}
body.dark-theme .notification-item.unread {
    border-left-color: #6C63FF;
}
body.dark-theme .notification-title { color: #e4e1f7; }
body.dark-theme .notification-message { color: #7c7f96; }
body.dark-theme .notification-time { color: #5a5d70; }
body.dark-theme .notification-item .notification-actions button {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.05);
    color: #5a5d70;
}
body.dark-theme .notification-list .text-center i { color: #3a3660; }
body.dark-theme .notification-list .text-center p { color: #5a5d70; }


/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .notification-panel {
        width: min(95vw, 420px);
        max-height: 80vh;
    }
    .notification-header { padding: 0.9rem 1.1rem; }
    .notification-header h3 { font-size: 0.98rem; }
}

@media (max-width: 576px) {
    .notification-panel {
        width: 95vw;
        max-height: 85vh;
        border-radius: 14px;
    }
    .notification-header { padding: 0.85rem 0.95rem; }
    .notification-header h3 {
        font-size: 0.9rem;
        gap: 0.4rem;
    }
    .notification-header h3 i { font-size: 0.88rem; }
    .notification-header .close-btn {
        width: 28px; height: 28px;
        font-size: 0.65rem;
    }
    .notification-actions-bar {
        padding: 0.5rem 0.8rem;
        gap: 0.4rem;
    }
    .notification-actions-bar button {
        padding: 0.4rem 0.55rem;
        font-size: 0.72rem;
        border-radius: 8px;
    }
    .notification-list { padding: 0.55rem 0.7rem; }
    .notification-item {
        padding: 0.65rem 0.7rem;
        gap: 0.55rem;
        border-radius: 9px;
    }
    .notification-icon {
        width: 32px; height: 32px;
        font-size: 0.82rem;
        border-radius: 8px;
    }
    .notification-title { font-size: 0.78rem; }
    .notification-message { font-size: 0.7rem; }
    .notification-time { font-size: 0.58rem; }
    .notification-item .notification-actions button {
        width: 24px; height: 24px;
        font-size: 0.6rem;
        border-radius: 6px;
    }
    .notification-list .text-center {
        padding: 2rem 1.2rem;
        min-height: 180px;
    }
    .notification-list .text-center i { font-size: 2rem; }
    .notification-list .text-center p { font-size: 0.78rem; }
}

@media (max-width: 380px) {
    .notification-panel {
        width: 97vw;
        max-height: 88vh;
        border-radius: 12px;
    }
    .notification-header { padding: 0.75rem 0.8rem; }
    .notification-header h3 { font-size: 0.85rem; }
    .notification-actions-bar { padding: 0.4rem 0.6rem; }
    .notification-actions-bar button {
        font-size: 0.68rem;
        padding: 0.35rem 0.45rem;
    }
    .notification-item { padding: 0.55rem 0.6rem; gap: 0.45rem; }
    .notification-icon { width: 28px; height: 28px; font-size: 0.75rem; }
}

/* Touch device fix → see touch-fix.css */

