/*
  Grid loading states (modules/grid-loading.js): skeleton rows with a diagonal wave of
  light, a caption over the table while a first page is out, and rows fading in when it
  lands. Same palette and motion as the Portal Usage loaders (portal_usage_loader.css):
  the dark sequential blues on the NextGen navy.
*/

.s3gl-host { position: relative; }

/* ---- skeleton cells --------------------------------------------------- */

.s3gl-cell {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
}
.ag-right-aligned-cell .s3gl-cell { justify-content: flex-end; }

/* The bar carries its cell's place in the wave as an animation delay (set by the
   renderer); it breathes, and its light inherits the delay. */
.s3gl-bar {
  position: relative;
  display: block;
  height: 0.7em;
  min-width: 18px;
  border-radius: 999px;
  background: rgba(134, 182, 239, 0.1);
  animation: s3gl-breathe 1.8s ease-in-out infinite;
}
.s3gl-bar-box { width: 14px; min-width: 14px; height: 14px; border-radius: 3px; }

/* The light: a brighter copy of the bar fading in and out as the wave passes. Opacity
   only, so it stays cheap with a screenful of cells animating. */
.s3gl-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(57, 135, 229, 0.55), rgba(183, 211, 246, 0.75), rgba(57, 135, 229, 0.55));
  box-shadow: 0 0 10px rgba(110, 168, 254, 0.55);
  opacity: 0;
  animation: s3gl-wave 1.8s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  animation-delay: inherit;
}
@keyframes s3gl-wave {
  0%, 100% { opacity: 0; }
  22% { opacity: 0.85; }
  48% { opacity: 0; }
}
@keyframes s3gl-breathe {
  0%, 100% { opacity: 0.75; }
  22% { opacity: 1; }
  60% { opacity: 0.6; }
}

/* A whole loading row as one element (SkeletonRow, for a grid that draws every column):
   static bars under the columns in view, the row itself carrying the wave. */
.s3gl-row-skeleton {
  position: relative;
  width: 100%;
  height: 100%;
  animation: s3gl-row-wave 1.8s cubic-bezier(0.45, 0, 0.25, 1) infinite;
}
.s3gl-row-skeleton .s3gl-bar {
  position: absolute;
  top: 50%;
  margin-top: -0.35em;
  background: linear-gradient(90deg, rgba(57, 135, 229, 0.42), rgba(134, 182, 239, 0.5));
  animation: none;
}
.s3gl-row-skeleton .s3gl-bar-box { margin-top: -7px; }
.s3gl-row-skeleton .s3gl-bar::after { display: none; }
@keyframes s3gl-row-wave {
  0%, 100% { opacity: 0.35; }
  22% { opacity: 1; }
  55% { opacity: 0.35; }
}

/* ---- caption ---------------------------------------------------------- */

