@import "./src/common/var.less";
@import "./src/common/mixins.less";

@layer-css-prefix:~"@{css-prefix}layer";

.@{layer-css-prefix}-mask{
  position:fixed;
  top:0px;
  bottom:0px;
  left:0px;
  right:0px;
  background-color:transparent;

  &-bg{
    background-color:fade(@layer-mask-bg,@layer-mask-shade-percent);
  }
}

.@{layer-css-prefix}{
  position:fixed;
  top:0;
  left:0;
  min-width:10px;
  background-color:@layer-bg;
  box-shadow:0 6px 18px 2px rgba(0,0,0,.2);
  color:@color-text-1;
  outline:none;

  &-drag{
    position:absolute;
    z-index:10000;
    background-color: transparent;

    &.drag-up-left{
      top:-2px;
      left:-2px;
      height:5px;
      width:5px;
      cursor:nw-resize;
    }
    &.drag-up{
      top:-2px;
      right:2px;
      left:2px;
      height:5px;
      cursor:s-resize;
    }
    &.drag-up-right{
      top:-2px;
      right:-2px;
      height:5px;
      width:5px;
      cursor:ne-resize;
    }
    &.drag-left{
      top:2px;
      bottom:2px;
      left:-5px;
      width:5px;
      cursor:e-resize;
    }
    &.drag-right{
      top:2px;
      bottom:2px;
      right:-5px;
      width:5px;
      cursor:e-resize;
    }

    &.drag-down-left{
      bottom:-2px;
      left:-2px;
      height:5px;
      width:5px;
      cursor:ne-resize;
    }
    &.drag-down{
      bottom:-2px;
      right:5px;
      left:2px;
      height:5px;
      cursor:s-resize;
    }
    &.drag-down-right{
      bottom:-2px;
      right:-2px;
      height:5px;
      width:5px;
      cursor:nw-resize;
    }
  }

  &-frame{
    position:fixed;
    top:auto;
    bottom:auto;
    left:auto;
    right:auto;
    width:auto;
    height:auto;
    transition:all 0.45s ease;
    -moz-transition:all 0.45s ease;
    -webkit-transition:all 0.45s ease;
    -o-transition:all 0.45s ease;
  }

  &.is-position-auto{
    -webkit-transform:translateX(-50%) translateY(-50%);
    -moz-transform:translateX(-50%) translateY(-50%);
    transform:translateX(-50%) translateY(-50%);
  }

  &-close{
    display:block;
    width:24px;
    height:24px;
    line-height:1.4;
    padding:3px;
    font-size:12px;
    text-align:center;
    font-weight:bold;
    position:absolute;
    top:-12px;
    right:-12px;
    z-index:10;
    cursor:pointer;
    background-color:@message-button-bg;
    border:2px solid @message-button-border-color;
    border-radius:@border-radius-all;
    -webkit-box-shadow:0 0 8px tint(@color-black,50%);
    box-shadow:0 0 8px tint(@color-black,50%);
    color:@color-white;
    &:hover{
      background-color:@color-primary;
    }
    &:active{
      background-color:@color-primary-light-2;
    }
  }

  &-header{
    height:46px;
    background-color:@layer-title-bg;
    border-bottom:1px solid @layer-border-color;

    &.move{
      cursor:move;
    }

    &-title{
      .mixin-vertical;
      float:left;
      max-width:75%;
      margin-left:15px;
      height:46px;

      &-icon{
        margin-right:5px;
      }

      &-text{
        .mixin-ellipsis;
        height:46px;
        line-height: 46px;
      }
    }

    &-icon-btn{
      float: right;
      margin-right: 5px;

      & .title-icon{
        .mixin-vertical;
        height:46px;
        float: left;
        cursor:pointer;
        margin-right:15px;

        &:hover{
          color:tint(@color-text-1,50%);
        }

        &:active{
          color:@color-text-1;
        }
      }
    }

  }

  &-content{
    .mixin-scrollbar;
    .mixin-border-box;
    .mixin-wordwrap;
    overflow-x:auto;
    overflow-y:auto;

    &.frame{
      padding:0;
      overflow:hidden;

      & iframe{
        .mixin-scrollbar;
      }
    }
  }

  &-footer {
    font-size: 0;
    background-color: @layer-bottom-bg;

    &-inner{
      padding: 10px 15px;

      &.tac {
        text-align: center;
      }
      &.tal {
        text-align: left;
      }
      &.tar{
        text-align: right;
      }
    }
  }
}

.@{layer-css-prefix}-animation{
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  -webkit-animation-duration: .3s;
  animation-duration: .3s;

  &-open{
    -webkit-animation-name: layer-bounceIn;
    animation-name: layer-bounceIn;
  }
  &-close{
    -webkit-animation-name: layer-bounceOut;
    animation-name: layer-bounceOut;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
    -webkit-animation-duration: .3s;
    animation-duration: .3s;
  }
}

@-webkit-keyframes layer-bounceIn {
  0% {
    opacity: 0;
    -webkit-transform: scale(.5);
    transform: scale(.5)
  }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    transform: scale(1)
  }
}

@keyframes layer-bounceIn {
  0% {
    opacity: 0;
    -webkit-transform: scale(.5);
    -ms-transform: scale(.5);
    transform: scale(.5)
  }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1)
  }
}

@-webkit-keyframes layer-bounceOut {
  100% {
    opacity: 0;
    -webkit-transform: scale(.7);
    transform: scale(.7)
  }

  30% {
    -webkit-transform: scale(1.05);
    transform: scale(1.05)
  }

  0% {
    -webkit-transform: scale(1);
    transform: scale(1)
  }
}

@keyframes layer-bounceOut {
  100% {
    opacity: 0;
    -webkit-transform: scale(.7);
    -ms-transform: scale(.7);
    transform: scale(.7)
  }

  30% {
    -webkit-transform: scale(1.05);
    -ms-transform: scale(1.05);
    transform: scale(1.05)
  }

  0% {
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1)
  }
}
