/*
  Status dot + status badge components.

  Hand-authored on purpose: `workspace/css/workspace.css` and
  `interview/css/interview.css` are Tailwind BUILD OUTPUTS (see the
  `build:workspace-css` / `build:interview-css` scripts in package.json), and
  Tailwind only emits classes it finds while scanning templates and JS. A
  component expressed as utility soup would therefore vanish from the bundle
  until someone re-ran the build, and the ripple animation below cannot be
  expressed in stock Tailwind 3 utilities at all. Keeping these rules in their
  own stylesheet means the components render correctly with no build step.

  Dark mode in this app hangs off [data-theme="midnight"] (see theme.css) --
  there is no `.dark` class, so the upstream `dark:` variants are re-expressed
  as [data-theme="midnight"] rules at the bottom of each section.

  Ripple colours are pre-mixed rgba() rather than color-mix(), so the animation
  degrades gracefully on engines without color-mix() support instead of
  rendering an invisible ring.
*/

/* ---------------------------------------------------------------------------
   Tokens
   --------------------------------------------------------------------------- */

:root {
  --status-dot-neutral: #6d7480;
  --status-dot-neutral-ripple: rgba(109, 116, 128, 0.48);
  --status-dot-queued: #d1d5db;
  --status-dot-queued-ripple: rgba(209, 213, 219, 0.48);
  --status-dot-canceled: #9ca3af;
  --status-dot-canceled-ripple: rgba(156, 163, 175, 0.48);
  --status-dot-active: #0ea5e9;
  --status-dot-active-ripple: rgba(14, 165, 233, 0.48);
  --status-dot-success: #14b8a6;
  --status-dot-success-ripple: rgba(20, 184, 166, 0.48);
  --status-dot-warning: #f59e0b;
  --status-dot-warning-ripple: rgba(245, 158, 11, 0.48);
  --status-dot-error: #dc2626;
  --status-dot-error-ripple: rgba(220, 38, 38, 0.48);

  /* Badge palette. Backgrounds are the reference design's soft tints exactly
     (orange / rose / emerald / sky / yellow / zinc / violet). Foregrounds are
     darkened to the same hue's 700 shade: the reference's own text colours --
     #EAA65D on #fff7ed, #57BC6C on #ecfdf5, #F0B13D on #fefce8 -- land near
     1.9:1 contrast, which fails WCAG AA (4.5:1) and even the 3:1 large-text
     floor, so status text would be genuinely hard to read in a dense table.
     The tint, the icon and the pill shape carry the design's character; only
     the text is darkened enough to be legible. */
  --status-badge-pending-bg: #fff7ed;
  --status-badge-pending-fg: #c2410c;
  --status-badge-failed-bg: #fff1f2;
  --status-badge-failed-fg: #be123c;
  --status-badge-success-bg: #ecfdf5;
  --status-badge-success-fg: #047857;
  --status-badge-progress-bg: #e0f2fe;
  --status-badge-progress-fg: #0369a1;
  --status-badge-review-bg: #fefce8;
  --status-badge-review-fg: #a16207;
  --status-badge-expired-bg: #f4f4f5;
  --status-badge-expired-fg: #52525b;
  --status-badge-submitted-bg: #f5f3ff;
  --status-badge-submitted-fg: #6d28d9;
  --status-badge-neutral-bg: #f5f7fa;
  --status-badge-neutral-fg: #475569;
}

[data-theme="midnight"] {
  --status-dot-neutral: #9a958a;
  --status-dot-neutral-ripple: rgba(154, 149, 138, 0.58);
  --status-dot-queued: #9ca3af;
  --status-dot-queued-ripple: rgba(156, 163, 175, 0.58);
  --status-dot-canceled: #6b7280;
  --status-dot-canceled-ripple: rgba(107, 114, 128, 0.58);
  --status-dot-active: #38bdf8;
  --status-dot-active-ripple: rgba(56, 189, 248, 0.58);
  --status-dot-success: #2dd4bf;
  --status-dot-success-ripple: rgba(45, 212, 191, 0.58);
  --status-dot-warning: #fbbf24;
  --status-dot-warning-ripple: rgba(251, 191, 36, 0.58);
  --status-dot-error: #f87171;
  --status-dot-error-ripple: rgba(248, 113, 113, 0.58);

  --status-badge-pending-bg: rgba(245, 158, 11, 0.16);
  --status-badge-pending-fg: #f4bd76;
  --status-badge-failed-bg: rgba(248, 113, 113, 0.16);
  --status-badge-failed-fg: #f79c8c;
  --status-badge-success-bg: rgba(45, 212, 191, 0.16);
  --status-badge-success-fg: #6fdcbe;
  --status-badge-progress-bg: rgba(56, 189, 248, 0.16);
  --status-badge-progress-fg: #7cc9f5;
  --status-badge-review-bg: rgba(250, 204, 21, 0.16);
  --status-badge-review-fg: #e8c86a;
  --status-badge-expired-bg: rgba(148, 163, 184, 0.16);
  --status-badge-expired-fg: #a8a49a;
  --status-badge-submitted-bg: rgba(139, 92, 246, 0.18);
  --status-badge-submitted-fg: #b39bf7;
  --status-badge-neutral-bg: rgba(148, 163, 184, 0.14);
  --status-badge-neutral-fg: #a8a49a;
}

