// Copyright (c) 2016-2019 VMware, Inc. All Rights Reserved.
// This software is released under MIT license.
// The full license information can be found in LICENSE in the root directory of this project.

// Flatten the error icon and message to be inline for certain input types
@mixin form-flatten-validate-text() {
  .clr-control-label {
    font-weight: normal;
    display: block;
  }
  & ~ .clr-validate-icon {
    margin-left: 0;
  }
  & ~ .clr-subtext {
    display: inline-block;
  }
}

// Used to provide an inline set of labels for checkbox/radios
@mixin form-inline-input() {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;

  .clr-control-label {
    display: inline-block;
    margin-right: $clr-forms-baseline * 2;
    width: auto;
  }
}

// Used to adjust the flattened error icon message for compact
@mixin form-flatten-compact-adjustments() {
  max-width: 100%;

  & ~ .clr-subtext {
    margin-left: $clr-forms-baseline;
  }
}

// Standard Clarity Input Bottom Border Animation
@mixin input-border-animation($border-color) {
  // Border-bottom animation on focus
  // background: linear-gradient(to bottom, transparent 95%, $border-color 95%) no-repeat;
  background-size: 0% 100%;
  transition: border 0.2s ease;

  &:focus,
  &.clr-focus {
    border: $clr-default-borderwidth solid $border-color;
    background-size: 100% 100%;
  }
}

// Style default input
@mixin custom-inputs-reset($height) {
  @include clr-appearance-normal();
  margin: 0;
  padding: 0;
  // border: none;
  border-radius: 0;
  box-shadow: none;
  background: none;
  height: $height;

  &:focus {
    outline: 0;
  }
}

@mixin form-fields-appearance($border-color) {
  color: $clr-forms-text-color;
  display: inline-block;
  border: $clr-default-borderwidth solid $border-color;
}

@mixin disabled-form-fields() {
  opacity: 0.5;
  cursor: not-allowed;
}

@mixin checkbox-radio-input-styles($size) {
  //Positioning
  position: absolute;
  opacity: 0;
  top: 5px;
  left: 0;

  //Display
  //NOTE: Even though the input is invisible, we assign it a height
  //and width so that it aligns right behind the fake checkbox
  //and so that the user's default input size doesn't affect it
  height: $size;
  width: $size;
}

@mixin checkbox-radio-label-styles($min-height, $padding-left, $color: $clr-forms-checkbox-label-color) {
  //Positioning
  position: relative;

  //Display
  display: inline-block;
  color: $color;
  min-height: $min-height;
  padding-left: $padding-left;
  margin-top: 0;
  cursor: pointer;
  line-height: $clr-forms-baseline * 4;
}

@mixin checkbox-radio-shared-inactive($size, $top, $left, $border-color) {
  //Positioning
  position: absolute;
  top: $top;
  left: $left;

  //Display
  content: '';
  display: inline-block;
  height: $size;
  width: $size;
  border: $clr-default-borderwidth solid $border-color;
}

@mixin custom-inputs($height) {
  @include clr-appearance-normal();
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: none;
  height: $height;

  &:focus {
    outline: 0;
  }
}
