/* =============================================================================
   TrueSight — Notification System Styles
   Add to: css/notifications.css  (linked after style.css in index.php)
   ============================================================================= */

/* ── Bell button in the status bar ─────────────────────────────────────────── */

.notif-bell-btn {
    position: relative;
    background: var(--bg-field);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.notif-bell-btn:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
    background: var(--bg-field-focus);
}

.notif-bell-btn.has-unread {
    color: var(--accent);
    border-color: rgba(0, 212, 255, 0.4);
    background: rgba(0, 212, 255, 0.08);
    animation: bell-pulse 2.5s ease-in-out infinite;
}

@keyframes bell-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(0, 212, 255, 0);
    }
}

/* Unread-count badge on the bell */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    border: 2px solid var(--bg-app);
}

/* ── Notification panel ─────────────────────────────────────────────────────── */

/* Invisible backdrop — catches outside clicks */
.notif-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 8800;
    display: none;
}

.notif-panel {
    position: fixed;
    top: 58px;
    right: 16px;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
    background: var(--bg-panel);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 14px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    z-index: 8900;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: notif-panel-in 0.18s ease;
}

@keyframes notif-panel-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }

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

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.notif-panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-panel-title i {
    color: var(--accent);
}

.notif-panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.notif-mark-all-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 5px;
    transition: background 0.15s;
    white-space: nowrap;
}

.notif-mark-all-btn:hover {
    background: rgba(0, 212, 255, 0.1);
}

.notif-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.notif-close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

/* Scrollable notification list */
.notif-list {
    overflow-y: auto;
    flex: 1;
}

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

.notif-list::-webkit-scrollbar-track {
    background: transparent;
}

.notif-list::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2);
    border-radius: 3px;
}

/* Empty state */
.notif-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-empty i {
    display: block;
    font-size: 2rem;
    color: rgba(0, 212, 255, 0.2);
    margin-bottom: 12px;
}

/* Individual notification row */
.notif-item {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-softer);
    transition: background 0.15s;
    position: relative;
    cursor: default;
}

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

.notif-item:hover {
    background: rgba(255, 255, 255, 0.025);
}

/* Coloured left stripe on unread items */
.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
}

.notif-item.unread.type-invitation::before {
    background: var(--accent);
}

.notif-item.unread.type-info::before {
    background: var(--info);
}

.notif-item.unread.type-warning::before {
    background: var(--warn);
}

.notif-item.unread.type-success::before {
    background: var(--success);
}

.notif-item.unread.type-danger::before {
    background: var(--danger);
}

.notif-item.unread.type-system::before {
    background: #a78bfa;
}

/* Type icon */
.notif-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.notif-icon.type-invitation {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent);
}

.notif-icon.type-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info);
}

.notif-icon.type-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warn);
}

.notif-icon.type-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.notif-icon.type-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.notif-icon.type-system {
    background: rgba(167, 139, 250, 0.12);
    color: #a78bfa;
}

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

.notif-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 3px;
    line-height: 1.3;
}

.notif-item:not(.unread) .notif-title {
    color: var(--text-muted);
    font-weight: 600;
}

.notif-message {
    font-size: 0.79rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}

.notif-time {
    font-size: 0.7rem;
    color: rgba(139, 149, 167, 0.6);
}

/* Action buttons inside the panel row */
.notif-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.notif-action-btn {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.notif-action-btn:hover {
    transform: translateY(-1px);
}

.notif-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.notif-action-btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: #000;
}

.notif-action-btn.primary:hover {
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.notif-action-btn.secondary {
    background: var(--bg-field);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notif-action-btn.secondary:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
}

.notif-action-btn.danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Per-item dismiss (×) */
.notif-dismiss {
    background: transparent;
    border: none;
    color: rgba(139, 149, 167, 0.4);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    margin-top: 2px;
}

.notif-dismiss:hover {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
}

/* ── Toast pop-ups ──────────────────────────────────────────────────────────── */

.notif-toast-container {
    position: fixed;
    top: 68px;
    right: 16px;
    z-index: 9500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 360px;
    width: calc(100vw - 32px);
}

.notif-toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    pointer-events: all;
    animation: toast-in 0.22s ease;
    position: relative;
    overflow: hidden;
}

.notif-toast.toast-out {
    animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Shrinking progress bar at bottom */
.notif-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--accent);
    width: 100%;
    animation: toast-progress linear forwards;
    transform-origin: left;
}

@keyframes toast-progress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* Left-border colour per type */
.notif-toast.type-invitation {
    border-left: 3px solid var(--accent);
}

.notif-toast.type-info {
    border-left: 3px solid var(--info);
}

.notif-toast.type-warning {
    border-left: 3px solid var(--warn);
}

.notif-toast.type-success {
    border-left: 3px solid var(--success);
}

.notif-toast.type-danger {
    border-left: 3px solid var(--danger);
}

.notif-toast.type-system {
    border-left: 3px solid #a78bfa;
}

.notif-toast-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 1px;
}

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

.notif-toast-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.notif-toast-msg {
    font-size: 0.77rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.notif-toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

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

/* Action buttons inside a toast */
.notif-toast .notif-actions {
    margin-top: 8px;
}

.notif-toast .notif-action-btn {
    font-size: 0.72rem;
    padding: 4px 10px;
}