/* ===========================================
   Notification Bell (topbar icon + dropdown)
   Trigger button + badge + dropdown panel
   Reuses .fr-topbar-dropdown__* for shared panel styles
   =========================================== */

.notification-bell {
    position: relative;
    align-self: center;
}

/* ---- Trigger button ---- */

.notification-bell__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: var(--space-1);
    cursor: pointer;
    color: var(--color-accent);
    font-size: 1.35em;
    border-radius: 6px;
    transition: color 0.15s ease, transform 0.15s ease;
    position: relative;
}

.notification-bell__trigger:hover {
    color: var(--color-text);
    transform: scale(1.1);
}

.notification-bell__trigger:active {
    transform: scale(0.95);
}

.notification-bell.open .notification-bell__trigger {
    color: var(--color-text);
}

/* ---- Badge (unread count) ---- */

.notification-bell__badge {
    position: absolute;
    top: 0;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--color-danger, #ef4444);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: 10px;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.notification-bell__badge--hidden {
    opacity: 0;
    transform: scale(0);
}

/* ---- Dropdown panel ---- */

.notification-bell__panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 340px;
    background: var(--color-surface-elevated);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 99999;
    opacity: 0;
    transform: translateY(-6px);
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    display: flex;
    flex-direction: column;
    max-height: 460px;
    overflow: hidden;
}

.notification-bell.open .notification-bell__panel {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* ---- Header ---- */

.notification-bell__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.notification-bell__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.notification-bell__mark-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--color-accent);
    padding: 0;
    transition: color 0.12s ease;
}

.notification-bell__mark-all:hover {
    color: var(--color-text);
}

/* ---- Notification list ---- */

.notification-bell__list {
    overflow-y: auto;
    flex: 1;
}

/* ---- Notification item ---- */

.notification-bell__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    min-height: 72px;
    cursor: pointer;
    transition: background 0.12s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    text-align: left;
    /* Read items: slightly darker background */
    background: var(--color-surface-hover);
    border-bottom: 1px solid var(--color-border);
}

.notification-bell__item:last-child {
    border-bottom: none;
}

.notification-bell__item:hover {
    background: color-mix(in srgb, var(--color-surface-hover) 97%, var(--color-text) 3%);
}

/* Unread item — accent background */
.notification-bell__item--unread {
    background: var(--color-accent);
    padding-right: calc(var(--space-3) + 16px);
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

.notification-bell__item--unread:hover {
    background: var(--color-accent-hover);
}

/* Red unread dot */
.notification-bell__item--unread::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--color-danger, #ef4444);
    border-radius: 50%;
}

/* Unread: icon colors on accent background */
.notification-bell__item--unread .notification-bell__icon {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Unread: text colors on accent background */
.notification-bell__item--unread .notification-bell__actor {
    color: #fff;
}

.notification-bell__item--unread .notification-bell__time {
    color: rgba(255, 255, 255, 0.7);
}

.notification-bell__item--unread .notification-bell__item-title {
    color: rgba(255, 255, 255, 0.65);
    opacity: 1;
}

.notification-bell__item--unread .notification-bell__message {
    color: rgba(255, 255, 255, 0.85);
}

/* Category icon */
.notification-bell__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--color-surface-hover);
    color: var(--color-accent);
    font-size: 12px;
    margin-top: 2px;
}

/* Content area */
.notification-bell__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: left;
}

/* Top row: actor name + timestamp */
.notification-bell__content-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.notification-bell__actor {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-bell__time {
    font-size: 10px;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Action description */
.notification-bell__item-title {
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-muted);
    opacity: 0.6;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Comment preview */
.notification-bell__message {
    font-size: 12.5px;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Empty state ---- */

.notification-bell__empty {
    padding: var(--space-6) var(--space-3);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ---- Footer ---- */

.notification-bell__footer {
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.notification-bell__view-all {
    display: block;
    text-align: center;
    padding: var(--space-2) var(--space-3);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
    border-radius: 0 0 10px 10px;
}

.notification-bell__view-all:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

/* ---- Loading state ---- */

.notification-bell__loading {
    padding: var(--space-4) var(--space-3);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ---- Back button (hidden on desktop) ---- */

.notification-bell__back {
    display: none;
}

/* ===========================================
   Mobile: full-screen overlay
   =========================================== */
@media (max-width: 768px) {

    .notification-bell__panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        z-index: 100000;
    }

    .notification-bell__back {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 12px 16px;
        min-height: var(--touch-target-min);
        background: var(--color-surface-hover);
        border: none;
        border-bottom: 1px solid var(--color-border);
        color: var(--color-accent);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        flex-shrink: 0;
    }

    .notification-bell__back:active {
        background: var(--color-surface);
    }

    .notification-bell__list {
        flex: 1;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .notification-bell__item {
        padding: var(--space-3);
        min-height: var(--touch-target-min);
    }

    .notification-bell__actor {
        font-size: 14.5px;
    }

    .notification-bell__item-title {
        font-size: 11.5px;
    }

    .notification-bell__message {
        font-size: 13px;
    }

    .notification-bell__view-all {
        padding: var(--space-3);
        min-height: var(--touch-target-min);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0;
    }
}

/* ===========================================
   Notification Toast (slide-in banner)
   Rich toast shown on notification:new events.
   Rendered by showNotificationToast() in notifications.js,
   styled here alongside the bell component.
   =========================================== */

.toast--notification {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    cursor: pointer;
    max-width: 360px;
    min-width: 280px;
    font-family: var(--font-sans, sans-serif);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast--notification:hover {
    background: var(--color-surface-hover);
}

.notif-toast__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--color-surface-hover);
    color: var(--color-accent);
    font-size: 12px;
    margin-top: 1px;
}

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

.notif-toast__actor {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.notif-toast__message {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
}

.notif-toast__close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 0 0 4px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.12s ease;
    flex-shrink: 0;
}

.notif-toast__close:hover {
    opacity: 1;
}

/* Mobile: wider toasts */
@media (max-width: 768px) {
    .toast--notification {
        max-width: calc(100vw - 40px);
    }
}
