@import './var.css';
@import 'element-plus/theme-chalk/dark/css-vars.css';
@import './mixin.scss';

.reset-margin [class*='el-icon'] + span {
  margin-left: 2px !important;
}

.in-app {
  .el-loading-mask > .el-loading-spinner {
    @media screen and (orientation: portrait) {
      transform: rotate(90deg);
    }
  }
  #app {
    @media screen and (orientation: portrait) {
      position: absolute;
      width: 100vh !important;
      height: 100vw !important;
      top: 0;
      left: 100vw;
      -webkit-transform: rotate(90deg);
      -moz-transform: rotate(90deg);
      -ms-transform: rotate(90deg);
      transform: rotate(90deg);
      transform-origin: 0% 0%;
    }

    @media screen and (orientation: landscape) {
      position: absolute;
      top: 0;
      left: 0;
      width: 100vw !important;
      height: 100vh !important;
    }
  }

  .el-message {
    @media screen and (orientation: portrait) {
      top: 50% !important;
      width: max-content;
      transform: translateY(-50%) rotate(90deg) translateY(50%);
    }
  }

  .el-notification {
    @media screen and (orientation: portrait) {
      top: 50% !important;
      left: 40vw !important;
      transform: translateY(-50%) rotate(90deg);
    }
  }

  // 解决抽屉弹出时，body宽度变化的问题
  .el-popup-parent--hidden {
    width: 100% !important;

    #app,
    & > .el-overlay {
      @media screen and (orientation: portrait) {
        position: absolute;
        width: 100vh !important;
        height: 100vw !important;
        top: 0;
        left: 100vw;
        -webkit-transform: rotate(90deg);
        -moz-transform: rotate(90deg);
        -ms-transform: rotate(90deg);
        transform: rotate(90deg);
        transform-origin: 0% 0%;
      }

      @media screen and (orientation: landscape) {
        position: absolute;
        top: 0;
        left: 0;
        width: 100vw !important;
        height: 100vh !important;
      }
    }
  }

  .el-popper {
    @media screen and (orientation: portrait) {
      .el-dropdown-menu {
        transform: rotate(90deg) translateY(-100%);
        transform-origin: top left;
      }
    }
  }
}

// 解决表格内容超过表格总宽度后，横向滚动条前端顶不到表格边缘的问题
.el-scrollbar__bar {
  display: flex;
  justify-content: flex-start;
}

/* nprogress 适配 element-plus 的主题色 */
#nprogress {
  & .bar {
    background-color: var(--el-color-primary) !important;
  }

  & .peg {
    box-shadow:
      0 0 10px var(--el-color-primary),
      0 0 5px var(--el-color-primary) !important;
  }

  & .spinner-icon {
    border-top-color: var(--el-color-primary);
    border-left-color: var(--el-color-primary);
  }
}

// 解决tabs样式第二标签左边距为0的问题
.el-tabs {
  .el-tabs__item.is-top:nth-child(2) {
    padding-left: 20px;
  }
}

// 处理menu top hover样式问题
.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
  background-color: var(--left-menu-text-active-color) !important;
  color: var(--left-menu-bg-color) !important;
}

.el-dialog {
  padding: 0 !important;
}

.avue-text-ellipsis__text {
  word-break: break-all;
}
.avue-tree {
  .el-tree-node__content {
    min-height: var(--el-tree-node-content-height);
    height: auto;
  }
  .el-tree-node__label {
    white-space: normal;
    word-break: break-word;
  }
}

//优化el-tree内容显示不全问题
.el-tree-node__content {
  height: auto !important;
  min-height: var(--el-tree-node-content-height);
}
.el-tree-node__label {
  white-space: normal;
  word-break: break-all;
}

@include scrollBar;
