/* notifications.css
 * Extracted from public/styles.css (Phase 0.3).
 * Lazy-loaded by public/modules/panels/nav.js on openPanel('notifications')
 * or relevant tab switch in switchMode().
 */

/* M3 icon button (state-layer overlay) */
#notif-bell {
  position: relative;
  background: none;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--md-sys-shape-corner-full);
  flex-shrink: 0;
  overflow: hidden;
  isolation: isolate;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  -webkit-tap-highlight-color: transparent;
}

#notif-bell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  pointer-events: none;
  z-index: -1;
}

@media (hover: hover) {
  #notif-bell:hover { color: var(--md-sys-color-on-surface); }
  #notif-bell:hover::after { opacity: var(--md-sys-state-hover-opacity); }
}

#notif-bell:active::after { opacity: var(--md-sys-state-pressed-opacity); }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: var(--md-sys-typescale-label-small-size);
  line-height: 16px;
  font-weight: 700;
  letter-spacing: var(--md-sys-typescale-label-small-tracking);
  min-width: 16px;
  height: 16px;
  text-align: center;
  border-radius: var(--md-sys-shape-corner-sm);
  padding: 0 4px;
}

#notif-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 8px;
  width: min(360px, calc(100vw - 24px));
  max-height: 400px;
  background: var(--md-sys-color-surface-container-high);
  border: none;
  border-radius: var(--md-sys-shape-corner-md);
  box-shadow: var(--md-sys-elevation-3);
  z-index: 200;
  overflow: hidden;
}

#notif-dropdown.open { display: block; }

.notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline);
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  letter-spacing: var(--md-sys-typescale-title-medium-tracking);
}

.notif-dropdown-header button {
  background: none;
  border: none;
  color: var(--md-sys-color-primary);
  cursor: pointer;
  font-family: var(--md-sys-typescale-font-family);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  padding: 4px 8px;
}

#notif-list {
  overflow-y: auto;
  max-height: 340px;
}

/* List item with state-layer overlay */
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  cursor: pointer;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  position: relative;
  isolation: isolate;
  min-height: 56px;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.notif-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--md-sys-color-on-surface);
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  pointer-events: none;
  z-index: -1;
}

@media (hover: hover) {
  .notif-item:hover::after { opacity: var(--md-sys-state-hover-opacity); }
}

.notif-item:active::after { opacity: var(--md-sys-state-pressed-opacity); }

/* ── Severity, without one-sided accent bars ──────────────────────────────────
   These were 3px left stripes. The the design contract bans asymmetric
   coloured accent bars, so severity is now carried by a SYMMETRIC pair: a full
   1px border in the severity colour plus a matching low-alpha fill. The ladder
   is unchanged and still legible at a glance:

     unread          the brand primary border + subtle blue fill
     critical/alert  error border + error fill   (loudest)
     scheduler/pend  warning border + warning fill
     resolved        neutral outline, no fill    (deliberately quiet: the thing
                     that was wrong is no longer wrong, and green is banned as an
                     accent colour anyway)

   These set the full `border` rather than `border-color` because the base
   .notif-item only declares a border-bottom hairline — there is no other edge to
   recolour. */

.notif-item.unread {
  border: 1px solid var(--md-sys-color-primary);
  background: var(--accent-subtle);
}

.notif-item--critical,
.notif-item--health-alert {
  border: 1px solid var(--md-sys-color-error);
  background: var(--md-sys-color-error-container);
}

.notif-item--health-resolved {
  border: 1px solid var(--md-sys-color-outline-variant);
  background: transparent;
}

.notif-item--scheduler-alert,
.notif-item--pending {
  border: 1px solid var(--md-sys-color-warning-fg);
  background: var(--md-sys-color-warning-bg);
}

