/**
 * @author https://github.com/zxwk1998/vue-admin-better （不想保留author可删除）
 * @description 全局样式
 */

@charset "utf-8";

@import './normalize.scss';
@import './transition.scss';
@import './loading.scss';
@import 'element-ui/lib/theme-chalk/display.css';

@mixin scrollbar {
  max-height: 88vh;
  margin-bottom: 0.5vh;
  overflow-y: auto;

  &::-webkit-scrollbar {
    width: 0;
    height: 0;
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background-color: rgba(144, 147, 153, 0.3);
    border-radius: 10px;
  }

  &::-webkit-scrollbar-thumb:hover {
    background-color: rgba(144, 147, 153, 0.3);
  }
}

@mixin base-scrollbar {
  &::-webkit-scrollbar {
    width: 13px;
    height: 13px;
  }

  &::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.4);
    background-clip: padding-box;
    border: 3px solid transparent;
    border-radius: 7px;
  }

  &::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
  }

  &::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
  }

  &::-webkit-scrollbar-track:hover {
    background-color: rgba(0, 0, 0, 0.08);
  }
}

img {
  object-fit: cover;
  border-radius: 6px;
}

a {
  color: $base-color-blue;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;

  &:hover {
    color: darken($base-color-blue, 10%);
  }
}

* {
  transition: $base-transition;
}

svg {
  transition: none;

  * {
    transition: none;
  }
}

