
@import './../variable.scss';
// 顶部信息弹出框样式
.hx-toast {
  margin: 0 auto;
  min-width: 30%;
  max-width: 60%;
  z-index: 10000;
  color: rgba(255, 255, 255, .9);
  &.success { background-color: $color-green; }
  &.warn { background-color: $color-orange; }
  &.error { background-color: $color-red; }
  &.info { background-color: $color-blue; }
  &.fatal { background-color: $color-black; }
}

@media screen and (min-width: 640px) {
  .hx-toast {
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    height: auto;
    padding: ($pm-md - 3px) $pm-md;
    border-radius: $border-radius-md;
    transition: all .2s;
    &.top, &.default {
      top: 0;
      @include centerHorizontal();
      transform: translate(-50%, -100%);
      &.show {
        transform: translate(-50%, 10%);
      }
    }
    &.topLeft,
    &.topRight {
      top: 0;
      position: absolute;
      transform: translateY(-100%);
      &.show {
        transform: translateY(10%);
      }
    }
    &.topRight {
      right: $pm-sm;
    }
    &.topLeft {
      left: $pm-sm;
    }
    &.bottom {
      bottom: 0;
      @include centerHorizontal();
      transform: translate(-50%, 100%);
      @include borderRadiusTop($border-radius-md);
      &.show {
        transform: translate(-50%, -10%);
      }
    }
    &.bottomLeft,
    &.bottomRight {
      bottom: 0;
      position: absolute;
      transform: translateY(100%);
      &.show {
        transform: translateY(-10%);
      }
    }
    &.bottomRight {
      right: $pm-sm;
    }
    &.bottomLeft {
      left: $pm-sm;
    }
    &.center {
      opacity: .0;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(1.3, 1.3);
      &.show {
        transform: translate(-50%, -50%) scale(1.0, 1.0);
        opacity: 1.0;
      }
    }
  }
}

@media screen and (max-width: 640px){
  .hx-toast {
    max-width: calc(100% - #{2 * $pm-md});
    border-radius: $pm-sm;
    text-align: center;
    background-color: rgba(0,0,0,.73)!important;
    color: rgba(255, 255, 255, .9);
    position: fixed;
    font-size: $font-md;
    line-height: $font-sm * 2;
    display: block;
    &.default, &.bottom {
      bottom: 0;
      left: 50%;
      transition: transform .3s;
      transform: translate(-50%, 100%);
      width: calc(100% - #{2 * $pm-md});
      padding: $pm-md $pm-md $pm-bg;
      &.show {
        transform: translate(-50%, -16px);
      }
    }
    &.top, &.center {
      padding: $pm-bg $pm-md $pm-md;
      &::before {
        bottom: unset;
        top: $pm-sm;
      }
    }
    &.center {
      top: 50%;
      left: 50%;
      opacity: .0;
      width: 70%;
      transform: translate(-50%, -50%) scale(1.2, 1.2);
      transition: transform .3s, opacity .3s;
      &.show {
        opacity: 1.0;
        transform: translate(-50%, -50%) scale(1.0, 1.0);
      }
    }
    &.top {
      top: 0;
      left: 50%;
      transition: transform .3s;
      transform: translate(-50%, -100%);
      width: calc(100% - #{2 * $pm-md});
      &.show {
        transform: translate(-50%, 16px);
      }
    }
    &::before {
      content: '';
      width: 20%;
      position: absolute;
      bottom: $pm-sm;
      height: 4px;
      display: block;
      @include centerHorizontal;
      border-radius: 4px 4px;
    }
    &.default:before { background-color: #aaa; }
    &.success:before { background-color: $color-green; }
    &.warn:before { background-color: $color-orange; }
    &.error:before { background-color: $color-red; }
    &.info:before { background-color: $color-blue; }
    &.fatal:before { background-color: white; }
  }
}
