/* ============================================================
 * NOTIFICATION SYSTEM
 * ============================================================ */
.notif-bell-wrapper {
    position: relative;
    display: inline-flex;
}

.notif-bell {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    position: relative;
    transition: color 0.2s, background 0.2s;
}

.notif-bell:hover {
    color: var(--color-primary);
    background: var(--bg-tertiary);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--color-error);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 10px;
    padding: 0 4px;
    pointer-events: none;
    animation: notifPulse 2s ease-in-out infinite;
}

@keyframes notifPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

.notif-dropdown {
    display: none;
    position: fixed;
    top: 68px;
    right: 16px;
    width: 360px;
    max-height: 480px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    overflow: hidden;
    flex-direction: column;
}

.notif-dropdown.active {
    display: flex;
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.notif-dropdown-header button {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.notif-dropdown-header button:hover {
    background: var(--bg-tertiary);
}

.notif-dropdown-body {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-primary);
    position: relative;
}

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

.notif-item.unread {
    background: rgba(var(--color-primary-rgb, 139, 92, 246), 0.04);
}

.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

.notif-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--color-primary);
}

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

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-msg {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-time {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.notif-item-actions {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex-shrink: 0;
}

.notif-item-actions button {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    opacity: 0;
}

.notif-item:hover .notif-item-actions button {
    opacity: 1;
}

.notif-item-actions button:hover {
    color: var(--color-error);
    background: var(--bg-tertiary);
}

.notif-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-tertiary);
    font-size: 13px;
    line-height: 1.8;
}

.notif-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-primary);
    text-align: center;
}

.notif-dropdown-footer a {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
}

.notif-dropdown-footer a:hover {
    color: var(--color-primary);
}

/* Thông báo nổi (Toast) */
.notif-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 340px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: notifSlideIn 0.3s ease-out;
    border-left: 4px solid var(--color-primary);
}

@keyframes notifSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notif-toast-icon {
    font-size: 20px;
    color: var(--color-primary);
    flex-shrink: 0;
}

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

.notif-toast-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-toast-msg {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    flex-shrink: 0;
}

.notif-toast-close:hover {
    color: var(--text-primary);
}

/* Modal cài đặt thông báo */
#notif-settings-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#notif-settings-body>div,
#notif-settings-body>details {
    padding-bottom: 4px;
}

#notif-settings-body h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 4px;
    padding: 0;
    color: var(--text-primary);
}

.notif-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-primary);
}

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

.notif-setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.notif-setting-label i {
    width: 20px;
    text-align: center;
    color: var(--text-tertiary);
}

.notif-setting-locked {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
}

.notif-setting-locked::after {
    content: '🔒';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}


/* Popup thông báo ưu tiên cao */
.notif-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.notif-popup {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

.notif-popup-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 16px;
}

.notif-popup-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.notif-popup-msg {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.notif-popup-btn {
    min-width: 120px;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========== Trang thông báo — Card ========== */
.notif-count-badge {
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.notif-filter-group {
    display: flex;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.notif-filter-group .btn {
    border-radius: 0;
    border: none;
    font-size: 12px;
}

.notif-filter-group .btn+.btn {
    border-left: 1px solid var(--border-primary);
}

.notif-card {
    cursor: pointer;
    transition: box-shadow .2s, border-color .2s;
    margin-bottom: 4px;
    padding: 0;
}

.notif-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.notif-card-unread {
    border-left: 3px solid var(--color-primary);
}

.notif-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 2px;
}

.notif-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--color-primary);
}

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

.notif-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-card-meta {
    display: flex;
    gap: 10px;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 1px;
    flex-wrap: wrap;
}

.notif-card-meta i {
    margin-right: 2px;
}

.notif-card-delete {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity .2s, color .2s;
}

.notif-card:hover .notif-card-delete {
    opacity: 1;
}

.notif-card-delete:hover {
    color: var(--color-error);
    background: var(--bg-tertiary);
}

.notif-card-body {
    padding: 2px 12px 8px 48px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invite-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.invite-status-badge i {
    margin-right: 2px;
    font-size: 10px;
}

.invite-status-pending {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success, #10b981);
}

.invite-status-accepted {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.invite-status-expired {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error, #ef4444);
}


/* ============================================================
 * RESPONSIVE — Notifications
 * ============================================================ */
@media (max-width: 900px) {
    .notif-dropdown {
        top: 60px;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 70vh;
    }

    .notif-toast {
        right: 8px;
        left: 8px;
        width: auto;
    }
}
