/*
 * Namirial design system - messages and growl (SWEIDAW-3530).
 * DS v2 (Namirial Design System 2026): callout colours mapped onto the
 * --nds-callout-<intent>-* component tokens, radius/padding onto the Callout spec
 * (radius-xs "callouts", space-md "card and callout padding") and the growl shadow
 * onto --nds-shadow-second-floor ("popovers, dialogs") of namirial-ds-tokens.css.
 * Loaded only for the default Namirial template (wizard steps, spidSelf, error pages);
 * partner LRAs (wizard-conf/custom) never load this file.
 *
 * The "Messages and growl: DS callouts" section below was moved VERBATIM from
 * namirial-ds.css (same selectors, same specificity, same position relative to
 * namirial-ds-support.css / namirial-ds-steps.css), so the cascade on the wizard steps
 * is unchanged. It is loaded by include/wizardTemplateView.xhtml (commoninclude
 * template only), spidSelf.xhtml and errors/401.xhtml; the last two never loaded
 * namirial-ds.css and showed the raw Ultima theme growl before this file existed.
 *
 * The "Growl completion" section finishes the widget on every page that loads this
 * file: DS radius and soft shadow instead of the Material ones, 16px from the right
 * edge of the viewport, Lucide severity icons instead of the Material font glyphs and
 * an always-visible close button (the growl is sticky on spidSelf and for the
 * error/fatal messages of the wizard steps).
 */

/* ------------------------------------------------------------------ Messages and growl: DS callouts */

/* PORTAL pattern: background callout-<intent>-background, 4px left bar
   callout-<intent>-additional, text callout-<intent>-foreground, icon
   callout-<intent>-additional (identical values to the old *-50/*-700/*-950 triple).
   DS v2 Callout spec: radius-xs ("sm buttons and inputs, callouts") and space-md
   ("card and callout padding"). The growl containers carry the extra
   .ui-state-highlight class (verified in the PF 6.2 growl widget js:
   "ui-growl-item-container ui-state-highlight ui-corner-all ui-helper-hidden
   ui-shadow ui-growl-<severity>"): the 4th class raises these selectors to
   (0,4,1), above "body .ui-growl > .ui-growl-item-container.ui-growl-error" (0,3,1) of
   ultima-layout/css/crossLraStyles.css (#d92510), which loads at the END of the body, i.e.
   AFTER this file: it can only be beaten on specificity, not on order. fatal = error. */
body .ui-messages .ui-messages-info,
body .ui-message.ui-message-info,
body .ui-growl > .ui-growl-item-container.ui-growl-info.ui-state-highlight {
  background-color: var(--nds-callout-info-background);
  border: 0 none;
  border-left: 4px solid var(--nds-callout-info-additional);
  border-radius: var(--nds-radius-xs);
  padding: var(--nds-space-md);
  color: var(--nds-callout-info-foreground);
}

body .ui-messages .ui-messages-warn,
body .ui-message.ui-message-warn,
body .ui-growl > .ui-growl-item-container.ui-growl-warn.ui-state-highlight {
  background-color: var(--nds-callout-warning-background);
  border: 0 none;
  border-left: 4px solid var(--nds-callout-warning-additional);
  border-radius: var(--nds-radius-xs);
  padding: var(--nds-space-md);
  color: var(--nds-callout-warning-foreground);
}

body .ui-messages .ui-messages-error,
body .ui-messages .ui-messages-fatal,
body .ui-message.ui-message-error,
body .ui-message.ui-message-fatal,
body .ui-growl > .ui-growl-item-container.ui-growl-error.ui-state-highlight,
body .ui-growl > .ui-growl-item-container.ui-growl-fatal.ui-state-highlight {
  background-color: var(--nds-callout-negative-background);
  border: 0 none;
  border-left: 4px solid var(--nds-callout-negative-additional);
  border-radius: var(--nds-radius-xs);
  padding: var(--nds-space-md);
  color: var(--nds-callout-negative-foreground);
}

