// Import all the tools needed to customize the theme and extract parts of it
// @import '~@angular/material/core/theming/all-theme';
@import '../../all-theme';

// Define a mixin that accepts a theme and outputs the color styles for the component.
@mixin ap-input-theme($theme) {
  // Extract whichever individual palettes you need from the theme.
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);

  [ap-input] {
    margin: 8px 0;
    max-width: 100%;
    position: relative;
    width: 220px;
    &:last-child {
      margin-bottom: 0;
    }

    &[search] {
      display: flex;
      align-items: center;
      margin: 0;
      i, input, input::placeholder {
        color: #6A7179;
      }
      i {
        display: block;
        margin: 0;
        font-size: 20px;
      }
      input {
        flex: 1;
        border: 0;
        margin: 0;
        width: 100%;
        font-size: 16px;
        font-family: "Open Sans";
        letter-spacing: 0.3px;
        background: transparent;
      }
      &.active input,
      input:focus {
        border: 0;
      }
    }
    &.fixed-icon {
      input { padding-right: 43px; }
      md-icon {
        display: block;
        background: md-color($md-ap-light-grey, 500);
        border-left: 1px solid md-color($md-ap-grey, 500);
      }
    }

    label { display: block; }

    input {
      border: 1px solid md-color($md-ap-grey, 500);
      height: 38px;
      padding: 10px;
      margin: 8px 0;
      width: 100%;
    }
    &.active input,
    input:focus {
      outline: none;
      border: 1px solid md-color($md-ap-orange, 500);
    }

    &.error, &.valid {
      input { outline: none; padding-right: 32px; }
    }
    &.error {
      input {
        border: 1px solid $color-error;
      }
      md-icon {
        display: block;
        color: $color-error;
      }
      span { display: block; }
    }
    &.valid {
      md-icon {
        color: $color-success;
      }
      input {
        border: 1px solid $color-success;
      }
    }

    md-icon {
      display: none;
      position: relative;
      float: right;
      margin-right: 1px;
      margin-top: -45px;
      pointer-events: none;
      color: md-color($md-ap-dark-grey, 500);
      height: 36px;
      width: 32px;
      line-height: 36px;
      text-align: center;
    }

    span {
      text-align: right;
      margin-top: -5px;
    }

    textarea { resize: none; }
  }

}
