/** @description 全局样式 */
@import './transition.scss';
@import './loading.scss';
@mixin base-scrollbar {
  &::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  &::-webkit-scrollbar-thumb {
    background-color: rgba($base-menu-background, 0.1);
    border: 3px solid transparent;
    border-radius: 7px;
  }
  &::-webkit-scrollbar-thumb:hover {
    background-color: rgba($base-menu-background, 0.2);
  }
}

.dgiot-layout-header,
[class*='-bar-container'] {
  transition: $base-transition;

  * {
    transition: $base-transition;
  }
}

html {
  body,
  body[class*='dgiot-theme-'] {
    position: relative;
    box-sizing: border-box;
    height: 100vh;
    padding: 0;
    overflow: hidden;
    font-family: 'PingFang SC', Arial, 'Microsoft YaHei', sans-serif;
    font-size: $base-font-size-default;
    color: $base-color-black;
    background: $base-color-background;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    #dgiot {
      height: 100vh;
      overflow: auto;
      @include base-scrollbar;

      .dgiot-main {
        transition: $base-transition;

        .dgiot-app-main {
          width: 100%;
          padding: 0 1.5px;
          overflow: hidden;
          transition: $base-transition;

          > section {
            height: calc(100vh - #{$base-top-bar-height} * 1.9);
            overflow-x: hidden;
            overflow-y: scroll;
            background: $base-color-white;
            transition: $base-transition;

            > [class*='-container'] {
              min-height: $base-keep-alive-height;
              padding: $base-padding;
              background: $base-color-white;
              transition: $base-transition;
            }
          }
        }
      }
    }

    * {
      box-sizing: border-box;
      @include base-scrollbar;
    }

    /*a标签 */
    a {
      color: $base-color-blue;
      text-decoration: none;
    }

    /*图片 */
    img {
      object-fit: cover;

      &[src=''],
      &:not([src]) {
        opacity: 0;
      }
    }

    /* dgiot-dropdown下拉动画 */
    .dgiot-dropdown {
      transition: $base-transition;

      &-active {
        transform: rotateZ(180deg);
      }
    }

    /* dgiot-fullscreen全屏 */
    .dgiot-fullscreen {
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      z-index: $base-z-index + 3 !important;
      box-sizing: border-box !important;
      width: 100vw !important;
      height: 100vh !important;
      padding-bottom: 15px !important;
      overflow: auto !important;
      background: #fff;
    }

    /* dgiot-dot圆点动画 */
    .dgiot-dot {
      position: relative;
      display: inline-block;
      width: 6px;
      height: 6px;
      margin-right: 3px;
      vertical-align: middle;
      border-radius: 50%;

      span {
        position: absolute;
        top: 0;
        left: 0;
        box-sizing: border-box;
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        animation: dgiotDot 1.2s ease-in-out infinite;
        @keyframes dgiotDot {
          0% {
            opacity: 0.6;
            transform: scale(0.8);
          }
          to {
            opacity: 0;
            transform: scale(2.4);
          }
        }
      }

      &-success {
        background: $base-color-green;

        span {
          background: $base-color-green;
        }
      }

      &-error {
        background: $base-color-red;

        span {
          background: $base-color-red;
        }
      }
    }

    /* dgiot-data-empty占位图 */
    .dgiot-data-empty {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: calc(#{$base-keep-alive-height});

      .el-image__inner {
        width: 22.5%;
      }
    }

    /* el-button按钮 */
    .el-button {
      [class*='ri'] {
        margin-right: 3px;
        font-size: 12px;
        vertical-align: -1.8px;
      }

      [class*='el-icon-'] + span {
        margin-left: 3px;
      }
    }

    span + span,
    a + a,
    span + a {
      .el-button {
        margin-left: 10px;
      }
    }

    .el-drawer__wrapper {
      outline: none !important;

      * {
        outline: none !important;
      }
    }

    /* v-modal遮罩 */
    .v-modal {
      z-index: $base-z-index;
      background-color: rgba(0, 0, 0, 0.5);
      opacity: 0.6;
      backdrop-filter: blur(10px);
    }

    //.el-dialog{
    //  position:absolute;
    //  top:50%;
    //  left:50%;
    //  display: flex;
    //  flex-direction: column;
    //  max-width:calc(100% - 30px);
    //  /*height:600px;*/
    //  max-height:calc(100% - 30px);
    //  margin:0 !important;
    //  transform:translate(-50%,-50%);
    //}
    //.el-dialog .el-dialog__body{
    //  flex:1;
    //  overflow: auto;
    //}
    .el-notification {
      max-width: 330px !important;
    }

    /* el-image-viewer遮罩 */
    .el-image-viewer__mask {
      background-color: rgba(0, 0, 0, 0.5);
      opacity: 0.6;
      backdrop-filter: blur(10px);
    }

    /* el-loading-mask遮罩 */
    .el-loading-mask {
      z-index: $base-z-index - 10 !important;

      &.is-fullscreen {
        z-index: $base-z-index + 99 !important;
      }
    }

    /* el-scrollbar滚动条 */
    .el-scrollbar {
      height: 100%;

      &__bar {
        z-index: 999;
      }

      &__thumb {
        background-color: rgba($base-menu-background, 0.1);

        &:hover {
          background-color: rgba($base-menu-background, 0.2);
        }
      }
    }

    /* el-form表单 */
    .el-form--label-top {
      .el-form-item__label {
        padding: 0;
      }
    }

    .el-form-item__label {
      padding: 0 10px 0 0;
    }

    .el-range-editor--small {
      .el-range__icon,
      .el-range__close-icon {
        line-height: 23.5px;
      }
    }

    /*  el-badge */
    .el-badge__content {
      border: 0;
    }

    /* el-tag */
    .el-tag + .el-tag {
      margin-left: 10px;
    }

    /*  .el-page-header */
    .el-page-header {
      margin: 0 0 $base-margin 0;
    }

    /* el-alert */
    .el-alert {
      margin: 0 0 $base-margin 0;

      &--success.is-light {
        color: $base-color-green;
        background-color: mix($base-color-white, $base-color-green, 90%);
        border: 1px solid $base-color-green;

        i {
          color: $base-color-green;
        }
      }

      &--info.is-light {
        color: $base-color-blue;
        background-color: mix($base-color-white, $base-color-blue, 90%);
        border: 1px solid $base-color-blue;

        i {
          color: $base-color-blue;
        }
      }

      &--warning.is-light {
        color: $base-color-yellow;
        background-color: mix($base-color-white, $base-color-yellow, 90%);
        border: 1px solid $base-color-yellow;

        i {
          color: $base-color-yellow;
        }
      }

      &--error.is-light {
        color: $base-color-red;
        background-color: mix($base-color-white, $base-color-red, 90%);
        border: 1px solid $base-color-red;

        i {
          color: $base-color-red;
        }
      }
    }

    /* el-dropdown-menu */
    .el-dropdown-menu__item {
      [class*='ri-'] {
        margin-right: 0;
      }
    }

    /* markdown编辑器*/
    .editor-toolbar {
      .no-mobile,
      .fa-question-circle {
        display: none;
      }
    }

    /* el-divider间隔线 */
    .el-divider--horizontal {
      margin: 8px 0 $base-margin + 8px 0;

      .el-divider__text {
        display: -webkit-box;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
      }
    }

    /* nprogress进度条 */
    #nprogress {
      position: fixed;
      z-index: $base-z-index + 3;

      .bar {
        background: $base-color-blue;
      }

      .peg {
        box-shadow: 0 0 10px $base-color-blue, 0 0 5px $base-color-blue;
      }
    }

    /* el-table表格 */
    .el-table {
      .el-table__body-wrapper {
        @include base-scrollbar;
      }

      th {
        background: #f5f7fa;
      }

      td,
      th {
        position: relative;
        box-sizing: border-box;

        .cell {
          font-size: $base-font-size-default;
          font-weight: normal;
          color: #606266;

          .el-image {
            width: 50px;
            height: 50px;
            border-radius: $base-border-radius;
          }
        }
      }
    }

    /* el-pagination分页 */
    .el-pagination {
      margin: $base-margin 0 0 0;
      font-weight: normal;
      color: $base-color-black;
      text-align: center;
    }

    /* el-menu菜单开始 */
    .el-menu {
      user-select: none;
    }

    /* el-dialog、el-message-box、el-popover */
    @media (max-width: 576px) {
      .el-dialog,
      .el-message-box,
      .el-popover.el-popper {
        width: auto !important;
        margin: 5vw;
      }
    }
    /* el-card卡片 */
    .el-card {
      margin-bottom: $base-margin;

      &__body {
        padding: $base-padding;
      }
    }

    /* .dgiot-hey-message */
    .dgiot-hey-message {
      @mixin dgiot-hey-message {
        min-width: 246px;
        padding: 15px;
        background-color: $base-color-white;
        border-color: $base-color-white;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);

        .el-message__content {
          padding-right: $base-padding;
          color: #34495e;
        }

        .el-icon-close {
          color: #34495e;

          &:hover {
            opacity: 0.8;
          }
        }
      }

      &-info {
        @include dgiot-hey-message;

        i {
          color: $base-color-gray;
        }
      }

      &-success {
        @include dgiot-hey-message;

        i {
          color: $base-color-green;
        }
      }

      &-warning {
        @include dgiot-hey-message;

        i {
          color: $base-color-yellow;
        }
      }

      &-error {
        @include dgiot-hey-message;

        i {
          color: $base-color-red;
        }
      }
    }
  }
}
