@import '../../style/vars.less';

@popupPrefix: dora-popup;

.@{popupPrefix} {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: @popup-zindex;
  pointer-events: none; // amazing! 为none时可以产生点透的效果

  .@{popupPrefix}-mask {
    position: absolute;
    top: 0;
    left: 0;
    display: none; // mask 默认隐藏
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: @fill-mask;
    pointer-events: auto;

    // fix some android webview opacity render bug
    &::before {
      display: block;
      width: 1px;
      height: 1px;
      margin-left: -10px;
      background-color: rgba(0, 0, 0, 0.1);
      content: '.';
    }
  }

  &__mask {
    .@{popupPrefix}-mask {
      display: block; // 根类具有mask属性时展示mask
    }
  }

  .@{popupPrefix}-content {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    color: @color-text-base-inverse;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch; /* ios5+ */
    ::-webkit-scrollbar {
      display: none;
    }
  }

  &__left,
  &__right,
  &__center {
    .@{popupPrefix}-content {
      width: auto;
      max-width: 100%;
    }
  }

  &__left,
  &__right {
    .@{popupPrefix}-content {
      height: 100%;
    }
  }

  &__center {
    .@{popupPrefix}-content {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  }

  &__right {
    .@{popupPrefix}-content {
      right: 0;
    }
  }

  &__bottom {
    .@{popupPrefix}-content {
      bottom: 0;
    }
  }
}
