@import '../prefix';
@import '../colors';
@import '../font';
@import '../z-index';
@import 'animations';
@import 'visuals';

.dropcircle(@radius: 200px) {
  position: absolute;
  display: block;
  margin: 0 auto;
  top: 50%;
  left: 50%;
  margin-top: -@radius;
  margin-left: -@radius;
  background-color: @admin-blue;
  width: 2 * @radius;
  height: 2 * @radius;
  line-height: 2 * @radius;
  color: @admin-white;
  content: attr(data-drop);
  font-weight: normal;

  box-sizing: border-box;
  border-radius: @radius;
  box-shadow: 0 0 10px @admin-shadow-gray;
  .animation(pulsate, 4s);
}

.dialog-uploader-mask() {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  opacity: .9;
  z-index: @z-index-modal-dialog + 2;
}

.dialog-dropzone(@circle-radius: 200px) {
  .dropzone {
    width: 100%;
    height: 100%;
    overflow: visible;
    border: 0 none;
    background-color: transparent;
    z-index: @z-index-modal-dialog + 3;
    position: absolute;

    &:before {
      .dropcircle(@circle-radius);
      z-index: @z-index-modal-dialog + 3;
    }
  }
}

.dialog-dropzone-container(@circle-radius: 200px) {
  height: 100%;
  position: absolute;
  top: 0;
  width: 100%;
  left: 0;

  .dialog-dropzone(@circle-radius);
  .uploader-mask {
    .dialog-uploader-mask();
  }
}

.default-slick-cell-styling(@padding: 8px) {
  border: none;
  padding: @padding;
  cursor: default;
  box-sizing: border-box;
}

.arrow(@color, @height) {

  &:before {
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
    border: @height solid transparent;
  }

  &.bottom {
    margin-top: @height;

    &:before {
      border-bottom-color: @color;
      top: -2 * @height;
      left: 50%;
      margin-left: -@height;
    }
  }

  &.left {
    margin-right: @height;

    &:before {
      border-left-color: @color;
      right: -2 * @height;
      top: 50%;
      margin-top: -@height;
    }
  }

  &.top {
    margin-bottom: @height;

    &:before {
      border-top-color: @color;
      bottom: -2 * @height;
      left: 50%;
      margin-left: -@height;
    }
  }

  &.right {
    margin-left: @height;

    &:before {
      border-right-color: @color;
      left: -2 * @height;
      top: 50%;
      margin-top: -@height;
    }
  }
}

.watermark-text(@font-size: 16px, @ellipsis: false) {
  font-size: @font-size;
  font-family: @admin-font-family;
  color: lightgray;
  top: 50%;
  text-align: center;
  line-height: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  width: 100%;
  position: absolute;
  & when (@ellipsis = true) {
    .ellipsis();
  }
}

.picker() {
  .@{_COMMON_PREFIX}wrapper {
    position: relative;

    .@{_COMMON_PREFIX}text-input {
      width: 100%;
      padding: 4px 32px 4px 5px;
      line-height: 27px;
    }
  }
}

.picker-dialog(@width: 100%, @padding: 10px) {
  position: absolute;
  display: none;
  top: auto;
  left: auto;
  bottom: auto;
  right: auto;
  height: auto;
  width: @width;
  z-index: 100;
  padding: @padding;
  background-color: #ffffff;
  .material-layer-shadow();
}

.home-main-container-mixin(@opacity: 1, @bgPosition: center) {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;

  .center-panel {
    display: flex;
    align-content: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    & when not (@opacity = 1) {
      background-color: rgba(0, 0, 0, @opacity);
    }
  }

  .lazy-image {
    width: 100%;
    min-height: 100%;
    position: absolute;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    background-position: @bgPosition;

    transition: opacity 2s;
    &.empty {
      opacity: 0;
    }
  }
}

.headers-mixin() {
  h1 {
    font-size: 34px;
    line-height: 40px;
  }

  h2 {
    font-size: 30px;
    line-height: 40px;
  }

  h3 {
    font-size: 26px;
    line-height: 40px;
  }

  h4 {
    font-size: 22px;
    line-height: 20px;
  }

  h5 {
    font-size: 18px;
    line-height: 20px;
  }

  h6 {
    font-size: 14px;
    line-height: 16px;
  }
}

.content-status-mixin() {
  .equal, .online, .modified {
    color: @admin-green;
  }
  .pending {
    color: @admin-orange;
  }
  .expired {
    color: @admin-red;
  }
  .offline {
    color: @admin-font-gray1;
  }
  .modified {
    font-style: italic;
  }
}

.form-element-spacing(@size: 20px) {
  &:not(:first-of-type) {
    margin-top: @size;
  }

  &:not(:last-of-type) {
    margin-bottom: @size;
  }
}

.button(@color: @form-button-font, @bg: @form-button-bg, @hoverColor: @color, @hoverBg: lighten(@bg, 10%), @padding: 5px 20px) {
  .button-background(@bg, @hoverBg);
  .button-foreground(@color, @hoverColor, @admin-button-blue1);
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: start;
  align-content: center;
  align-items: center;
  padding: @padding;
  cursor: pointer;

  span {
    font-size: 14px;
    font-family: @admin-font-family;
    white-space: nowrap;
    .color-transition();
  }

  &:disabled {
    opacity: 0.5;
    cursor: default;
  }
}

.dialog-button(@color: @form-button-font, @bg: @admin-button-blue2, @hoverColor: @color, @hoverBg: lighten(@bg, 10%)) {
  .button(@color, @bg, @hoverColor, @hoverBg, 7px 19px);
}

.checkbox-right() {
  display: grid;
  grid-template-columns: 1fr 44px;
  grid-template-areas:
        "data checkbox"
}

.checkbox-left() {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-areas:
        "checkbox data"
}
