@import "mixins/mixins";
@import "common/var";

@keyframes el-drawer-fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@mixin drawer-animation($direction) {

  @keyframes #{$direction}-drawer-in {
    0% {

      @if $direction == ltr {
        transform: translate(-100%, 0px);
      }

      @if $direction == rtl {
        transform: translate(100%, 0px);
      }

      @if $direction == ttb {
        transform: translate(0px, -100%);
      }

      @if $direction == btt {
        transform: translate(0px, 100%);
      }
    }

    100% {
      @if $direction == ltr {
        transform: translate(0px, 0px);
      }

      @if $direction == rtl {
        transform: translate(0px, 0px);
      }

      @if $direction == ttb {
        transform: translate(0px, 0px);
      }

      @if $direction == btt {
        transform: translate(0px, 0px);
      }
    }
  }

  @keyframes #{$direction}-drawer-out {
    0% {
      @if $direction == ltr {
        transform: translate(0px, 0px);
      }

      @if $direction == rtl {
        transform: translate(0px, 0px);;
      }

      @if $direction == ttb {
        transform: translate(0px, 0px);
      }

      @if $direction == btt {
        transform: translate(0px, 0);
      }
    }

    100% {
      @if $direction == ltr {
        transform: translate(-100%, 0px);
      }

      @if $direction == rtl {
        transform: translate(100%, 0px);
      }

      @if $direction == ttb {
        transform: translate(0px, -100%);
      }

      @if $direction == btt {
        transform: translate(0px, 100%);
      }
    }
  }
}

@mixin animation-in($direction) {
  .el-drawer__open &.#{$direction} {
    animation: #{$direction}-drawer-in .3s 1ms;
  }
}

@mixin animation-out($direction) {
  &.#{$direction} {
    animation: #{$direction}-drawer-out .3s;
  }
}

@include drawer-animation(rtl);
@include drawer-animation(ltr);
@include drawer-animation(ttb);
@include drawer-animation(btt);

$directions: rtl, ltr, ttb, btt;

@include b(drawer) {
  position: absolute;
  box-sizing: border-box;
  background-color: $--dialog-background-color;
  display: flex;
  flex-direction: column;
  // box-shadow: $--table-fixed-box-shadow;
  // box-shadow: none;
  overflow: hidden;
  outline: 0;
  box-shadow: -4px 0 16px rgba(78,89,105,0.16);

  @each $direction in $directions {
    @include animation-out($direction);
    @include animation-in($direction);
  }

  &__wrapper {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    margin: 0;
  }

  &__header {
    align-items: center;
    color: $--color-text-regular;
    display: flex;
    padding: $--drawer-medium-padding $--drawer-large-padding;
    border-bottom: $--border-1 solid $--color-fill-4;
    font-size: 18px;
    font-weight: $--font-weight-500;
    height: $--size-16;
    & > :first-child {
      flex: 1;
      line-height: 26px;
    }
  }

  &__title {
    margin: 0;
    flex: 1;
    line-height: inherit;
    font-size: 1rem;
  }

  &__close-btn {
    border: none;
    cursor: pointer;
    font-size: $--font-size-extra-large;
    color: inherit;
    background-color: transparent;
    line-height: 9px;


    .el-dialog__close{
      font-size: $--font-size-title-3!important;
    }

    &:focus, &:hover {
      .el-dialog__close {
        // border-radius: 50%;
        border-radius: $--border-radius-circle;
        // padding: 4px;
        background: $--color-secondary;
        // color: $--color-primary;
      }
    }
  }

  &__body {
    padding: $--drawer-large-padding;
    flex: 1;
    color: $--color-text-1;
    font-size: $--font-size-body-3;
    overflow: auto;
    & > * {
      box-sizing: border-box;
    }
  }

  &.ltr, &.rtl {
    height: 100%;
    top: 0;
    bottom: 0;
  }

  &.ttb, &.btt {
    width: 100%;
    left: 0;
    right: 0;
  }

  &.ltr {
    left: 0;
  }

  &.rtl {
    right: 0;
  }

  &.ttb {
    top: 0;
  }

  &.btt {
    bottom: 0;
  }
  &__footer {
    display: flex;
    align-items: center;
    padding: $--drawer-small-padding $--drawer-large-padding;
    border-top: $--border-1 solid $--color-fill-4;
    justify-content: flex-end;
    // button:first-child {
    //   margin-right: 6px;
    // }
    .dialog-footer button:last-child {
      margin-right: 0;
    }
  }
}
.el-drawer__container {
  position: relative;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  width: 100%;
}

.el-drawer-fade-enter-active {
  animation: el-drawer-fade-in .3s;
}

.el-drawer-fade-leave-active {
  animation: el-drawer-fade-in .3s reverse;
}

.el-drawer__close-btn {
  color: $--color-close-icon;
}

// .el-drawer__footer button:first-child{
//   margin-right: 8px;
// }
.el-drawer__footer .el-button {
  & + .el-button{
    margin-left: 16px;
  }
}
// .with-modal{
//   box-shadow: -4px 0 16px rgba(78,89,105,0.16);
// }
// .el-drawer__container ::-webkit-scrollbar{
//   display: none !important;
// }
