:host {
  display: inline-block;
}

:host.app-input-host--full-width {
  display: block;
  width: 100%;
}

.app-input {
  width: 100%;
  border: 1px solid var(--border-color, #e4e4e7);
  border-radius: var(--radius-md, 6px);
  background: var(--bg-primary, #fff);
  color: var(--text-primary, #1f322d);
  font-family: inherit;
  line-height: 1;
  transition: border-color var(--transition-fast, 120ms ease),
    box-shadow var(--transition-fast, 120ms ease);

  &::placeholder {
    color: var(--text-secondary, #6b7280);
  }

  &:hover:not(:disabled) {
    border-color: var(--primary-color, #2f6e5d);
  }

  &:focus-visible {
    outline: none;
    border-color: var(--primary-color, #2f6e5d);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color, #2f6e5d) 25%, transparent);
  }

  &:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }
}

.app-input--sm {
  height: 32px;
  padding: 0 var(--space-sm, 0.5rem);
  font-size: var(--font-size-sm, 0.8125rem);
}

.app-input--md {
  height: 40px;
  padding: 0 var(--space-md, 1rem);
  font-size: var(--font-size-md, 0.9375rem);
}

.app-input--lg {
  height: 48px;
  padding: 0 var(--space-lg, 1.5rem);
  font-size: var(--font-size-lg, 1rem);
}

.app-input--error {
  border-color: var(--error-color, #c0392b);

  &:focus-visible {
    border-color: var(--error-color, #c0392b);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--error-color, #c0392b) 25%, transparent);
  }
}

.app-input--success {
  border-color: var(--success-color, #2e7d32);

  &:focus-visible {
    border-color: var(--success-color, #2e7d32);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success-color, #2e7d32) 25%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-input {
    transition: none;
  }
}
