/* Shared styles — error states, loading, icons, utilities, transitions.
   Loaded globally in index.html. All light DOM components inherit these. */

/* --- Error & Validation States --- */

.error {
  color: var(--color-danger);

  & input,
  & select,
  & textarea {
    border-color: var(--color-danger);
  }
}

.error-message {
  font-size: var(--text-sm);
  color: var(--color-danger);
  margin-top: var(--space-xs);
}

.success-message {
  font-size: var(--text-sm);
  color: var(--color-success);
  margin-top: var(--space-xs);
}

/* --- Loading States --- */

.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Icon Base --- */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
  fill: currentcolor;

  & svg {
    width: 100%;
    height: 100%;
  }
}

.icon-sm {
  width: 1em;
  height: 1em;
}

.icon-lg {
  width: 1.5em;
  height: 1.5em;
}

/* --- Screen Reader Only --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Common Transitions --- */

.fade-in {
  animation: fade-in 0.2s ease-in;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* --- Badge / Status Indicators --- */

.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.badge-success {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}

.badge-warning {
  background: color-mix(in srgb, var(--color-warning) 15%, transparent);
  color: var(--color-warning);
}

.badge-danger {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
}

.badge-info {
  background: color-mix(in srgb, var(--color-info) 15%, transparent);
  color: var(--color-info);
}

/* --- Form Shared --- see forms.css --- */