.notif-item-pending-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: var(--md-sys-typescale-label-small-size);
  line-height: var(--md-sys-typescale-label-small-line);
  font-weight: 700;
  letter-spacing: var(--md-sys-typescale-label-small-tracking);
  text-transform: uppercase;
  color: var(--md-sys-color-warning-fg);
  background: var(--md-sys-color-warning-bg);
  border-radius: var(--md-sys-shape-corner-xs);
  padding: 1px 5px;
  vertical-align: middle;
}

.notif-item-content { flex: 1; min-width: 0; }

.notif-title {
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  font-weight: 600;
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 2px;
}

.notif-body {
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line);
  font-weight: 600;
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  color: var(--md-sys-color-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-time {
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 3px;
}

.notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
}

.notif-type-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--md-sys-shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
}

.notif-panel-enter {
  animation: health-fade-in 0.25s var(--ease-out) both;
}

.notif-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  /* Was a green fill + green border. Green is banned as a surface/accent
     colour, so the all-clear banner reads as a calm neutral card. */
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md);
  margin-bottom: 16px;
}

.notif-banner--alert {
  background: var(--md-sys-color-error-container);
  border-color: var(--md-sys-color-error);
}

.notif-banner--pending {
  background: var(--md-sys-color-warning-bg);
  border-color: var(--md-sys-color-warning-fg);
}

.notif-banner-pending {
  margin-left: auto;
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  font-weight: 600;
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-warning-fg);
  background: var(--md-sys-color-warning-bg);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-sm);
}

.notif-banner-text {
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  letter-spacing: var(--md-sys-typescale-title-medium-tracking);
  color: var(--md-sys-color-on-surface);
}

.notif-banner-alert {
  margin-left: auto;
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  font-weight: 600;
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-error-container);
  background: var(--md-sys-color-error-container);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-sm);
}

.notif-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

/* M3 assist chip */
.notif-filter-btn {
  font-family: var(--md-sys-typescale-font-family);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-sm);
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  min-height: 32px;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard),
              color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  position: relative;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.notif-filter-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-on-surface);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

@media (hover: hover) {
  .notif-filter-btn:hover::after { opacity: var(--md-sys-state-hover-opacity); }
}

.notif-filter-btn:active::after { opacity: var(--md-sys-state-pressed-opacity); }

.notif-filter-btn--active {
  background: var(--md-sys-color-secondary-container);
  border-color: transparent;
  color: var(--md-sys-color-on-secondary-container);
}

.notif-filter-btn--urgent {
  background: var(--md-sys-color-warning-bg);
  border-color: transparent;
  color: var(--md-sys-color-warning-fg);
}

.notif-filter-btn--urgent.notif-filter-btn--active {
  background: var(--md-sys-color-warning-fg);
  color: var(--md-sys-color-warning-bg);
}

@media (max-width: 480px), (pointer: coarse) {
  .notif-filter-btn { min-height: 48px; padding: 10px 16px; }
}

.notif-panel-list { display: flex; flex-direction: column; gap: 6px; }

.notif-panel-item {
  padding: 16px;
  background: var(--md-sys-color-surface-container);
  border: none;
  border-radius: var(--md-sys-shape-corner-md);
  box-shadow: var(--md-sys-elevation-1);
}

/* Same symmetric treatment as .notif-item above. The panel variant is a floating
   card whose base declares `border: none`, so these replace it outright. */
.notif-panel-item.unread {
  border: 1px solid var(--md-sys-color-primary);
}

.notif-panel-item--critical {
  border: 1px solid var(--md-sys-color-error);
  background: var(--md-sys-color-error-container);
}

.notif-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.notif-panel-title {
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  letter-spacing: var(--md-sys-typescale-title-medium-tracking);
  color: var(--md-sys-color-on-surface);
  flex: 1;
}

.notif-panel-time {
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
}

.notif-panel-body {
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  color: var(--md-sys-color-on-surface);
}

.notif-panel-source {
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 4px;
}

.notif-panel-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.notif-priority {
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  padding: 1px 8px;
  border-radius: var(--md-sys-shape-corner-sm);
  font-weight: 600;
  text-transform: uppercase;
}