/* Icon-only messages (p:message display="icon": the checkbox validations of the terms step,
   privacyApproval.xhtml and siblings). PrimeFaces 6.2 renders them as
   "ui-message ui-message-<severity> ui-widget ui-corner-all ui-message-icon-only" containing
   only a "!" icon span (verified in the repacked MessageRenderer: "ui-message-icon-only
   ui-helper-clearfix"): the callout above would draw a small pink box with a red bar around
   the lone glyph, so icon-only variants get no box at all, just the coloured icon. The extra
   .ui-message-icon-only class puts this selector at (0,3,1), above the callout's (0,2,1).
   The icon colour needs no extra rule: "body .ui-message.ui-message-error
   .ui-message-error-icon" (and the warn/info twins) below already paint it *-700. */
body .ui-message.ui-message-icon-only {
  background: transparent;
  border: 0 none;
  padding: 0;
  box-shadow: none;
}

/* Message icons (title bar icon and close icon): callout-<intent>-additional, not white anymore */
body .ui-messages .ui-messages-info .ui-messages-info-icon,
body .ui-message.ui-message-info .ui-message-info-icon,
body .ui-growl .ui-growl-item-container.ui-growl-info .ui-growl-image,
body .ui-growl .ui-growl-item-container.ui-growl-info .ui-growl-icon-close {
  color: var(--nds-callout-info-additional);
}

body .ui-messages .ui-messages-warn .ui-messages-warn-icon,
body .ui-message.ui-message-warn .ui-message-warn-icon,
body .ui-growl .ui-growl-item-container.ui-growl-warn .ui-growl-image,
body .ui-growl .ui-growl-item-container.ui-growl-warn .ui-growl-icon-close {
  color: var(--nds-callout-warning-additional);
}

body .ui-messages .ui-messages-error .ui-messages-error-icon,
body .ui-message.ui-message-error .ui-message-error-icon,
body .ui-growl .ui-growl-item-container.ui-growl-error .ui-growl-image,
body .ui-growl .ui-growl-item-container.ui-growl-error .ui-growl-icon-close {
  color: var(--nds-callout-negative-additional);
}

/* Growl title and text: callout-<intent>-foreground instead of the theme's white.
   One rule per severity (same (0,4,1) specificity the shared rule had): the theme
   competitor "body .ui-growl .ui-growl-item .ui-growl-message" (0,3,1) paints it
   white directly on .ui-growl-message, so inheritance from the callout containers
   above is not enough and a targeted rule per severity is needed. error and fatal
   share the negative callout, like the callout colours. */
body .ui-growl .ui-growl-item-container.ui-growl-info .ui-growl-message {
  color: var(--nds-callout-info-foreground);
}
body .ui-growl .ui-growl-item-container.ui-growl-warn .ui-growl-message {
  color: var(--nds-callout-warning-foreground);
}
body .ui-growl .ui-growl-item-container.ui-growl-error .ui-growl-message,
body .ui-growl .ui-growl-item-container.ui-growl-fatal .ui-growl-message {
  color: var(--nds-callout-negative-foreground);
}

/* ------------------------------------------------------------------ Growl completion */

