/* =============================================================================
   DEX Portal - Notifications

   A drawer hanging off the bell in the header: 28% of the window, held between
   a sensible floor and ceiling so it is neither a letterbox on a laptop nor a
   wall on an ultrawide.
   ============================================================================= */

.notif-overlay {
    position: fixed;
    top: var(--height-top-header);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 850;
    background: rgba(16, 24, 40, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-quick) var(--easing-standard);
}

.notif-overlay.is-open { opacity: 1; pointer-events: auto; }

.notif-panel {
    position: fixed;
    top: var(--height-top-header);
    right: 0;
    bottom: 0;
    z-index: 860;
    display: flex;
    flex-direction: column;
    width: 28%;
    min-width: 360px;
    max-width: 520px;
    background: var(--surface-panel);
    border-left: 1px solid var(--border-default);
    box-shadow: -18px 0 46px -24px rgba(16, 24, 40, 0.45);
    transform: translateX(100%);
    transition: transform var(--duration-panel-open) var(--easing-standard);
}

.notif-panel.is-open { transform: translateX(0); }


/* ------------------------------------------------------------------- head */

.notif-panel__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 14px 14px 20px;
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-subtle);
    flex-shrink: 0;
}

.notif-panel__titles {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-right: auto;
    min-width: 0;
}

.notif-panel__title {
    margin: 0;
    font-size: var(--font-size-medium);
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* A quiet count beside the title - accent-tinted so it reads as "new" without
   shouting, and gone entirely when the inbox is clear. */
.notif-panel__count {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--radius-pill, 999px);
    background: var(--accent-tint);
    color: var(--accent);
    font-size: var(--font-size-tiny);
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.notif-panel__count[hidden] { display: none; }

.notif-panel__actions { display: flex; align-items: center; gap: 2px; }

.notif-head-button {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-button);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--duration-instant) var(--easing-standard),
                color var(--duration-instant) var(--easing-standard);
}

.notif-head-button:hover { background: var(--surface-subtle); color: var(--text-primary); }

.notif-head-button--danger:hover {
    background: var(--status-danger-tint);
    color: var(--status-danger);
}


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

.notif-panel__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 10px 20px;
}

.notif-group {
    padding: 12px 10px 6px;
    font-size: var(--font-size-tiny);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.notif-row {
    position: relative;
    display: flex;
    align-items: stretch;
    border-radius: var(--radius-button);
    transition: background var(--duration-instant) var(--easing-standard);
}

.notif-row:hover { background: var(--surface-subtle); }

/* Unread is the whole point of the panel, so it is the row that changes, not a
   dot somewhere on it. Pale blue, with the accent edge doing the work at a
   glance and the text staying black. */
.notif-row.is-unread {
    background: #eef4ff;
    box-shadow: inset 2px 0 0 var(--accent);
}

.notif-row.is-unread:hover { background: #e6eeff; }

.notif-row__open {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 11px 8px 11px 12px;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.notif-row__glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius-button);
    background: var(--surface-subtle);
    color: var(--text-secondary);
}

.notif-row__glyph--success { background: var(--status-success-tint); color: var(--status-success); }
.notif-row__glyph--danger { background: var(--status-danger-tint); color: var(--status-danger); }
.notif-row__glyph--warning { background: var(--status-warning-tint); color: var(--status-warning); }
.notif-row__glyph--accent { background: var(--accent-tint); color: var(--accent); }
.notif-row__glyph--info { background: var(--status-info-tint); color: var(--status-info); }

.notif-row__text { min-width: 0; }

.notif-row__title {
    font-size: var(--font-size-base);
    font-weight: 550;
    color: var(--text-primary);
    line-height: 1.35;
}

.notif-row.is-unread .notif-row__title { font-weight: 650; }

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

.notif-row__when {
    margin-top: 3px;
    font-size: var(--font-size-tiny);
    color: var(--text-muted);
}

.notif-row__dismiss {
    align-self: flex-start;
    margin: 9px 8px 0 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius-small);
    background: none;
    color: var(--text-muted);
    opacity: 0;
    cursor: pointer;
    transition: opacity var(--duration-instant) var(--easing-standard),
                background var(--duration-instant) var(--easing-standard);
}

.notif-row:hover .notif-row__dismiss,
.notif-row:focus-within .notif-row__dismiss { opacity: 1; }

.notif-row__dismiss:hover { background: var(--surface-panel); color: var(--status-danger); }


/* ------------------------------------------------------------------ empty */

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 64px 28px;
    text-align: center;
    color: var(--text-muted);
}

.notif-empty .icon { color: var(--border-strong); margin-bottom: 8px; }
.notif-empty h4 { margin: 0; font-size: var(--font-size-base); color: var(--text-primary); }
.notif-empty p { margin: 0; font-size: var(--font-size-small); max-width: 260px; line-height: 1.5; }


/* ------------------------------------------------------------------- bell */

/* `hidden` is a hint, not a rule: the badge already has a `display` of its own
   in components.css, which beats it. Without this, an inbox with nothing in it
   wears a badge reading 0. */
.notification-badge[hidden] { display: none; }

/* One shake when something lands, so a badge that changes while you are
   reading something else is noticed rather than discovered later. */
#headerNotificationsButton.has-arrived .icon {
    animation: notif-nudge 620ms var(--easing-standard);
}

@keyframes notif-nudge {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(-13deg); }
    30% { transform: rotate(11deg); }
    45% { transform: rotate(-8deg); }
    60% { transform: rotate(5deg); }
    75% { transform: rotate(-2deg); }
}

#headerNotificationsButton.is-active { background: rgba(255, 255, 255, 0.12); }


@media (max-width: 620px) {
    .notif-panel { width: 100%; min-width: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .notif-panel,
    .notif-overlay { transition: none; }

    #headerNotificationsButton.has-arrived .icon { animation: none; }
}
