/* ==========================================================================
   ProjectManagementPro.ClientWASM — feedback
   The feedback family: the spinner, the alert, the loading indicator and the empty
   state. Every rule consumes tokens.css only.

   The unhandled-error bar (`#blazor-error-ui`) is not here: it styles markup that
   wwwroot/index.html owns, so it lives in base.css next to the rest of that file's
   element rules.
   ========================================================================== */

/* ---- Spinner --------------------------------------------------------- */
/* Two real consumers: the loading indicator, which is the element itself, and the button
   of the form family, which draws it inside while it is busy. `currentColor` is what
   lets each of them tint it with its own text colour. */
.spinner {
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin var(--duration-loop) linear infinite;
}

.spinner--lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

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

/* ---- Alert — Components/Feedback/Alert.razor -------------------------- */
/* The variant is never carried by colour alone: each one also draws its own glyph and
   announces itself through a different live-region role (see the component). */
.alert {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border: var(--border-width) solid var(--color-border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.alert__icon {
  flex: 0 0 auto;
}

.alert__glyph {
  display: block;
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.alert__message {
  flex: 1 1 auto;
  min-width: 0;
}

.alert--success {
  border-color: var(--color-success-border);
  background: var(--color-success-soft);
}

.alert--success .alert__icon {
  color: var(--color-success);
}

.alert--error {
  border-color: var(--color-error-border);
  background: var(--color-error-soft);
}

.alert--error .alert__icon {
  color: var(--color-error-strong);
}

/* ---- Loading indicator — Components/Feedback/LoadingIndicator.razor --- */
/* A region that is working, not a whole screen: the bootstrap screen has its own block
   in layout.css because its markup is index.html's. */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  color: var(--color-text-muted);
}

.loading__text {
  margin: 0;
  font-size: var(--font-size-sm);
}

/* ---- Empty state — Components/Feedback/EmptyState.razor --------------- */
/* An empty surface says what is missing; it never draws a blank panel. The icon is a
   slot, so the caller decides which drawing explains the state. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state__icon {
  display: flex;
  color: var(--color-text-subtle);
}

.empty-state__title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.empty-state__message {
  max-width: 46ch;
  margin: 0;
  font-size: var(--font-size-sm);
}

/* ---- Notifications — Components/Feedback/NotificationHost.razor ------- */
/* The messages about what just happened, drawn by the one host the shell renders. The two
   regions are always in the document — an empty host is what a screen reader has to be
   watching before the first message arrives — and only the urgent one interrupts (its role
   is on the region, see the component).
   The layer is fixed and does not take clicks: a message is information, never an obstacle to
   the screen underneath it, and the dismiss button is the only part of it that is operated. */
.notifications {
  position: fixed;
  top: calc(var(--layout-header-height) + var(--space-sm));
  right: var(--space-md);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: min(380px, calc(100vw - var(--space-lg)));
  pointer-events: none;
}

.notifications__urgent,
.notifications__polite {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* One message: its heading, its sentence and the button that closes it. The level selects the
   colour through `data-level`, so the markup carries one class and the meaning travels as data. */
.notification {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border: var(--border-default);
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}

.notification[data-level="info"] {
  border-left-color: var(--color-primary);
}

.notification[data-level="success"] {
  border-left-color: var(--color-success);
}

.notification[data-level="warning"] {
  border-left-color: var(--color-accent);
}

.notification[data-level="error"] {
  border-left-color: var(--color-error);
}

.notification__body {
  flex: 1 1 auto;
  min-width: 0;
}

.notification__title {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
}

.notification__message {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}

.notification__dismiss {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: 1;
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard);
}

.notification__dismiss:hover {
  background: var(--color-surface-muted);
}

@media (max-width: 767px) {
  .notification__dismiss {
    width: 44px;
    height: 44px;
  }
}
