/* Notification Centre
 * Bell badge in nav, notification list page, and individual notification rows.
 */

@layer components {

  /* ── Bell icon in nav ── */

  .notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: var(--radius-pill);
    color: var(--color-ink-muted);
    text-decoration: none;
    transition: color 100ms ease, background 100ms ease;

    &:hover {
      color: var(--color-ink);
      background: color-mix(in oklch, var(--color-ink) 6%, transparent);
    }

    &:focus-visible {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
    }
  }

  .notif-bell__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.3em;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
    color: oklch(100% 0 0);
    background: var(--color-negative);
    border-radius: var(--radius-pill);
  }

  .notif-bell__badge--hidden {
    display: none;
  }

  /* Mobile sheet count badge */
  .notif-bell__count {
    margin-inline-start: auto;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375em;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
    color: oklch(100% 0 0);
    background: var(--color-negative);
    border-radius: var(--radius-pill);
  }

  /* ── Notification centre page ── */

  .notif-centre__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--inline-space);
    margin-block-end: var(--block-space-l);
  }

  .notif-centre__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-ink);
    margin: 0;
  }

  .notif-centre__list {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  /* ── Notification row ── */

  .notif-item {
    display: flex;
    align-items: flex-start;
    gap: var(--inline-space);
    padding: 0.875rem var(--inline-space);
    text-decoration: none;
    color: var(--color-ink);
    border-block-end: 1px solid color-mix(in oklch, var(--color-border) 50%, transparent);
    border-radius: var(--radius);
    transition: background 100ms ease;

    &:last-child { border-block-end: none; }
    &:hover { background: color-mix(in oklch, var(--color-ink) 3%, transparent); }
  }

  .notif-item--unread {
    background: color-mix(in oklch, var(--color-accent) 4%, transparent);

    &:hover { background: color-mix(in oklch, var(--color-accent) 8%, transparent); }

    & .notif-item__title {
      font-weight: 600;
    }

    & .notif-item__icon {
      color: var(--color-accent);
    }
  }

  .notif-item__icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklch, var(--color-ink) 6%, transparent);
    border-radius: var(--radius);
    color: var(--color-ink-muted);

    & svg { width: 1.125rem; height: 1.125rem; }
  }

  .notif-item__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
  }

  .notif-item__title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-ink);
  }

  .notif-item__detail {
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .notif-item__time {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--color-ink-muted);
    padding-block-start: 0.125rem;
  }

  /* ── Empty state ── */

  .notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--block-space);
    padding: var(--block-space-l) 0;
    color: var(--color-ink-muted);
    text-align: center;

    & svg { opacity: 0.3; }

    & p {
      margin: 0;
      font-size: 0.9375rem;
    }
  }
}
