@import './app';

@mixin scale-hairline-common($color, $top, $right, $bottom, $left) {
  content: '';
  position: absolute;
  background-color: $color;
  display: block;
  z-index: 1;
  top: $top;
  right: $right;
  bottom: $bottom;
  left: $left;
}

@mixin hairline-top($color: $border-color-base) {
  border-top: 1PX solid $color;

  html:not([data-scale]) & {
    @media (min-resolution: 2dppx) {
      border-top: none;

      &::before {
        @include scale-hairline-common($color, 0, auto, auto, 0);
        width: 100%;
        height: 1PX;
        transform-origin: 50% 50%;
        transform: scaleY(0.5);

        @media (min-resolution: 3dppx) {
          transform: scaleY(0.33);
        }
      }
    }
  }
}

@mixin hairline-right($color: $border-color-base) {
  border-right: 1PX solid $color;

  html:not([data-scale]) & {
    @media (min-resolution: 2dppx) {
      border-right: none;

      &::after {
        @include scale-hairline-common($color, 0, 0, auto, auto);
        width: 1PX;
        height: 100%;
        background: $color;
        transform-origin: 100% 50%;
        transform: scaleX(0.5);

        @media (min-resolution: 3dppx) {
          transform: scaleX(0.33);
        }
      }
    }
  }
}

@mixin hairline-bottom($color: $border-color-base) {
  border-bottom: 1PX solid $color;

  html:not([data-scale]) & {
    @media (min-resolution: 2dppx) {
      border-bottom: none;

      &::after {
        @include scale-hairline-common($color, auto, auto, 0, 0);
        width: 100%;
        height: 1PX;
        transform-origin: 50% 100%;
        transform: scaleY(0.5);

        @media (min-resolution: 3dppx) {
          transform: scaleY(0.33);
        }
      }
    }
  }
}

@mixin hairline-left($color: $border-color-base) {
  border-left: 1PX solid $color;

  html:not([data-scale]) & {
    @media (min-resolution: 2dppx) {
      border-left: none;

      &::before {
        @include scale-hairline-common($color, 0, auto, auto, 0);
        width: 1PX;
        height: 100%;
        transform-origin: 100% 50%;
        transform: scaleX(0.5);

        @media (min-resolution: 3dppx) {
          transform: scaleX(0.33);
        }
      }
    }
  }
}

@mixin hairline($color: $border-color-base, $radius: 0) {
  border: 1PX solid $color;
  border-radius: $radius;

  html:not([data-scale]) & {
    @media (min-resolution: 2dppx) {
      position: relative;
      border: none;

      &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 200%;
        height: 200%;
        border: 1PX solid $color;
        border-radius: $radius * 2;
        transform-origin: 0 0;
        transform: scale(0.5);
        box-sizing: border-box;
        pointer-events: none;

        // $media (min-resolution: 3dppx) {
        //   width: 300%;
        //   height: 300%;
        //   border-radius: $radius * 3;
        //   transform: scale(0.33);
        // }
      }
    }
  }
}

@mixin border-bottom-1px($color: $border-color-base) {
  position: relative;
  &:before {
    content: '';
    display: block;
    position: absolute;
    width: 100%;
    left: 0;
    bottom: 0;
    height: 1PX;
    background-color: $color;
    -webkit-transform: scaleY(0.5);
    transform: scaleY(0.5);
    pointer-events: none;
  }
}

@mixin border-top-1px($color: $border-color-base) {
  position: relative;
  &:after {
    content: '';
    display: block;
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    height: 1PX;
    background-color: $color;
    -webkit-transform: scaleY(0.5);
    transform: scaleY(0.5);
    pointer-events: none;
  }
}