/* Widget markup (growl widget js of components.js + browser check on spidSelf): the wrapper
   is "<div id='<clientId>_container' class='ui-growl ui-widget'>" appended to the body;
   each message is ".ui-growl-item-container .ui-state-highlight .ui-corner-all
   .ui-helper-hidden .ui-shadow .ui-growl-<sev>" containing ".ui-growl-item" with the close
   icon FIRST ("<div class='ui-growl-icon-close ui-icon ui-icon-closethick'
   style='display:none'>"), then the severity image. NOTE: the js writes the image as
   "<span class='ui-growl-image ui-growl-image-<sev>' />" but the HTML parser does not
   self-close spans, so the span stays open and WRAPS ".ui-growl-message"
   ("span.ui-growl-title" + "p") plus a trailing "<div style='clear: both;'>".

   Competitors, all earlier in the cascade on every page that loads this file (theme.css =
   commoninclude/assets/css/theme.css on spidSelf and the wizard steps,
   ultima-layout/css/theme.css on the error pages; both carry the same growl rules):
   - components.css (PF core): ".ui-growl" (0,1,0) top 20px right 20px width 301px;
     ".ui-growl-item-container" (0,1,0) position:relative; ".ui-growl-item" (0,1,0) padding
     10px 15px; ".ui-growl-title" (0,1,0) bold; ".ui-growl-message" (0,1,0) 220px floated
     right; ".ui-growl-icon-close" (0,1,0) absolute top 5px right 3px; bare ".ui-icon"
     (0,1,0) margin-top -.25em / position:relative (the close icon carries ui-icon).
   - theme.css: "body .ui-growl" (0,1,1) top 90px right 10px; "body .ui-growl >
     .ui-growl-item-container.ui-shadow" (0,3,1) material box-shadow; "body .ui-growl
     .ui-growl-item .ui-growl-image" (0,3,1) background:none padding 4px; "body .ui-growl
     .ui-growl-item .ui-growl-image.ui-growl-image-<sev>" (0,4,1) display:contents (Material
     font icon box) and its ":before" (0,4,2) the Material glyph; "body .ui-growl
     .ui-growl-item .ui-growl-message" (0,3,1) white, 240px, margin-left 10px;
     "body .ui-growl .ui-growl-item .ui-growl-icon-close" (0,3,1) white Material 24px and
     its ":before" (0,3,2) the Material glyph.
   - commoninclude/assets/css/common.css (spidSelf and the wizard steps, SWEIDAW-472):
     "body .ui-growl" (0,1,1) right 0, max-width fit-content; "body .ui-growl-item" (0,1,1)
     flex row; at max-width 400px "div#wizard\:messages_container" width/max-width 100%
     !important (kept: full-width growl on mobile wizard).
   - ultima-layout/css/crossLraStyles.css (wizard steps only) loads at the END of the body,
     i.e. AFTER this file: its only growl rule is "body .ui-growl > .ui-growl-item-container
     .ui-growl-error" background-color #d92510 (0,3,1), already beaten on background by the
     (0,4,1) callout above; none of the properties below collides with it.
   Every selector below ties with its strongest competitor and wins by source order. */

/* Wrapper: 16px from the right edge (theme 10px, common.css 0), below the page top bars -
   the spidSelf white navbar (.nds-landing-navbar: 16px padding + 32px logo + 1px divider
   = 65px, namirial-landing.css) and the wizard dark header bar; the theme's 90px, kept,
   clears both. Fixed 360px like the theme's 301px (NOT width auto: with the flex item
   below, a shrink-to-fit wrapper would collapse around the 20px icon, and common.css
   "max-width: fit-content" (0,1,1) is beaten by this later rule anyway), clamped to the
   viewport minus the two 16px margins on mobile. */
body .ui-growl {
  top: 90px;
  right: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
}

/* Container: DS radius and the second-floor shadow (popovers/dialogs; the material one
   comes from the theme .ui-shadow rule, (0,3,1)) and the Callout padding (space-md)
   that keeps the text off the 4px severity bar.
   .ui-state-highlight is always on the growl containers (growl widget js). */
body .ui-growl > .ui-growl-item-container.ui-state-highlight {
  border-radius: var(--nds-radius-xs); /* was 3px (theme body .ui-corner-all) */
  box-shadow: var(--nds-shadow-second-floor); /* was the theme material shadow */
  padding: var(--nds-space-md);
}

/* Item: no own padding (components.css 10px 15px) - the container padding above already
   distances the content from the bar and the edges; the flex row of common.css (SWEIDAW-472)
   is replicated so the error pages, which do not load it, get the same layout. The 12px
   gap separates the ::before severity icon from the message (the icon is a flex item, see
   below); flex-start keeps the icon on the title line instead of stretching it to the
   height of the detail. */
body .ui-growl .ui-growl-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 0;
}

