/* Webbi shared component primitives v0.1 — APPROVED FOR PILOT USE */
*,
*::before,
*::after {
  box-sizing: border-box;
}

.webbi-ui {
  background: var(--webbi-bg-canvas);
  color: var(--webbi-text-primary);
  font-family: var(--webbi-font-ui);
  font-size: var(--webbi-font-size-body);
  line-height: var(--webbi-line-height-body);
}

.webbi-ui a {
  color: var(--webbi-link);
  text-underline-offset: 0.18em;
}

.webbi-ui :where(button, a, input, select, textarea):focus-visible {
  outline: var(--webbi-focus-width) solid var(--webbi-focus);
  outline-offset: var(--webbi-focus-offset);
}

.webbi-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--webbi-radius-control);
  cursor: pointer;
  display: inline-flex;
  font: 600 0.9375rem/1 var(--webbi-font-ui);
  gap: var(--webbi-space-2);
  justify-content: center;
  min-block-size: 2.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  transition: background-color var(--webbi-motion-fast) var(--webbi-easing-standard), border-color var(--webbi-motion-fast) var(--webbi-easing-standard), box-shadow var(--webbi-motion-fast) var(--webbi-easing-standard), color var(--webbi-motion-fast) var(--webbi-easing-standard);
}

.webbi-button--primary {
  background: var(--webbi-action-primary);
  color: var(--webbi-text-inverse);
}

[data-webbi-theme="dark"] .webbi-button--primary,
:root:not([data-webbi-theme="light"]) .webbi-button--primary {
  color: var(--webbi-color-deep-space);
}

.webbi-button--primary:hover {
  background: var(--webbi-action-primary-hover);
  box-shadow: var(--webbi-glow-sm);
}

.webbi-button--secondary {
  background: var(--webbi-action-secondary);
  border-color: var(--webbi-border-strong);
  color: var(--webbi-text-primary);
}

.webbi-button--secondary:hover,
.webbi-button--ghost:hover {
  background: var(--webbi-bg-interactive);
}

.webbi-button--ghost {
  background: transparent;
  border-color: var(--webbi-border-subtle);
  color: var(--webbi-text-secondary);
}

.webbi-button--danger {
  background: transparent;
  border-color: var(--webbi-status-danger);
  color: var(--webbi-status-danger);
}

.webbi-button:disabled,
.webbi-button[aria-disabled="true"] {
  background: var(--webbi-disabled-bg);
  border-color: var(--webbi-disabled-border);
  color: var(--webbi-disabled-text);
  cursor: not-allowed;
  pointer-events: none;
}

.webbi-card {
  background: var(--webbi-bg-surface);
  border: 1px solid var(--webbi-border-subtle);
  border-radius: var(--webbi-radius-panel);
  box-shadow: var(--webbi-elevation-panel);
  color: var(--webbi-text-primary);
  overflow: hidden;
}

.webbi-card__header,
.webbi-card__body,
.webbi-card__footer {
  padding: var(--webbi-space-4);
}

.webbi-network-signature {
  color: var(--webbi-signature-blue, #b8dfff);
  font-weight: 400;
}

.webbi-card__header {
  border-block-end: 1px solid var(--webbi-border-subtle);
}

.webbi-card__header > :first-child,
.webbi-card__body > :first-child {
  margin-block-start: 0;
}

.webbi-card__header > :last-child,
.webbi-card__body > :last-child {
  margin-block-end: 0;
}

.webbi-card__footer {
  align-items: center;
  background: var(--webbi-bg-raised);
  border-block-start: 1px solid var(--webbi-border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: var(--webbi-space-2);
}

.webbi-field {
  display: grid;
  gap: var(--webbi-space-2);
}

.webbi-label {
  color: var(--webbi-text-primary);
  font-weight: 600;
}

.webbi-input,
.webbi-select,
.webbi-textarea {
  background: var(--webbi-bg-surface);
  border: 1px solid var(--webbi-border-strong);
  border-radius: var(--webbi-radius-control);
  color: var(--webbi-text-primary);
  font: inherit;
  inline-size: 100%;
  min-block-size: 2.75rem;
  padding: 0.65rem 0.75rem;
}

.webbi-input::placeholder,
.webbi-textarea::placeholder {
  color: var(--webbi-text-muted);
  opacity: 1;
}

.webbi-help {
  color: var(--webbi-text-muted);
  font-size: 0.875rem;
}

.webbi-badge {
  align-items: center;
  background: var(--webbi-bg-interactive);
  border: 1px solid var(--webbi-border-subtle);
  border-radius: var(--webbi-radius-pill);
  color: var(--webbi-text-secondary);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  min-block-size: 1.5rem;
  padding: 0.25rem 0.55rem;
}

.webbi-badge--info { border-color: var(--webbi-status-info); color: var(--webbi-status-info); }
.webbi-badge--success { border-color: var(--webbi-status-success); color: var(--webbi-status-success); }
.webbi-badge--warning { border-color: var(--webbi-status-warning); color: var(--webbi-status-warning); }
.webbi-badge--danger { border-color: var(--webbi-status-danger); color: var(--webbi-status-danger); }

.webbi-alert {
  --webbi-alert-color: var(--webbi-status-info);
  background: color-mix(in srgb, var(--webbi-alert-color) 10%, var(--webbi-bg-surface));
  border: 1px solid var(--webbi-alert-color);
  border-inline-start-width: 0.3rem;
  border-radius: var(--webbi-radius-control);
  color: var(--webbi-text-primary);
  padding: var(--webbi-space-3) var(--webbi-space-4);
}

.webbi-alert--success { --webbi-alert-color: var(--webbi-status-success); }
.webbi-alert--warning { --webbi-alert-color: var(--webbi-status-warning); }
.webbi-alert--danger { --webbi-alert-color: var(--webbi-status-danger); }

.webbi-alert__title {
  color: var(--webbi-alert-color);
  display: block;
  font-weight: 700;
  margin-block-end: var(--webbi-space-1);
}

@media (forced-colors: active) {
  .webbi-button,
  .webbi-card,
  .webbi-input,
  .webbi-select,
  .webbi-textarea,
  .webbi-badge,
  .webbi-alert {
    forced-color-adjust: auto;
  }
}
