/* Shared status language.
 *
 * State is carried by data-status-state where possible. Legacy selectors are
 * included while existing surfaces migrate, but they resolve to the same
 * palette, symbols and glow here. Configuration is violet "C", never a green
 * health check. Animation is opt-in and only valid for a currently live fact.
 */
:root {
  --status-live: #69b7ff;
  --status-down: #ff7c8b;
  --status-issue: #ffd45b;
  --status-configured: #a98eff;
  --status-unknown: #a3abba;
  --status-standby: #7dd3fc;
}

[data-theme="light"],
[data-admin-theme="light"] {
  --status-live: #125fa8;
  --status-down: #b51f36;
  --status-issue: #765600;
  --status-configured: #6437b8;
  --status-unknown: #596475;
  --status-standby: #176b87;
}

:is(
  .snfx-status-indicator,
  .status-dot,
  .dash-dot,
  .dash-db-dot,
  .dash-recent-dot,
  .social-status-dot,
  .social-account-item .account-dot,
  .frost-status-dot,
  .arch-root .dot,
  .arch-count .arch-dot
) {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--status-unknown);
  background: color-mix(in srgb, currentColor 10%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, currentColor 20%, transparent);
  font: 800 10px/1 system-ui, sans-serif;
  vertical-align: middle;
}

:is(
  .snfx-status-indicator,
  .status-dot,
  .dash-dot,
  .dash-db-dot,
  .dash-recent-dot,
  .social-status-dot,
  .social-account-item .account-dot,
  .frost-status-dot,
  .arch-root .dot,
  .arch-count .arch-dot
)::before {
  content: '?';
}

:is([data-status-state="live"], .green, .is-live, .frost-status-dot[data-tone="ok"]) {
  color: var(--status-live);
}
:is([data-status-state="live"], .green, .is-live, .frost-status-dot[data-tone="ok"])::before {
  content: '\2713';
}

:is([data-status-state="down"], .red, .is-down, .frost-status-dot[data-tone="critical"]) {
  color: var(--status-down);
}
:is([data-status-state="down"], .red, .is-down, .frost-status-dot[data-tone="critical"])::before {
  content: '\00d7';
}

:is(
  [data-status-state="degraded"],
  [data-status-state="stale"],
  .yellow,
  .is-degraded,
  .is-stale,
  .frost-status-dot[data-tone="issue"]
) {
  color: var(--status-issue);
}
:is(
  [data-status-state="degraded"],
  [data-status-state="stale"],
  .yellow,
  .is-degraded,
  .is-stale,
  .frost-status-dot[data-tone="issue"]
)::before {
  content: '!';
}

:is([data-status-state="configured"], .is-configured) {
  color: var(--status-configured);
}
:is([data-status-state="configured"], .is-configured)::before {
  content: 'C';
  font-size: 8px;
}

:is(
  [data-status-state="standby"],
  [data-status-state="disabled"],
  .is-standby,
  .is-disabled,
  .disconnected,
  .draft,
  .frost-status-dot[data-tone="neutral"]
) {
  color: var(--status-standby);
}
:is(
  [data-status-state="standby"],
  [data-status-state="disabled"],
  .is-standby,
  .is-disabled,
  .disconnected,
  .draft,
  .frost-status-dot[data-tone="neutral"]
)::before {
  content: '\2013';
}

:is([data-status-state="unknown"], .is-unknown, .frost-status-dot[data-tone="unknown"]) {
  color: var(--status-unknown);
  box-shadow: none;
}

@keyframes snfx-status-live {
  0%, 100% { box-shadow: 0 0 5px color-mix(in srgb, currentColor 22%, transparent); }
  50% { box-shadow: 0 0 13px color-mix(in srgb, currentColor 55%, transparent); }
}

:is(.snfx-status-indicator, .status-dot, .dash-dot, .dash-db-dot, .social-status-dot, .frost-status-dot, .arch-root .dot):is([data-status-state="live"][data-status-animated="true"]) {
  animation: snfx-status-live 2.2s ease-in-out infinite;
}

.int-status-badge::before {
  content: '?';
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 10%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, currentColor 20%, transparent);
  font: 800 10px/1 system-ui, sans-serif;
}
.int-status-badge[data-status-state="live"] { color: var(--status-live); }
.int-status-badge[data-status-state="live"]::before { content: '\2713'; }
.int-status-badge[data-status-state="down"] { color: var(--status-down); }
.int-status-badge[data-status-state="down"]::before { content: '\00d7'; }
.int-status-badge[data-status-state="degraded"],
.int-status-badge[data-status-state="stale"],
.int-status-badge[data-status-state="testing"] { color: var(--status-issue); }
.int-status-badge[data-status-state="degraded"]::before,
.int-status-badge[data-status-state="stale"]::before { content: '!'; }
.int-status-badge[data-status-state="testing"]::before { content: '\2026'; }
.int-status-badge[data-status-state="configured"] { color: var(--status-configured); }
.int-status-badge[data-status-state="configured"]::before { content: 'C'; font-size: 8px; }
.int-status-badge[data-status-state="standby"],
.int-status-badge[data-status-state="disabled"] { color: var(--status-standby); }
.int-status-badge[data-status-state="standby"]::before,
.int-status-badge[data-status-state="disabled"]::before { content: '\2013'; }
.int-status-badge[data-status-state="unknown"] { color: var(--status-unknown); }

@media (prefers-reduced-motion: reduce) {
  :is(
    .snfx-status-indicator,
    .status-dot,
    .dash-dot,
    .dash-db-dot,
    .social-status-dot,
    .frost-status-dot,
    .arch-root .dot
  ) {
    animation: none !important;
  }
}
