/* ==========================================================================
   Header Bell Dropdown & Notification Center Styles
   ========================================================================== */
.notification-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

a.header-btn {
    text-decoration: none;
}

#btn-toggle-notifications {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    corner-shape: round;
    isolation: isolate;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#btn-toggle-notifications.has-unread {
    opacity: 1;
    color: var(--on-primary, #ffffff);
    background: rgba(68, 216, 241, 0.2);
    background: color-mix(in srgb, var(--tertiary-cyan) 22%, transparent);
    border: 1.5px solid var(--tertiary-cyan);
    box-shadow: 0 0 12px rgba(68, 216, 241, 0.35);
    box-shadow: 0 0 12px color-mix(in srgb, var(--tertiary-cyan) 40%, transparent);
}

#btn-toggle-notifications.has-unread:hover {
    background: rgba(68, 216, 241, 0.3);
    background: color-mix(in srgb, var(--tertiary-cyan) 32%, transparent);
}

#btn-toggle-notifications.has-unread svg {
    fill: currentColor;
}

#btn-toggle-notifications.has-unread::before,
#btn-toggle-notifications.has-unread::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    corner-shape: round;
    border: 2px solid var(--tertiary-cyan);
    pointer-events: none;
    z-index: -1;
}

#btn-toggle-notifications.has-unread::before {
    animation: notif-bell-ring-pulse 2s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

#btn-toggle-notifications.has-unread::after {
    animation: notif-bell-ring-pulse 2s cubic-bezier(0.22, 0.61, 0.36, 1) 1s infinite;
}

@keyframes notif-bell-ring-pulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }
    75%,
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #btn-toggle-notifications.has-unread::before,
    #btn-toggle-notifications.has-unread::after {
        animation: none;
        opacity: 0.45;
        transform: scale(1.18);
    }
}

.notification-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(400px, calc(100vw - 24px));
    background: var(--surface-card);
    color: var(--on-surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    z-index: 90;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notification-popover.open {
    display: flex;
}

@media (max-width: 768px) {
    .notification-popover {
        display: none !important;
    }
}

.notification-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--outline);
    background: var(--surface-low);
}

.notification-popover-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.notification-popover-list {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.notification-popover-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--outline-subtle);
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.notification-popover-item:hover {
    background: #fafbfc;
}

.notification-popover-item.unread {
    background: #f8faff;
}

.notification-popover-item.importance-high.unread {
    border-left-color: #d97706;
}

.notification-popover-item.importance-critical.unread {
    border-left-color: var(--error);
}

.notification-popover-item.importance-normal.unread {
    border-left-color: var(--secondary);
}

.notification-popover-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--outline);
    background: var(--surface-low);
    text-align: center;
}

.notification-popover-footer a {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary-container);
    text-decoration: none;
}

.notification-popover-footer a:hover {
    text-decoration: underline;
}

/* Shared Media (Icon or Image) */
.notif-media {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--surface-low);
    color: var(--primary);
    border: 1px solid var(--outline);
}

.notif-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.notif-media-low {
    background: var(--surface-low);
    color: var(--on-surface-muted);
}

.notif-media-normal {
    background: var(--secondary-container);
    color: var(--secondary-dark);
    border-color: #bfdbfe;
}

.notif-media-high {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

.notif-media-critical {
    background: var(--error-container);
    color: var(--error);
    border-color: #fecaca;
}

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

.notif-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--on-surface);
    line-height: 1.35;
}

.notif-desc {
    font-size: 12.5px;
    color: var(--on-surface-muted);
    line-height: 1.45;
    word-break: break-word;
}

.notif-desc-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.notif-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--on-surface-variant);
}

.notif-actions-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.notif-action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(0, 6, 102, 0.12);
    transition: background 0.15s ease;
}

.notif-action-link:hover {
    background: #cdd2ff;
}

/* Importance Chips */
.chip-importance-low {
    background: var(--surface-low);
    color: var(--on-surface-muted);
    border: 1px solid var(--outline);
}

.chip-importance-normal {
    background: var(--secondary-container);
    color: var(--secondary-dark);
}

.chip-importance-high {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.chip-importance-critical {
    background: var(--error-container);
    color: #93000a;
    border: 1px solid #fecaca;
}

/* Full Notification Feed List */
.notification-feed {
    display: flex;
    flex-direction: column;
}

.notification-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--outline-subtle);
    border-left: 4px solid transparent;
    transition: background 0.15s ease;
}

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

.notification-feed-item.unread {
    background: #f8faff;
}

.notification-feed-item.importance-normal.unread { border-left-color: var(--secondary); }
.notification-feed-item.importance-high.unread { border-left-color: #d97706; }
.notification-feed-item.importance-critical.unread { border-left-color: var(--error); }

.notification-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.notif-empty-popover {
    padding: 32px 16px;
    text-align: center;
    color: var(--on-surface-muted);
    font-size: 13px;
}

@media (max-width: 600px) {
    .notification-feed-item {
        flex-wrap: wrap;
        padding: 14px 16px;
    }
    .notification-item-controls {
        width: 100%;
        justify-content: flex-end;
    }
}
