/** 全局样式及辅助类 */
@import './themes/default.scss';

* {
  margin: 0;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  scrollbar-width: thin;
}

body {
  color: $--color-text-regular;
  font-size: $--font-size-base;
  font-family: $--body-font-family;
  background: $--color-white;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: $--color-primary;

  &:hover {
    color: $--color-primary-light-2;
  }
}

input {
  background-color: transparent;
}

textarea {
  font-family: inherit;
}

/* 标题 */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: normal;
  font-size: $--font-size-medium;
  color: $--color-text-primary;
}

h5 {
  font-size: ($--font-size-medium + 2px);
}

h4 {
  font-size: ($--font-size-medium + 4px);
}

h3 {
  font-size: ($--font-size-medium + 6px);
}

h2 {
  font-size: ($--font-size-medium + 8px);
}

h1 {
  font-size: ($--font-size-medium + 10px);
}

// 文字
.ele-text {
  color: $--color-text-regular;
}

.ele-text-heading {
  color: $--color-text-primary;
}

.ele-text-secondary {
  color: $--color-text-secondary;
}

.ele-text-placeholder {
  color: $--color-text-placeholder;
}

.ele-text-primary {
  color: $--color-primary;
}

.ele-text-success {
  color: $--color-success;
}

.ele-text-warning {
  color: $--color-warning;
}

.ele-text-danger {
  color: $--color-danger;
}

.ele-text-info {
  color: $--color-info;
}

.ele-text-delete {
  text-decoration: line-through;
}

.ele-text-small,
.ele-text-small > .el-progress__text {
  font-size: $--font-size-extra-small !important;
}

// 背景和边框
.ele-bg-base {
  background-color: $--layout-body-background !important;
}

.ele-bg-primary {
  background-color: $--color-primary !important;
}

.ele-bg-success {
  background-color: $--color-success !important;
}

.ele-bg-warning {
  background-color: $--color-warning !important;
}

.ele-bg-danger {
  background-color: $--color-danger !important;
}

.ele-bg-info {
  background-color: $--color-info !important;
}

.ele-bg-info-lighter {
  background-color: $--color-info-lighter !important;
}

.ele-bg-white {
  background-color: $--color-white !important;
}

.ele-border-primary {
  border-color: $--color-primary !important;
}

.ele-border-success {
  border-color: $--color-success !important;
}

.ele-border-warning {
  border-color: $--color-warning !important;
}

.ele-border-danger {
  border-color: $--color-danger !important;
}

.ele-border-info {
  border-color: $--color-info !important;
}

.ele-border-base {
  border-color: $--border-color-base !important;
}

.ele-border-light {
  border-color: $--border-color-light !important;
}

.ele-border-lighter {
  border-color: $--border-color-lighter !important;
}

.ele-border-extra-light {
  border-color: $--border-color-extra-light !important;
}

// 浮动
.ele-pull-left {
  float: left;
}

.ele-pull-right {
  float: right;
}

.ele-clear {
  clear: both;
}

.ele-clear-after:after {
  content: '';
  clear: both;
  display: block;
}

// 对齐方式
.ele-text-center {
  text-align: center;
}

.ele-text-left {
  text-align: left;
}

.ele-text-right {
  text-align: right;
}

.ele-fluid {
  width: 100% !important;
}

.ele-block {
  display: block;
}

.ele-inline-block {
  display: inline-block;
}

.ele-inline {
  display: inline;
}

// 占位元素
em:not([class]) {
  padding: 0 0.5em;
  font-style: normal;
}

s:not([class]) {
  padding: 0 0.125em;
  font-style: normal;
}

// 文字省略
.ele-elip {
  overflow: hidden;
  white-space: nowrap;
  word-break: break-all;
  text-overflow: ellipsis;
}

/* 单元格 */
.ele-cell {
  display: flex;

  &:not(.ele-cell-align-top) {
    align-items: center;
  }

  &.ele-cell-align-bottom {
    align-items: flex-end;
  }

  & > .ele-cell-content {
    flex: 1;
    box-sizing: border-box;
  }

  & > * + .ele-cell-content {
    padding-left: 10px;
  }

  .ele-cell-title {
    color: $--color-text-primary;
    font-size: 15px;
  }

  .ele-cell-desc {
    color: $--color-text-secondary;
    font-size: 13px;
    margin-top: 8px;
  }
}

/* 间距 */
.ele-space {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

/* 页面容器 */
.ele-body {
  padding: 15px;

  &.ele-body-card {
    padding-bottom: 0;

    .el-card {
      margin-bottom: 15px;
    }
  }
}

/* 底部工具栏 */
.ele-bottom-tool {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 10px 15px;
  box-sizing: border-box;
  background: $--color-white;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03);
  transition: padding-left $--sidebar-transition-anim;
  z-index: ($--layout-z-index - 1);

  .ele-bottom-tool-actions {
    flex: 1;
    text-align: right;
  }
}