/* Severity icon span: KEEP the theme's display:contents. In this repacked PF 6.2 the growl
   widget js emits '<span class="ui-growl-image ui-growl-image-<sev>" />' followed by the
   message div, and the HTML parser does NOT treat "<span .../>" as self-closing: the span
   stays OPEN and WRAPS ".ui-growl-message" and the trailing clear-both div (browser-checked
   on spidSelf). Sizing/masking the span itself (inline-block, 20px) would therefore squeeze
   the wrapped message to zero width - the theme's display:contents is what promotes the
   message to a real flex item of .ui-growl-item. The span generates no box: width, height,
   padding, background and mask on it would all be ignored anyway. */
body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-info,
body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-warn,
body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-error,
body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-fatal {
  display: contents;
}

/* Severity icon, drawn on the span ::before: a pseudo-element of a display:contents
   element still generates its own box as a child of .ui-growl-item, i.e. it IS the flex
   item that sits before the promoted .ui-growl-message (the 12px gap of the item rule
   separates the two). PORTAL pattern (see the Lucide section of namirial-ds.css): 20px
   Lucide mask instead of the theme's Material font glyph; the same :before selectors as
   the theme glyph rules (0,4,2), beaten here by source order, so both the content and the
   font are replaced. The callout-<intent>-additional colour is set directly instead of
   relying on inheritance through the display:contents span. error and fatal share the
   alert icon, like the callout colours. */
body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-info:before {
  content: ""; /* replaces the Material font glyph of the theme :before rule */
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px; /* optical alignment with the 16px title line */
  background-color: var(--nds-callout-info-additional);
  -webkit-mask: url("/wizard/javax.faces.resource/images/icons/lucide-info.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") no-repeat center / contain;
  mask: url("/wizard/javax.faces.resource/images/icons/lucide-info.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") no-repeat center / contain;
}

body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-warn:before {
  content: "";
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  background-color: var(--nds-callout-warning-additional);
  -webkit-mask: url("/wizard/javax.faces.resource/images/icons/lucide-triangle-exclamation-point.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") no-repeat center / contain;
  mask: url("/wizard/javax.faces.resource/images/icons/lucide-triangle-exclamation-point.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") no-repeat center / contain;
}

body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-error:before,
body .ui-growl .ui-growl-item .ui-growl-image.ui-growl-image-fatal:before {
  content: "";
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  background-color: var(--nds-callout-negative-additional);
  -webkit-mask: url("/wizard/javax.faces.resource/images/icons/lucide-circle-alert.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") no-repeat center / contain;
  mask: url("/wizard/javax.faces.resource/images/icons/lucide-circle-alert.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") no-repeat center / contain;
}

/* Clear-both helper of the growl widget markup: with the span at display:contents it is
   promoted to a flex item of .ui-growl-item (an empty 0x0 box, but flex still reserves
   its gap slot next to the message) - hidden. */
body .ui-growl .ui-growl-item .ui-growl-image > div[style*="clear"] {
  display: none;
}

/* Title: 700 / 16px (components.css bold, theme default size). The
   callout-<intent>-foreground colour comes by inheritance from the per-severity text
   rules of the callout section above. */
body .ui-growl .ui-growl-title {
  display: block;
  font-weight: 700;
  font-size: 16px;
  padding: 0 0 2px 0; /* was 0 0 7px (components.css .ui-growl-title) */
}

/* Detail: 14px / 1.4 (components.css .ui-growl-message p inherits the body size). */
body .ui-growl .ui-growl-item .ui-growl-message p {
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  padding: 0;
}

/* Message box: unfloated and unfixed (components.css floats it right at 220px, the theme
   fixes 240px); it is a flex item of .ui-growl-item (promoted there by the
   display:contents of the wrapping .ui-growl-image span) and fills the row next to the
   ::before icon; min-width: 0 lets it shrink inside the fixed-width wrapper. The 32px
   right padding keeps the text off the close icon (12px inset + 20px icon). */
body .ui-growl .ui-growl-item .ui-growl-message {
  float: none;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0; /* was 10px (theme): the item gap above sets the spacing */
  padding: 0 32px 0 0;
}