@mixin border-right-1px($color: $border-color-base) {
  position: relative;
  &:after {
    content: '';
    display: block;
    position: absolute;
    height: 100%;
    left: 100%;
    top: 0;
    width: 1PX;
    background-color: $color;
    -webkit-transform: scaleX(0.5);
    transform: scaleX(0.5);
    pointer-events: none;
  }
}
@mixin border-left-1px($color: $border-color-base) {
  position: relative;
  &:after {
    content: '';
    display: block;
    position: absolute;
    height: 100%;
    right: 100%;
    top: 0;
    width: 1PX;
    background-color: $color;
    -webkit-transform: scaleX(0.5);
    transform: scaleX(0.5);
    pointer-events: none;
  }
}
//四边*/
@mixin bd-all-1px($color: $border-color-base, $radius: 3px) {
  position: relative;
  &:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transform: scale(0.5);
    transform: scale(0.5);
    -webkit-transform-origin: left top;
    transform-origin: left top;
    border: 1PX solid $color;
    border-radius: $radius;
  }
}

@mixin bd-all($color: $border-color-base, $radius: 3px,$width:2PX,$borderStyle:solid) {
  position: relative;
  &:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transform: scale(0.5);
    transform: scale(0.5);
    -webkit-transform-origin: left top;
    transform-origin: left top;
    border: $width $borderStyle $color;
    border-radius: $radius;
  }
}

@mixin box {
  display: flex;
}

// 水平排列 */
@mixin box-horizontal {
  box-orient: horizontal;
}

// 垂直排列 */
@mixin box-vertical {
  box-orient: vertical;
}

// 平均分配 */
@mixin flex($order) {
  flex: $order;
}

// 自定义宽度 */
@mixin auto-flex {
  flex: 0 0 auto;
}

// 垂直居中 */
@mixin vertical-center {
  align-items: center;
}

// 垂直靠上 */
@mixin vertical-top {
  align-items: flex-start;
}

// 垂直靠下 */
@mixin vertical-end {
  align-items: flex-end;
}

// 水平居中 */
@mixin horizontal-center {
  justify-content: center;
}

// 两边对齐 */
@mixin both-side {
  justify-content: space-between;
}

@mixin box-direction-horizontal {
  flex-direction: column;
}

// 换行 */
@mixin wrap {
  flex-wrap: wrap;
}

@mixin sl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@mixin _icon($width, $height, $bgsize, $bgurl, $bgpos: 0 0, $display: inline-block) {
  width: $width;
  height: $height;
  display: $display;
  vertical-align: middle;
  background: url($bgurl) no-repeat;
  background-size: $bgsize;
  background-position: $bgpos;
}

@mixin arrow($color, $heightAndWidth, $deg: 45deg) {
  border-right: 1PX solid $color;
  border-top: 1PX solid $color;
  height: $heightAndWidth;
  width: $heightAndWidth;
  margin-top: 0.05rem;
  transform: rotate($deg);
  -webkit-transform: rotate($deg);
  border-left: 1PX solid transparent;
  border-bottom: 1PX solid transparent;
}

@mixin check($width, $height, $color) {
  display: inline-block;
  width: $width;
  height: $height;
  background: $color;
  line-height: 0;
  font-size: 0;
  vertical-align: middle;
  -webkit-transform: rotate(55deg);
  margin-top: $width;
  &:after {
    content: '/';
    display: block;
    width: $width * 1.7;
    height: $height;
    background: $color;
    -webkit-transform: rotate(-100deg) translateY(100%) translateX(50%);
  }
}

@mixin cross($width, $height, $color: black) {
  display: inline-block;
  width: $width;
  height: $height;
  background: $color;
  line-height: 0;
  font-size: 0;
  vertical-align: middle;
  -webkit-transform: rotate(45deg);

  &:after {
    content: '/';
    display: block;
    width: $width;
    height: $height;
    background: $color;
    -webkit-transform: rotate(-90deg);
  }
}

@mixin clearfix {
  &:after {
    content: '.';
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
  }
  display: inline-block;
  * html & {
    height: 1%;
  }
  display: block;
  * + html & {
    min-height: 1%;
  }
}

@mixin border-radius(){
  border-radius: 24px 24px 0 0 ;
}
