/**
 * Office UI Fabric JS 1.5.0
 * The JavaScript front-end framework for building experiences for Office 365.
 **/
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information.

@import '../Label/Label';

//
// Office UI Fabric
// --------------------------------------------------
// Single line (input) and multiline (textarea) form field styles

.ms-TextField {
  @include ms-baseFont;
  @include ms-u-normalize;
  color: $ms-color-neutralPrimary;
  font-size: $ms-font-size-m;
  font-weight: $ms-font-weight-regular;
  margin-bottom: 8px;

  .ms-Label {
    font-size: $ms-font-size-m;
    font-weight: $ms-font-weight-semibold;
  }
}

//= State: A disabled textfield
.ms-TextField.is-disabled {
  .ms-TextField-field {
    background-color: $ms-color-neutralLighter;
    border-color: $ms-color-neutralLighter;
    pointer-events: none;
    cursor: default;
  }

  @include input-placeholder {
    color: $ms-color-neutralTertiary;
  }
}

//= State: A required textfield
.ms-TextField.is-required {
  .ms-Label {
    @include ms-Label-is-required
  }

  @include input-placeholder {
    @include ms-Label-is-required
  }
}

//= State: An active textfield
.ms-TextField.is-active {
  border-color: $ms-color-themePrimary;
}

.ms-TextField-field {
  @include ms-u-normalize;
  border: 1px solid $ms-color-neutralTertiaryAlt;
  border-radius: 0;
  font-weight: $ms-font-weight-semilight;
  font-size: $ms-font-size-m;
  color: $ms-color-neutralPrimary;
  height: 32px;
  padding: 6px 12px 7px;
  width: 100%;
  min-width: 180px;
  outline: 0;
  text-overflow: ellipsis;

  &:hover {
    border-color: $ms-color-neutralSecondaryAlt;
  }

  &:focus {
    border-color: $ms-color-themePrimary;
  }

  &:hover,
  &:focus {
    @media screen and (-ms-high-contrast: active) {
      border-color: $ms-color-contrastBlackSelected;
    }

    @media screen and (-ms-high-contrast: black-on-white) {
      border-color: $ms-color-contrastWhiteSelected;
    }
  }

  &[disabled] {
    background-color: $ms-color-neutralLighter;
    border-color: $ms-color-neutralLighter;
    pointer-events: none;
    cursor: default;
  }

  @include input-placeholder {
    color: $ms-color-neutralSecondary;
  }
}

.ms-TextField-description {
  color: $ms-color-neutralSecondaryAlt;
  font-size: $ms-font-size-xs;
}


//== Modifier: Single line (default), placeholder label
//
.ms-TextField.ms-TextField--placeholder {
  position: relative;
  background-color: $ms-color-white;

  .ms-TextField-field {
    position: relative;
    background-color: transparent;
    z-index: $ms-zIndex-middle;
  }

  .ms-Label {
    position: absolute;
    font-weight: $ms-font-weight-semilight;
    font-size: $ms-font-size-m;
    color: $ms-color-neutralSecondary;
    padding: 6px 12px 7px;
    pointer-events: none;
    z-index: $ms-zIndex-back;
  }

  &.is-disabled {
    color: $ms-color-neutralTertiary;

    .ms-Label {
      @include ms-Label-is-disabled;
    }
  }
}


//== Modifier: Single line (default), underlined
//
.ms-TextField.ms-TextField--underlined {
  border-bottom: 1px solid $ms-color-neutralTertiaryAlt;
  display: table;
  width: 100%;
  min-width: 180px;

  &:hover {
    border-color: $ms-color-neutralSecondaryAlt;

    @media screen and (-ms-high-contrast: active) {
      border-color: $ms-color-contrastBlackSelected;
    }

    @media screen and (-ms-high-contrast: black-on-white) {
      border-color: $ms-color-contrastWhiteSelected;
    }
  }

  &:active,
  &:focus {
    border-color: $ms-color-themePrimary;
  }

  .ms-Label {
    font-size: $ms-font-size-m;
    margin-right: 8px;
    display: table-cell;
    vertical-align: top;
    padding-left: 12px;
    padding-top: 9px;
    height: 32px;
    width: 1%;
    white-space: nowrap;
  }

  .ms-TextField-field {
    border: 0;
    float: left;
    display: table-cell;
    text-align: left;
    padding-top: 8px;
    padding-bottom: 3px;

    &:active,
    &:focus,
    &:hover {
      outline: 0;
    }
  }

  &.is-disabled {
    border-bottom-color: $ms-color-neutralLight;

    .ms-Label {
      @include ms-Label-is-disabled;
    }

    .ms-TextField-field {
      background-color: transparent;
      color: $ms-color-neutralTertiary;
    }
  }

  &.is-active {
    border-color: $ms-color-themePrimary;

    @media screen and (-ms-high-contrast: active) {
      border-color: $ms-color-contrastBlackSelected;
    }

    @media screen and (-ms-high-contrast: black-on-white) {
      border-color: $ms-color-contrastWhiteSelected;
    }
  }
}


//== Modifier: Multiline textfield
//
.ms-TextField.ms-TextField--multiline {
  .ms-TextField-field {
    @include ms-baseFont;
    color: $ms-color-neutralSecondary;
    font-family: $ms-font-family-base;
    font-size: $ms-font-size-m;
    font-weight: $ms-font-weight-regular;
    line-height: 17px;
    min-height: 60px;
    min-width: 260px;
    padding-top: 6px;
    overflow: auto;
  }
}
