/**
 * Notification bell, dropdown panel, clickable toasts and @mention menu.
 * BEM naming; dark-mode variants under .dark.
 */

/* ==================== Bell ==================== */
.notif {
    position: relative;
    display: flex;
    align-items: center;
}

.notif__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    color: #4b5563;
    transition: background-color 0.15s, color 0.15s;
}
.notif__btn:hover { background: #f3f4f6; color: #111827; }
.dark .notif__btn { color: #d1d5db; }
.dark .notif__btn:hover { background: #334155; color: #fff; }

.notif__badge {
    position: absolute;
    top: 4px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.dark .notif__badge { box-shadow: 0 0 0 2px #1e293b; }

/* ==================== Panel ==================== */
.notif__panel {
    position: fixed;
    top: 72px;
    right: 16px;
    width: 380px;
    max-width: calc(100vw - 16px);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.25);
    z-index: 1200;
    overflow: hidden;
}
.dark .notif__panel {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
}

.notif__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
}
.dark .notif__head { border-color: #334155; color: #f1f5f9; }

.notif__mark {
    font-size: 0.75rem;
    font-weight: 500;
    color: #0284c7;
}
.notif__mark:hover { text-decoration: underline; }
.dark .notif__mark { color: #38bdf8; }

.notif__list {
    max-height: 440px;
    overflow-y: auto;
}

.notif__empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
}
.dark .notif__empty { color: #94a3b8; }

/* ==================== Item ==================== */
.notif__item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s;
}
.notif__item:last-child { border-bottom: none; }
.notif__item:hover { background: #f9fafb; }
.notif__item.is-unread { background: #f0f9ff; }
.notif__item.is-unread:hover { background: #e0f2fe; }
.dark .notif__item { border-color: #334155; }
.dark .notif__item:hover { background: #273449; }
.dark .notif__item.is-unread { background: rgba(14, 165, 233, 0.12); }
.dark .notif__item.is-unread:hover { background: rgba(14, 165, 233, 0.2); }

.notif__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: rgba(14, 165, 233, 0.15);
    color: #0284c7;
}
.notif__icon--comment,
.notif__icon--campaign_comment { background: rgba(14, 165, 233, 0.15); color: #0284c7; }
.notif__icon--mention { background: rgba(168, 85, 247, 0.15); color: #7e22ce; }
.notif__icon--upvote { background: rgba(34, 197, 94, 0.15); color: #15803d; }
.notif__icon--status { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.dark .notif__icon--comment,
.dark .notif__icon--campaign_comment { color: #38bdf8; }
.dark .notif__icon--mention { color: #c084fc; }
.dark .notif__icon--upvote { color: #4ade80; }
.dark .notif__icon--status { color: #fbbf24; }

.notif__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notif__text {
    font-size: 0.875rem;
    color: #111827;
    line-height: 1.3;
}
.is-unread .notif__text { font-weight: 600; }
.dark .notif__text { color: #f1f5f9; }

.notif__preview {
    font-size: 0.8rem;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dark .notif__preview { color: #94a3b8; }

.notif__time {
    font-size: 0.72rem;
    color: #9ca3af;
}
.dark .notif__time { color: #64748b; }

/* Mobile: full-width sheet under the nav */
@media (max-width: 640px) {
    .notif__panel {
        top: 64px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto;
    }
    .notif__list { max-height: 60vh; }
}

/* ==================== Clickable toast ==================== */
.toast--clickable { cursor: pointer; }
.toast--clickable:hover { filter: brightness(1.08); }

/* ==================== @mention menu ==================== */
.mention-wrap { position: relative; }

.mention-menu {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 240px;
    max-width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.25);
    z-index: 60;
    overflow: hidden;
}
.dark .mention-menu { background: #1e293b; border-color: #334155; }

.mention-menu__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    color: #111827;
}
.mention-menu__item:hover,
.mention-menu__item.is-active { background: #f0f9ff; }
.dark .mention-menu__item { color: #f1f5f9; }
.dark .mention-menu__item:hover,
.dark .mention-menu__item.is-active { background: rgba(14, 165, 233, 0.15); }

.mention-menu__avatar {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 0.7rem;
    flex-shrink: 0;
}
.mention-menu__avatar img { width: 100%; height: 100%; object-fit: cover; }
.dark .mention-menu__avatar { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }

.mention-menu__name { font-weight: 600; }
.mention-menu__display { color: #6b7280; font-size: 0.8rem; }
.dark .mention-menu__display { color: #94a3b8; }