/* Close button: PrimeFaces renders it with an inline style="display:none" and only shows
   it on container hover - useless on a sticky growl, so display:block wins over the inline
   style with !important. The div also carries .ui-icon .ui-icon-closethick: the bare
   .ui-icon base (0,1,0, margin-top -.25em) is fully reset here, and the sprite rules of
   the .fa/.pi families do not match (no such class), so a plain background-color works;
   background-image: none also clears the .ui-icon-closethick sprite position, which would
   otherwise paint behind the mask on the layouts that still ship jQuery UI sprites.
   20px Lucide mask in the callout-<intent>-additional severity colour (set by the icon
   rules of the callout section above), top-right inside the container
   (position:relative, components.css). */
body .ui-growl .ui-growl-item .ui-growl-icon-close {
  display: block !important; /* beats the inline display:none of the growl widget js */
  position: absolute; /* was top 5px right 3px (components.css .ui-growl-icon-close) */
  top: 12px;
  right: 12px;
  margin-top: 0; /* was -.25em (components.css .ui-icon) */
  width: 20px;
  height: 20px;
  cursor: pointer;
  background-image: none; /* the .ui-icon-closethick sprite position */
  background-color: currentColor; /* the callout-<intent>-additional of the callout icon rules */
  -webkit-mask: url("/wizard/javax.faces.resource/images/icons/lucide-x.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") center / 20px 20px no-repeat;
  mask: url("/wizard/javax.faces.resource/images/icons/lucide-x.svg.xhtml;jsessionid=gRL0ZZoDUPv8iYyvwXiwt8duBMLYkvymabU0_FsP.onboarding2.namirialtsp.com?ln=namirial&v=20261201213327") center / 20px 20px no-repeat;
}

body .ui-growl .ui-growl-item .ui-growl-icon-close:before {
  content: none; /* the Material font glyph */
}

/* ------------------------------------------------------------------ Growl stack */

/* SWEIDAW-3530: the two p:growl tags of the wizard steps (SWEIDAW-973: info/warn with
   life=5000, error/fatal sticky) each get their own position:fixed container from the PF
   6.2 growl widget js, appended to the body at the very same place - the "body .ui-growl"
   rule above - so when messages of both kinds arrive together one box covers the other.
   js/namirial-growl-stack.js (default template only) moves every body-level growl container
   into one .nds-growl-stack flex column: error/fatal first, then info/warn, 8px apart.

   The stack carries the fixed position the containers had (same offsets and width as the
   "body .ui-growl" wrapper rule above); the containers become plain flex items of the
   column. "body .nds-growl-stack > .ui-growl" (0,2,1) outguns the wrapper rule above and
   the theme.css / common.css "body .ui-growl" twins (0,1,1) on every property it resets,
   and the containers have no inline top/right/width from the widget js (it only writes
   z-index inline).

   The common.css small-screen rule "div#wizard\:messages_container" width/max-width 100%
   !important (1,1,1, kept in SWEIDAW-472) still beats this reset for the info/warn
   container on mobile: 100% of the stack is the stack's own 360px clamped to
   calc(100vw - 32px), i.e. the same full-width mobile growl as before, just inside the
   column. pointer-events: none on the stack so the empty area under the messages never
   blocks clicks on the page; auto on the containers keeps the close button of the sticky
   error growl working. The stack z-index is set by the js (mirror of the children's
   inline z-index), never here. */
body .nds-growl-stack {
  position: fixed;
  top: 90px;
  right: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

body .nds-growl-stack > .ui-growl {
  position: static;
  top: auto;
  right: auto;
  left: auto;
  width: auto;
  max-width: none;
  pointer-events: auto;
}

/* An idle growl container is empty markup: the widget js removes the last item with
   jQuery remove() and leaves the wrapper with no child nodes (all growl content is
   created by the js, there are no text nodes), so :empty keeps the idle container out of
   the layout - no box and no flex gap slot between the visible ones. */
body .nds-growl-stack > .ui-growl:empty {
  display: none;
}