.s3gl-caption {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(110, 168, 254, 0.28);
  /* Opaque rather than a backdrop blur: blurring the moving rows behind it every frame is
     costly on a retina screen while the page is still auto-scrolling. */
  background: rgba(3, 22, 51, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(3, 22, 51, 0.6), 0 0 28px rgba(57, 135, 229, 0.18);
  color: #e8f1fc;
  font-size: 14px; /* px, like the grid's own text: some pages shrink the root font */
  line-height: 1.3;
  white-space: nowrap;
}

/* Over the grid: centred on the rows, out of the way of the pointer (the user can still
   scroll, resize or switch tabs while it loads). */
.s3gl-floating {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 6px)) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.s3gl-floating.s3gl-in { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.s3gl-text { display: flex; flex-direction: column; gap: 2px; }
.s3gl-title { font-weight: 600; letter-spacing: 0.01em; }
.s3gl-sub { font-size: 12px; color: #b7d3f6; }
.s3gl-sub[hidden], .s3gl-time:empty { display: none; }
.s3gl-time {
  margin-left: 2px;
  padding-left: 14px;
  border-left: 1px solid rgba(183, 211, 246, 0.2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #86b6ef;
  min-width: 3.4em;
  text-align: right;
}

/* A grid loading all its rows at once: ag-grid's loading overlay, drawn as skeleton rows on
   the grid's columns with the caption over them (SkeletonLoadingOverlay). */
/* ag-grid dims everything under its loading overlay, headers included; this one draws its
   own body, so the headers stay as they are. */
.ag-overlay-loading-wrapper:has(> .s3gl-overlay) { background: transparent; }
.s3gl-overlay {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding-top: var(--s3gl-header-height, 0px); /* the headers stay in view */
  text-align: left;
}
.s3gl-overlay-body {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--ag-background-color);
}
.s3gl-overlay-row {
  position: relative;
  border-bottom: 1px solid var(--ag-row-border-color, rgba(255, 255, 255, 0.08));
}
/* Bars sit under their columns (placed in px by the overlay), vertically centred. */
.s3gl-overlay-row .s3gl-bar { position: absolute; top: 50%; margin-top: -0.35em; }
.s3gl-overlay-row .s3gl-bar-box { margin-top: -7px; }
/* Shown at once in the overlay, so it waits a beat like the lazy grids' caption. */
.s3gl-floating.s3gl-delayed { animation: s3gl-caption-in 0.22s ease 0.25s both; }
@keyframes s3gl-caption-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 6px)) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Cancel / Retry. The caption lets the pointer through to the grid; its button doesn't. */
.s3gl-action {
  pointer-events: auto;
  margin-left: 2px;
  padding: 4px 12px;
  border: 1px solid rgba(183, 211, 246, 0.45);
  border-radius: 8px;
  background: transparent;
  color: #e8f1fc;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.s3gl-action:hover, .s3gl-action:focus-visible { background: rgba(110, 168, 254, 0.18); border-color: #86b6ef; }
.s3gl-action:disabled { opacity: 0.5; cursor: default; }
.s3gl-action[hidden] { display: none; }

/* Cancelled: the scan stops and dims. */
.s3gl-stopped .s3gl-logo path { animation: none; stroke-dashoffset: 0; fill-opacity: 1; opacity: 0.3; }

/* The S3 mark (logoMarkup), drawing itself: each piece's outline traces in, fills, holds
   and fades. A stroke-dash animation repaints only this small mark. */
.s3gl-logo { width: 34px; height: 24px; flex: none; overflow: visible; }
.s3gl-logo path {
  stroke-width: 0.7;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  fill-opacity: 0;
  animation: s3gl-logo-draw 2.4s ease-in-out infinite;
}
.s3gl-logo-blue { stroke: #4fb0e6; fill: #288dc1; filter: drop-shadow(0 0 2px rgba(79, 176, 230, 0.7)); }
.s3gl-logo-green { stroke: #8fd46e; fill: #69b64a; filter: drop-shadow(0 0 2px rgba(143, 212, 110, 0.7)); animation-delay: 0.25s; }
@keyframes s3gl-logo-draw {
  0% { stroke-dashoffset: 1; fill-opacity: 0; opacity: 1; }
  40% { stroke-dashoffset: 0; fill-opacity: 0; }
  60% { fill-opacity: 1; }
  85% { stroke-dashoffset: 0; fill-opacity: 1; opacity: 1; }
  100% { stroke-dashoffset: 0; fill-opacity: 1; opacity: 0; }
}


/* A loading row can't be selected yet: no checkbox until it has data. */
.ag-row-loading .ag-selection-checkbox { visibility: hidden; }

/* ---- rows arriving ---------------------------------------------------- */

/* `translate`, never `transform`: ag-grid positions rows with an inline transform. */
.ag-row.s3gl-row-in {
  animation: s3gl-row-in 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--s3gl-i, 0) * 18ms);
}
@keyframes s3gl-row-in {
  from { opacity: 0; translate: 0 6px; }
  to { opacity: 1; translate: 0 0; }
}

/* ---- status bar: the total while it is being counted ------------------ */

.s3gl-count-bar {
  display: inline-block;
  width: 4.5em;
  height: 0.7em;
  margin-left: 0.25em;
  border-radius: 999px;
  vertical-align: middle;
  background: linear-gradient(90deg, rgba(57, 135, 229, 0.42), rgba(134, 182, 239, 0.5));
  animation: s3gl-count-pulse 1.6s ease-in-out infinite;
}
@keyframes s3gl-count-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* ---- motion off ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .s3gl-bar, .s3gl-bar::after, .s3gl-row-skeleton, .s3gl-logo path, .s3gl-count-bar, .ag-row.s3gl-row-in, .s3gl-floating.s3gl-delayed { animation: none !important; }
  .s3gl-bar::after { opacity: 0; }
  .s3gl-logo path { stroke-dashoffset: 0; fill-opacity: 1; }
  .s3gl-floating { transition: none; }
}
