// stylelint-disable no-descending-specificity

@use "sass:math";

@import '~@alauda/ui/theme/var';
@import '~@alauda/ui/theme/pattern';
@import './mixins';

$font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Helvetica Neue',
  'Helvetica', 'Ubuntu', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei',
  'WenQuanYi Micro Hei', sans-serif;
$page-min-width: 1200px;

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  &,
  &:before,
  &:after {
    margin: 0;
    padding: 0;
    border: 0;
    box-sizing: border-box;
    font: inherit;
    font-size: 100%;
    vertical-align: baseline;
  }

  &:focus {
    outline: none;
  }
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
  &:before,
  &:after {
    content: '';
    content: none;
  }
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

html {
  width: 100%;
  height: 100%;
  font: {
    family: $font-family;
    size: $font-size-regular;
    weight: $font-weight-normal;
  }

  line-height: math.div(4, 3);
  color: $color-text-main;
}

body {
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: $page-min-width;
  min-height: 100%;
  background-color: $color-disabled-bg;
}

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

pre,
code {
  word-break: break-all;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 18px;
  padding: 8px;
  background: #ededed;
  border-radius: 2px;

  &[ngCodeColorize] {
    padding: 0 8px;
  }
}

pre,
code,
textarea {
  // same as monoco-code-editor
  font-family: Menlo, Monaco, 'Courier New', monospace;
}

input {
  &:-webkit-autofill {
    background: {
      color: #fff;
      image: none;
    }

    box-shadow: 0 0 0 1000px white inset;
  }
}

[hidden] {
  display: none !important;
}

@for $i from 1 through 8 {
  .flex-#{$i} {
    flex: $i !important;
  }
}

.ng-animate .ng-hide-add {
  &,
  &-active {
    display: none;
  }
}

.sk-folding-cube {
  width: 40px;
  height: 40px;
  position: relative;
  transform: rotateZ(45deg);

  &.index-loading-spinner {
    position: fixed;
    top: calc(50% - 20px);
    left: calc(50% - 20px);
  }

  .sk-cube {
    float: left;
    width: 50%;
    height: 50%;
    position: relative;
    transform: scale(1.1);

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: #006eff;
      animation: sk-foldCubeAngle 2.4s infinite linear both;
      transform-origin: 100% 100%;
    }
  }

  .sk-cube2 {
    transform: scale(1.1) rotateZ(90deg);

    &:before {
      animation-delay: 0.3s;
    }
  }

  .sk-cube3 {
    transform: scale(1.1) rotateZ(180deg);

    &:before {
      animation-delay: 0.6s;
    }
  }

  .sk-cube4 {
    transform: scale(1.1) rotateZ(270deg);

    &:before {
      animation-delay: 0.9s;
    }
  }
}

@keyframes sk-foldCubeAngle {
  from,
  10% {
    transform: perspective(140px) rotateX(-180deg);
    opacity: 0;
  }

  25%,
  75% {
    transform: perspective(140px) rotateX(0deg);
    opacity: 1;
  }

  90%,
  to {
    transform: perspective(140px) rotateY(180deg);
    opacity: 0;
  }
}

.aui-page {
  &__sider {
    background-color: $nav-menu-bg-color-main;
  }

  &__content {
    display: flex;

    > div {
      flex: 1;
      margin: 0 auto;
      max-width: 100%;
    }
  }
}

$fixed-form-footer-height: 56px;

.acl-inline-select {
  &--large {
    @include inline-select;
    > label {
      font-size: $font-size-large;
    }

    aui-select .aui-input {
      &--large,
      &-group--large {
        height: $input-large-height - 2;
      }
    }
  }

  &,
  &--medium {
    @include inline-select;
    > label {
      font-size: $font-size-regular;
    }
    aui-select .aui-input {
      &--medium,
      &-group--medium {
        height: $input-medium-height - 2;
      }
    }
  }

  &--small {
    @include inline-select;
    > label {
      font-size: $font-size-regular;
    }
    aui-select .aui-input {
      &--small,
      &-group--small {
        height: $input-small-height - 2;
      }
    }
  }

  &--mini {
    @include inline-select;
    > label {
      font-size: $font-size-small;
    }
    aui-select .aui-input {
      &--mini,
      &-group--mini {
        height: $input-mini-height - 2;
      }
    }
  }
}

// auiTable 独立存在或不依赖于其他组件， 吸附 table 列头
.sticky-table-header {
  @include sticky-header($page-header-height + $page-toolbar-height);
}

// auiTable 包含在 auiCard 中，同时吸附卡片头部和 table 列头
.sticky-card_table-header {
  @include sticky-header($page-header-height + $page-toolbar-height);

  &.aui-card__header {
    margin-top: -12px;
    padding: 12px 0 12px 0;
    background-color: $color-white;

    + .aui-card__content {
      margin: 0;

      @include sticky-table-header(
        $page-header-height + $page-toolbar-height + 56px
      );
    }
  }
}

.paltform-about-dialog {
  .aui-dialog__content {
    padding: 0;
  }
}

.ellipsis-dialog-header {
  display: flex;
  max-width: 464px;

  .extra {
    &:first-child {
      margin-right: 4px;
    }

    &:last-child {
      margin-left: 4px;
    }
  }
}

.ellipsis-dialog-header,
.text-ellipsis {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow-x: hidden;
  overflow-wrap: break-word;
}
