/* =========================================================================
   Component — the four view states
   -------------------------------------------------------------------------
   Every view that fetches renders ALL FOUR: loading, empty, error, forbidden.
   (The sign-in form is not such a view — see FRONTEND_STRUCTURE.md.) A 403 is
   shown AS a 403 — never as an empty list, because "no permission" and "no
   data" look identical once they collapse into the same empty state, and the
   permission bug then hides forever.
   ========================================================================= */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
  border: 1px solid var(--doc-line);
  border-radius: var(--radius-lg);
  background: var(--doc-panel);
}

.state-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.state-detail {
  margin: 0;
  max-width: 56ch;
  font-size: 14px;
  color: var(--doc-ink-soft);
}

.state-code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--doc-ink-soft);
  word-break: break-all;
}

.state-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.state-error {
  border-color: var(--sd-error-bd);
  background: var(--sd-error-bg);
}

.state-forbidden {
  border-color: var(--sd-warning-bd);
  background: var(--sd-warning-bg);
}

/* --- Loading: a spinner plus a live-region label ------------------------- */

.state-loading .spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--sd-border);
  border-top-color: var(--sd-secondary);
  border-radius: 50%;
  animation: sd-spin .8s linear infinite;
}

@keyframes sd-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .state-loading .spinner {
    animation: none;
    border-top-color: var(--sd-border);
  }
}

/* --- Skeleton rows for a list that is loading ---------------------------- */

/* A skeleton is the ABSENCE of a row. It has to sit below the surface it will
   be filled on, in both themes -- on --sd-surface-alt it was a bright bar on
   the panel in dark mode, which reads as content having arrived. */
.skeleton {
  height: 14px;
  border-radius: var(--radius);
  background: var(--sd-sunk);
}
