/* ============================================================
   Notification Panel
   ============================================================ */

.notification-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notifSlideIn 0.2s ease-out;
}

.notification-panel.hidden {
    display: none;
}

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

/* ── Header ─────────────────────────────────── */

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-color);
}

.notif-panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.notif-mark-all-btn {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.notif-mark-all-btn:hover {
    background: var(--bg-tertiary);
}

/* ── Tabs ───────────────────────────────────── */

.notif-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 8px;
}

.notif-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.notif-tab:hover {
    color: var(--text-secondary);
}

.notif-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.notif-tab-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-danger);
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notif-tab-badge:empty,
.notif-tab-badge.hidden {
    display: none;
}

/* ── List ───────────────────────────────────── */

.notif-list {
    overflow-y: auto;
    flex: 1;
    min-height: 120px;
    max-height: 380px;
}

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

.notif-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.notif-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* ── Notification item ──────────────────────── */

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
}

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

.notif-item:hover {
    background: var(--bg-tertiary);
}

.notif-item.notif-unread {
    background: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.06);
}

.notif-item.notif-unread:hover {
    background: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.1);
}

.notif-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.notif-icon {
    margin-right: 4px;
}

.notif-text {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary);
    display: block;
}

.notif-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 3px;
    display: block;
}

/* ── Light-theme overrides ──────────────────── */

html[data-theme="light"] .notification-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .notif-item.notif-unread {
    background: rgba(99, 102, 241, 0.05);
}

html[data-theme="light"] .notif-item.notif-unread:hover {
    background: rgba(99, 102, 241, 0.09);
}

/* ── Mobile ─────────────────────────────────── */

@media (max-width: 480px) {
    .notification-panel {
        position: fixed;
        top: 60px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: calc(100vh - 80px);
        border-radius: var(--radius-md);
    }
}

/* The nav-user wrapper needs relative positioning so the panel anchors correctly */
.nav-user {
    position: relative;
}
