@import '../../style/mixins';
@import '../../style/themes/default';
@drawerPrefixCls: fm-drawer;

@ease-in-out-circ: cubic-bezier(0.78, 0.14, 0.15, 0.86);
@duration: 0.3s;
.@{drawerPrefixCls} {
  position: fixed;
  z-index: 9999;
  transition: width 0s ease @duration, height 0s ease @duration, transform @duration @ease-in-out-circ;
  >* {
     transition: transform @duration @ease-in-out-circ, opacity @duration @ease-in-out-circ, box-shadow @duration @ease-in-out-circ;
  }
  &.@{drawerPrefixCls}-open {
    transition: transform @duration @ease-in-out-circ;
  }
  & &-mask {
    background: #000;
    opacity: 0;
    width: 100%;
    height: 0;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity @duration @ease-in-out-circ, height 0s ease @duration;
  }
  &-content-wrapper {
    position: absolute;
    background: #fff;
  }
  &-content {
    overflow: auto;
    z-index: 1;
    position: relative;
  }
  &-left,
  &-right {
    top: 0;
    width: 0%;
    height: 100%;
    .@{drawerPrefixCls}-content-wrapper,
    .@{drawerPrefixCls}-content {
      height: 100%;
    }
    &.@{drawerPrefixCls}-open {
      width: 100%;
      &.no-mask {
        width: 0%;
      }
    }
  }
  &-left {
    left: 0;
    &.@{drawerPrefixCls}-open {
      .@{drawerPrefixCls} {
        &-content-wrapper {
          box-shadow: 2px 0 8px rgba(0, 0, 0, .15);
        }
      }
    }
  }
  &-right {
    right: 0;
    .@{drawerPrefixCls} {
      &-content-wrapper {
        right: 0;
      }
    }
    &.@{drawerPrefixCls}-open {
      & .@{drawerPrefixCls} {
        &-content-wrapper {
          box-shadow: -2px 0 8px rgba(0, 0, 0, .15);
        }
      }
      &.no-mask {
        // https://github.com/ant-design/ant-design/issues/18607
        right: 1px;
        transform: translateX(1px);
      }
    }
  }
  &-top,
  &-bottom {
    width: 100%;
    height: 0%;
    .@{drawerPrefixCls}-content-wrapper,
    .@{drawerPrefixCls}-content {
      width: 100%;
    }
    .@{drawerPrefixCls}-content {
      height: 100%;
    }
    &.@{drawerPrefixCls}-open {
      height: 100%;
      &.no-mask {
        height: 0%;
      }
    }
  }
  &-top {
    top: 0;
    &.@{drawerPrefixCls}-open {
      .@{drawerPrefixCls} {
        &-content-wrapper {
          box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
        }
      }
    }
  }
  &-bottom {
    bottom: 0;
    .@{drawerPrefixCls} {
      &-content-wrapper {
        bottom: 0;
      }
      &-handle {
        top: -40px;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, .15);
        border-radius: 4px 4px 0 0;
      }
    }
    &.@{drawerPrefixCls}-open {
      .@{drawerPrefixCls} {
        &-content-wrapper {
          box-shadow: 0 -2px 8px rgba(0, 0, 0, .15);
        }
      }
      &.no-mask {
        // https://github.com/ant-design/ant-design/issues/18607
        bottom: 1px;
        transform: translateY(1px);
      }
    }
  }
  &.@{drawerPrefixCls}-open {
    .@{drawerPrefixCls} {
      &-mask {
        opacity: .3;
        height: 100%;
        animation: DrawerFadeIn 0.3s @ease-in-out-circ;
        transition: none;
      }
    }
  }
}

@keyframes DrawerFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 0.3;
  }
}

@import './rtl';