.notif-priority--critical { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

.notif-priority--high { background: var(--md-sys-color-warning-bg); color: var(--md-sys-color-warning-fg); }

.notif-priority--low { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }

.notif-approval-message {
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-sm);
  padding: 8px 10px;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

.notif-approval-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* Approve is the AFFIRMATIVE action, so it takes the the brand primary primary rather
   than green. Reject stays red and Defer stays amber: those two are warnings and
   their colours are not banned. The three are still trivially distinguishable. */
.notif-btn-approve { background: var(--accent-subtle) !important; color: var(--md-sys-color-primary) !important; border-color: var(--md-sys-color-primary) !important; }

.notif-btn-approve:hover { background: var(--md-sys-color-primary) !important; color: var(--md-sys-color-on-primary) !important; }

.notif-btn-reject { background: var(--md-sys-color-error-container) !important; color: var(--md-sys-color-on-error-container) !important; border-color: var(--md-sys-color-error) !important; }

.notif-btn-reject:hover { background: var(--md-sys-color-error) !important; color: var(--md-sys-color-on-error) !important; }

.notif-btn-defer { background: var(--md-sys-color-warning-bg) !important; color: var(--md-sys-color-warning-fg) !important; border-color: var(--md-sys-color-warning-fg) !important; }

.notif-btn-defer:hover { background: var(--md-sys-color-warning-fg) !important; color: var(--md-sys-color-warning-bg) !important; }

.notif-approval-status {
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line);
  font-weight: 600;
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: var(--md-sys-shape-corner-sm);
  display: inline-block;
}

.notif-approval-status--approved { background: var(--accent-subtle); color: var(--md-sys-color-primary); }

.notif-approval-status--rejected { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

.notif-approval-status--deferred { background: var(--md-sys-color-warning-bg); color: var(--md-sys-color-warning-fg); }

@media (max-width: 400px) {
  .notif-panel-header { gap: 6px; }
  .notif-panel-actions { flex-wrap: wrap; }
  .notif-approval-bar { flex-wrap: wrap; }
}

@media (pointer: coarse) {
  #notif-bell { min-width: 48px; min-height: 48px; }
}

/* ── Wide layout ──────────────────────────────────────────────────────────────
   Notifications are chronological, so tiling them into a card grid would break
   the one thing that gives the list meaning: reading order. Column-major grid
   flow puts item 2 below item 1 but item 5 at the top of the next column, which
   is worse UX than the narrow column it replaced. So the space buys a master /
   detail split instead — the banner, the filter chips and the bulk actions move
   into a left rail where they stay visible while the list scrolls, and the list
   itself gets the remaining width. Host contract: public/styles/panel-layout.css

   .panel-actions-row is a SHARED class (memory uses it too), so every rule that
   touches it is scoped to this panel's root. */

.notif-panel-enter { --panel-max-wide: 1400px; }

@media (min-width: 1024px) {
  .notif-panel-enter {
    display: grid;
    grid-template-columns: minmax(0, var(--panel-aside)) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr;
    gap: 12px 24px;
    align-items: start;
  }

  .notif-panel-enter > .notif-banner       { grid-column: 1; grid-row: 1; }
  .notif-panel-enter > .notif-filters      { grid-column: 1; grid-row: 2; }
  .notif-panel-enter > .panel-actions-row  { grid-column: 1; grid-row: 3; }
  .notif-panel-enter > .notif-panel-list   { grid-column: 2; grid-row: 1 / -1; }
  /* Empty state sits where the list would. */
  .notif-panel-enter > .panel-empty        { grid-column: 2; grid-row: 1 / -1; }

  /* In a 360px rail the chips and buttons read better stacked than wrapped. */
  .notif-panel-enter > .notif-filters { flex-wrap: wrap; }
  .notif-panel-enter > .panel-actions-row { flex-wrap: wrap; }
}
