/* K2 Hub CRM — In-App Notifications Styles */

.header-notifications {
    position: relative;
    margin-left: 12px;
    display: flex;
    align-items: center;
}

.notif-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Bell Button */
.notif-bell-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--k2-border, #e2e8f0);
    color: var(--k2-text-secondary, #475569);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.notif-bell-btn:hover {
    background: var(--k2-bg-secondary, #f8fafc);
    color: var(--k2-text, #0f172a);
    border-color: #cbd5e1;
}

.notif-bell-btn.active {
    background: #eff6ff;
    color: #2563eb;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.notif-bell-icon {
    width: 19px;
    height: 19px;
    stroke-width: 2;
    transition: transform 0.2s ease;
}

.notif-bell-btn:hover .notif-bell-icon {
    transform: rotate(12deg);
}

/* Unread Badge */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e11d48;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    height: 18px;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--k2-surface, #ffffff);
    box-shadow: 0 2px 5px rgba(225, 29, 72, 0.35);
    pointer-events: none;
    line-height: 1;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notif-badge.hidden {
    display: none !important;
}

/* Popover Panel */
.notif-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 400px;
    max-width: 92vw;
    background: var(--k2-surface, #ffffff);
    border: 1px solid var(--k2-border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.16), 0 4px 16px -2px rgba(15, 23, 42, 0.08);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: notifPopoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-popover.hidden {
    display: none !important;
}

@keyframes notifPopoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Popover Header */
.notif-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--k2-border, #e2e8f0);
    background: #f8fafc;
}

.notif-popover-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-popover-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--k2-text, #0f172a);
}

.notif-unread-pill {
    font-size: 11px;
    font-weight: 600;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.3;
}

.notif-mark-all-btn {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.notif-mark-all-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.notif-icon-xs {
    width: 14px;
    height: 14px;
}

/* Notifications List */
.notif-list {
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notif-list::-webkit-scrollbar {
    width: 5px;
}
.notif-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Notification Item */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
    position: relative;
}

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

.notif-item:hover {
    background: #f8fafc;
}

.notif-item.is-unread {
    background: #f0f7ff;
}

.notif-item.is-unread:hover {
    background: #e6f0fd;
}

/* Icon Avatar */
.notif-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.notif-type-new { background: #e0f2fe; }
.notif-type-mention { background: #ede9fe; }
.notif-type-date { background: #fef3c7; }
.notif-type-completed { background: #dcfce7; }
.notif-type-overdue { background: #fee2e2; }

/* Item Body with 3-Row Layout */
.notif-item-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

/* Row 1: Action + Time */
.notif-row-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.notif-action-tag {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: #0284c7;
}

.notif-item.is-type-task_new .notif-action-tag { color: #0284c7; }
.notif-item.is-type-mention .notif-action-tag { color: #7c3aed; }
.notif-item.is-type-task_date_changed .notif-action-tag { color: #d97706; }
.notif-item.is-type-task_completed .notif-action-tag { color: #16a34a; }
.notif-item.is-type-task_overdue .notif-action-tag { color: #e11d48; }

.notif-item-time {
    font-size: 11px;
    color: var(--k2-text-muted, #94a3b8);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Row 2: Task Name */
.notif-row-task {
    margin-bottom: 2px;
    line-height: 1.35;
}

.notif-task-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--k2-text, #0f172a);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item.is-unread .notif-task-name {
    font-weight: 700;
    color: #020617;
}

/* Row 3: Author / Details */
.notif-row-author {
    font-size: 12px;
    color: var(--k2-text-secondary, #64748b);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Unread Interactive Dot */
.notif-dot-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    transition: transform 0.15s ease;
    outline: none;
}

.notif-dot-btn:hover {
    transform: scale(1.3);
}

.notif-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.notif-dot-btn.is-unread .notif-dot {
    background: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.notif-dot-btn.is-read .notif-dot {
    background: transparent;
    border: 1.5px solid #cbd5e1;
}

.notif-dot-btn:hover.is-read .notif-dot {
    border-color: #94a3b8;
    background: #f1f5f9;
}

/* Empty / Loading State */
.notif-empty, .notif-loading {
    padding: 44px 20px;
    text-align: center;
    color: var(--k2-text-muted, #94a3b8);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.notif-empty-icon {
    font-size: 28px;
    opacity: 0.6;
}