/* ---------------------------------------------------------------------------
   Status dot
   --------------------------------------------------------------------------- */

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  vertical-align: middle;
  --status-dot-color: var(--status-dot-neutral);
  --status-dot-ripple-color: var(--status-dot-neutral-ripple);
  --status-dot-size: 8px;
  --status-dot-box: 20px;
  --status-dot-spread: 9px;
}

.status-dot--block {
  display: flex;
}

.status-dot__indicator {
  position: relative;
  flex-shrink: 0;
  overflow: visible;
  width: var(--status-dot-box);
  height: var(--status-dot-box);
}

.status-dot__core,
.status-dot__ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--status-dot-size);
  height: var(--status-dot-size);
  border-radius: 9999px;
  transform: translate(-50%, -50%);
}

.status-dot__core {
  background-color: var(--status-dot-color);
}

.status-dot__ripple {
  pointer-events: none;
  /* Inert unless the dot opts into animation, so a table full of settled
     statuses does not paint dozens of pulsing rings. */
  display: none;
}

.status-dot.is-animated .status-dot__ripple {
  display: block;
  animation: nv-status-dot-ripple 2.25s ease-out infinite;
}

.status-dot.is-animated .status-dot__ripple:nth-child(2) {
  animation-delay: 1.125s;
}

@keyframes nv-status-dot-ripple {
  0% {
    box-shadow: 0 0 0 0 var(--status-dot-ripple-color);
  }
  72% {
    box-shadow: 0 0 0 var(--status-dot-spread) transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.status-dot__label {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-muted, #6d7480);
}

/* Sizes */
.status-dot--sm {
  --status-dot-size: 6px;
  --status-dot-box: 14px;
  --status-dot-spread: 7px;
  gap: 0.375rem;
}

.status-dot--sm .status-dot__label {
  font-size: 0.75rem;
}

.status-dot--md {
  --status-dot-size: 8px;
  --status-dot-box: 20px;
  --status-dot-spread: 9px;
}

.status-dot--lg {
  --status-dot-size: 10px;
  --status-dot-box: 26px;
  --status-dot-spread: 11px;
}

.status-dot--lg .status-dot__label {
  font-size: 0.875rem;
}

/* Tones */
.status-dot--neutral {
  --status-dot-color: var(--status-dot-neutral);
  --status-dot-ripple-color: var(--status-dot-neutral-ripple);
}

.status-dot--active {
  --status-dot-color: var(--status-dot-active);
  --status-dot-ripple-color: var(--status-dot-active-ripple);
}

.status-dot--success {
  --status-dot-color: var(--status-dot-success);
  --status-dot-ripple-color: var(--status-dot-success-ripple);
}

.status-dot--warning {
  --status-dot-color: var(--status-dot-warning);
  --status-dot-ripple-color: var(--status-dot-warning-ripple);
}

.status-dot--error {
  --status-dot-color: var(--status-dot-error);
  --status-dot-ripple-color: var(--status-dot-error-ripple);
}

.status-dot--queued {
  --status-dot-color: var(--status-dot-queued);
  --status-dot-ripple-color: var(--status-dot-queued-ripple);
}

.status-dot--canceled {
  --status-dot-color: var(--status-dot-canceled);
  --status-dot-ripple-color: var(--status-dot-canceled-ripple);
}

@media (prefers-reduced-motion: reduce) {
  .status-dot.is-animated .status-dot__ripple {
    animation: none;
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Status badge
   --------------------------------------------------------------------------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.125rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
  background-color: var(--status-badge-neutral-bg);
  color: var(--status-badge-neutral-fg);
}

.status-badge__icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}

.status-badge__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Table density: the reference design's 35px pill is too tall for a data row. */
.status-badge--sm {
  min-height: 1.75rem;
  padding: 0.125rem 0.5rem;
  gap: 0.375rem;
  border-radius: 0.625rem;
  font-size: 0.75rem;
}

.status-badge--sm .status-badge__icon {
  width: 0.875rem;
  height: 0.875rem;
}

/* Fixed-width pill, matching the reference design, for summary/detail cards. */
.status-badge--block {
  width: 10rem;
  max-width: 100%;
}

.status-badge--pending {
  background-color: var(--status-badge-pending-bg);
  color: var(--status-badge-pending-fg);
}

.status-badge--failed {
  background-color: var(--status-badge-failed-bg);
  color: var(--status-badge-failed-fg);
}

.status-badge--success {
  background-color: var(--status-badge-success-bg);
  color: var(--status-badge-success-fg);
}

.status-badge--progress {
  background-color: var(--status-badge-progress-bg);
  color: var(--status-badge-progress-fg);
}

.status-badge--review {
  background-color: var(--status-badge-review-bg);
  color: var(--status-badge-review-fg);
}

.status-badge--expired {
  background-color: var(--status-badge-expired-bg);
  color: var(--status-badge-expired-fg);
}

.status-badge--submitted {
  background-color: var(--status-badge-submitted-bg);
  color: var(--status-badge-submitted-fg);
}

.status-badge--neutral {
  background-color: var(--status-badge-neutral-bg);
  color: var(--status-badge-neutral-fg);
}

/* Opt-in spin for the dashed "in progress" ring. Off by default so a table of
   25 in-progress rows does not spin 25 times. */
.status-badge.is-animated .status-badge__icon {
  animation: nv-status-badge-spin 3.2s linear infinite;
}

@keyframes nv-status-badge-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-badge.is-animated .status-badge__icon {
    animation: none;
  }
}