html {
  body {
    position: relative;
    height: 100vh;
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: $base-font-size-default;
    color: #2c3e50;
    background: #f0f2f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    @include base-scrollbar;

    div {
      @include base-scrollbar;
    }

    svg,
    i {
      &:hover {
        opacity: 0.8;
      }
    }

    .v-modal {
      backdrop-filter: blur(10px);
    }

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

    .editor-toolbar {
      .no-mobile,
      .fa-question-circle {
        display: none;
      }
    }

    .el-divider--horizontal {
      margin: 15px 0 25px 0;

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

    .el-image-viewer {
      &__close {
        .el-icon-circle-close {
          color: $base-color-white;
        }
      }
    }

    .vue-admin-better-wrapper {
      .app-main-container {
        @include base-scrollbar;

        > [class*='-container'] {
          * {
            transition: none;
          }

          padding: $base-padding;
          background: $base-color-white;
          border-radius: 12px;
          box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
          border: 1px solid rgba(0, 0, 0, 0.02);
        }
      }
    }

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

      .bar {
        background: linear-gradient(90deg, $base-color-blue, lighten($base-color-blue, 20%)) !important;
        height: 3px !important;
      }

      .peg {
        box-shadow: 0 0 14px $base-color-blue, 0 0 8px $base-color-blue !important;
      }
    }

    .el-table {
      .el-table__body-wrapper {
        @include base-scrollbar;
      }

      th {
        background: #f8fafc;
      }

      td,
      th {
        position: relative;
        box-sizing: border-box;
        padding: 10px 0;

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

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

      &::before {
        height: 0;
      }

      .el-table__fixed-right {
        height: 100% !important;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
      }

      .el-table__fixed {
        height: 100% !important;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
      }
    }

    .el-pagination {
      padding: 2px 5px;
      margin: 20px 0 0 0;
      font-weight: normal;
      color: $base-color-black;
      text-align: center;
    }

    .el-menu.el-menu--popup.el-menu--popup-right-start {
      @include scrollbar;
      border-radius: 6px;
      border: none;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .el-menu.el-menu--popup.el-menu--popup-bottom-start {
      @include scrollbar;
      border-radius: 6px;
      border: none;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .el-submenu__title i {
      color: $base-color-white;
    }

    .el-dialog,
    .el-message-box {
      border-radius: 10px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);

      &__body {
        border-top: 1px solid $base-border-color;

        .el-form {
          padding-right: 30px;
        }
      }

      &__footer {
        padding: $base-padding;
        text-align: right;
        border-top: 1px solid $base-border-color;
      }

      &__content {
        padding: 20px 20px 20px 20px;
      }
    }

    .el-card {
      margin-bottom: 16px;
      border-radius: 12px;
      border: none;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
      transition: all 0.3s ease;

      &:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09);
        transform: translateY(-2px);
      }

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

    /* VabPageHeader 全局样式 - 高优先级 */
    .page-header {
      background: linear-gradient(135deg, #518df1 0%, #667eea 100%) !important;
      border-radius: 16px !important;
      padding: 32px !important;
      margin-bottom: 24px !important;
      color: white !important;
      box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3) !important;
      border: none !important;
      position: relative;
      overflow: hidden;

      &::before {
        content: '';
        position: absolute;
        top: -50%;
        right: -50%;
        bottom: -50%;
        left: -50%;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
        transform: rotate(30deg);
      }

      .header-content {
        position: relative;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;

        .header-left {
          .page-title {
            font-size: 2.2rem !important;
            font-weight: 700 !important;
            margin: 0 0 10px 0 !important;
            display: flex !important;
            align-items: center !important;
            gap: 14px !important;
            color: white !important;

            .vab-icon {
              font-size: 2rem !important;
              color: white !important;
              background: rgba(255, 255, 255, 0.2);
              border-radius: 12px;
              padding: 8px;
            }
          }

          .page-description {
            font-size: 1.1rem !important;
            opacity: 0.95 !important;
            margin: 0 !important;
            color: white !important;
            font-weight: 300;
          }
        }

        .header-right {
          display: flex !important;
          align-items: center !important;
          gap: 10px !important;
          font-size: 1.2rem !important;
          font-weight: 500 !important;
          color: white !important;
          background: rgba(255, 255, 255, 0.2);
          padding: 12px 20px;
          border-radius: 12px;
          backdrop-filter: blur(10px);

          .vab-icon {
            font-size: 1.4rem !important;
            color: white !important;
          }
        }
      }
    }

    /* 响应式设计 */
    @media (max-width: 768px) {
      .page-header {
        padding: 22px !important;
        border-radius: 12px !important;

        .header-content {
          flex-direction: column !important;
          gap: 18px !important;
          text-align: center !important;

          .header-left {
            .page-title {
              font-size: 1.7rem !important;
            }
          }

          .header-right {
            width: 100%;
            justify-content: center;
          }
        }
      }
    }

    .select-tree-popper {
      .el-scrollbar {
        .el-scrollbar__view {
          .el-select-dropdown__item {
            height: auto;
            max-height: 274px;
            padding: 0;
            overflow-y: auto;
            line-height: 26px;
          }
        }
      }
    }

    /* 扩展 el-divider 样式 */
    .el-divider {
      position: relative;
      border: none;
      background: linear-gradient(90deg, transparent, #e4e7ed, transparent);

      &--horizontal {
        height: 1px;
        margin: 24px 0 32px 0;

        .el-divider__text {
          position: relative;
          padding: 0 18px;
          font-size: 14px;
          font-weight: 500;
          color: #606266;
          background: #fff;
          border-radius: 6px;

          &::before {
            content: '';
            position: absolute;
            top: 50%;
            left: -8px;
            width: 4px;
            height: 4px;
            margin-top: -2px;
            background: #409eff;
            border-radius: 50%;
          }
        }
      }

      &--vertical {
        width: 1px;
        height: 1em;
        margin: 0 16px;
        background: #e4e7ed;
      }

      /* 主题变体 */
      &--primary {
        background: linear-gradient(90deg, transparent, #409eff, transparent);

        .el-divider__text {
          color: #409eff;

          &::before {
            background: #409eff;
          }
        }
      }

      &--success {
        background: linear-gradient(90deg, transparent, #67c23a, transparent);

        .el-divider__text {
          color: #67c23a;

          &::before {
            background: #67c23a;
          }
        }
      }

      &--warning {
        background: linear-gradient(90deg, transparent, #e6a23c, transparent);

        .el-divider__text {
          color: #e6a23c;

          &::before {
            background: #e6a23c;
          }
        }
      }

      &--danger {
        background: linear-gradient(90deg, transparent, #f56c6c, transparent);

        .el-divider__text {
          color: #f56c6c;

          &::before {
            background: #f56c6c;
          }
        }
      }

      /* 虚线样式 */
      &--dashed {
        background: none;
        border-top: 1px dashed #e4e7ed;

        .el-divider__text {
          background: #fff;
        }
      }

      /* 粗线样式 */
      &--thick {
        height: 2px;
        background: linear-gradient(90deg, transparent, #409eff, transparent);
      }
    }
  }

  .side-container {
    .el-menu-item,
    .el-submenu {
      margin: 7px !important;
      border-radius: 5px !important;
      transition: all 0.3s ease;

      &:hover {
        border-radius: 5px !important;
      }

      &.is-active {
        background: linear-gradient(90deg, $base-color-default, lighten($base-color-default, 10%)) !important;
      }
    }
  }
}