@media screen and (min-width: 768px) {
  .ele-admin-sidebar + .ele-admin-body .ele-bottom-tool {
    padding-left: ($--sidebar-width + 15px);
  }

  .ele-layout-collapse .ele-admin-sidebar + .ele-admin-body .ele-bottom-tool {
    padding-left: ($--sidebar-collapse-width + 15px);
  }
}

/* 顶部标题 */
.ele-page-header {
  padding: 20px 25px 16px 25px;
  background: $--color-white;
  border-bottom: 1px solid $--border-color-extra-light;

  .ele-page-title {
    font-size: 19px;
    color: $--color-text-primary;
  }

  .ele-page-desc {
    margin-top: 8px;
    color: $--color-text-secondary;
  }
}

/* 按钮加图标减少间距 */
.ele-btn-icon,
.ele-btn-icon.is-round {
  padding-left: 12px;
  padding-right: 12px;

  &.el-button--small {
    padding-left: 10px;
    padding-right: 10px;
  }

  &.el-button--mini {
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* 相邻操作类元素加间距 */
.el-button + .el-link,
.el-button + .el-dropdown,
.el-button + .ele-action,
.el-link + .el-button,
.el-link + .el-link,
.el-link + .el-dropdown,
.el-link + .ele-action,
.el-dropdown + .el-button,
.el-dropdown + .el-link,
.el-dropdown + .el-dropdown,
.el-dropdown + .ele-action,
.ele-action + .el-button,
.ele-action + .el-link,
.ele-action + .el-dropdown,
.ele-action + .ele-action,
.el-tag + .el-tag {
  margin-left: 10px;
}

.el-select .el-tag + .el-tag,
.el-cascader__tags .el-tag + .el-tag {
  margin-left: 6px;
}

.ele-action-group {
  & > .el-button,
  & > .el-link,
  & > .el-dropdown,
  & > .el-tag,
  & > .ele-action {
    margin-top: 5px;
    margin-bottom: 5px;
  }
}

/* 表单详情 */
.ele-form-detail .el-form-item {
  margin-bottom: 10px;
}

/* 水平搜索表单 */
.ele-form-search .el-form-item,
.ele-form-search .ele-form-actions {
  margin-bottom: 15px;
}

@media screen and (min-width: 768px) {
  .ele-form-search.el-form--inline {
    .el-form-item:not(.ele-form-actions) .el-form-item__content {
      max-width: 200px;
    }

    .ele-form-actions {
      padding-left: 15px;
    }
  }
}

@media screen and (max-width: 768px) {
  .el-form--inline {
    .el-form-item {
      display: flex;
      margin-right: 0;
    }

    .el-form-item__content {
      flex: 1;
    }
  }

  .ele-form-search .ele-form-actions {
    text-align: right;
  }
}

/* 表格 */
.ele-table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;

  tr {
    transition: background-color 0.25s ease;
  }

  thead tr {
    background: $--table-header-background-color;
  }

  tbody tr:hover,
  &.ele-table-stripe tr:nth-child(even) {
    background: $--table-row-hover-background-color;
  }

  tbody tr.ele-table-active {
    background: $--table-current-row-background-color;
  }

  th,
  td {
    line-height: 23px;
    padding: 12px 10px;
    color: $--table-font-color;
    border-width: 0;
    border-style: solid;
    border-color: $--table-border-color;
    border-bottom-width: 1px;
    text-align: left;
  }

  th {
    color: $--table-header-font-color;
  }

  // 显示边框
  &.ele-table-border {
    th,
    td {
      border-width: 1px;
    }
  }

  // 尺寸控制
  &.ele-table-medium {
    th,
    td {
      padding-top: 10px;
      padding-bottom: 10px;
    }
  }

  &.ele-table-small {
    th,
    td {
      padding-top: 8px;
      padding-bottom: 8px;
      font-size: 12px;
    }
  }

  &.ele-table-mini {
    th,
    td {
      padding-top: 6px;
      padding-bottom: 6px;
      font-size: 12px;
    }
  }
}

/* 级联选择器增加高度 */
.ele-pop-wrap-higher .el-cascader-menu__wrap {
  height: 280px;
}

/* 图表提示框圆点 */
.ele-chart-dot {
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  display: inline-block;
  background: #3aa1ff;
}

.echarts > div {
  max-width: 100%;
  overflow: hidden;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  border-radius: 6px;
  border: 2px solid transparent;
  background-color: $--scrollbar-background-color;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: $--scrollbar-hover-background-color;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

.ele-scrollbar-mini::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.ele-scrollbar-mini::-webkit-scrollbar-track {
  background: none;
}

.ele-scrollbar-mini::-webkit-scrollbar-thumb {
  border-radius: 3px;
  border: none;
}

.ele-scrollbar-hide::-webkit-scrollbar,
.ele-scrollbar-hover:not(:hover)::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.ele-scrollbar-hover,
.ele-scrollbar-hide {
  overflow: auto;
}
