@function control-height() {
  @return rem(48px);
}

@function control-vertical-padding() {
  @return (control-height() - line-height(input) - rem(2px)) / 2;
}

@function control-icon-transition() {
  @return transform duration(fast) easing(in);
}

@mixin control-backdrop($style: base) {
  @if $style == base {
    background: theme-color(m-grey, 400);
    border: border(transparent);
    box-shadow:
      0 0 0 1px transparent,
      shadow(transparent);
    border-radius: border-radius();
    transition-property: box-shadow, background;
    transition-duration: duration();
    transition-timing-function: easing();

    &::after {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      display: block;
      background: theme-color(white);
      border-radius: calc(#{border-radius()} - 1px);
    }
  } @else if $style == focused {
    background: theme-color(m-blue, 300);
    box-shadow:
      0 0 0 1px theme-color(m-blue, 300),
      shadow(transparent);

    &::after { background: color(white); }
  } @else if $style == error {
    background: theme-color(m-red, 600);
    box-shadow: 0 0 0 1px theme-color(m-red, 600);

    &::after { background: theme-color(m-red, 50); }
  } @else if $style == disabled {
    background: theme-color(m-grey, 300);
    box-shadow: none;

    &::after { background: theme-color(m-grey, 50); }
  } @else if $style == focused-error {
    background: theme-color(m-red, 600);
    box-shadow: 0 0 0 1px theme-color(m-red, 600);

    &::after { background: theme-color(m-red, 50); }
  } @else if $style == backdrop-hidden {
    background: transparent;
    box-shadow: none;

    &::after { background: transparent; }
  }
}
