// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
// Copyright (c) 2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>

// Buttons

%btn {
  appearance: none;
  align-items: center;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  font-size: $fs13;
  height: 30px;
  justify-content: center;
  min-width: 25px;
  padding: 0 1rem;
  transition: all .4s;
  text-decoration: none !important;
  svg {
    height: 15px;
    width: 15px;
  }
  &.btn-large {
    font-size: $fs14;
    height: 40px;
    svg {
      height: 20px;
      width: 20px;
    }
  }
  &.btn-small {
    height: 25px;
  }
}

.btn-primary {
  @extend %btn;
  background: $color-primary;
  color: $color-black;
  &:hover {
    background: $color-black;
    color: $color-primary;
  }
}

.btn-secondary {
  @extend %btn;
  background: $color-white;
  border: 1px solid $color-gray-20;
  color: $color-black;
  &:hover {
    background: $color-primary;
    border-color: $color-primary;
    color: $color-black;
  }
}

.btn-warning {
  @extend %btn;
  background: $color-danger;
  color: $color-white;
  &:hover {
    background: $color-danger-dark;
    color: $color-white;
  }
}

.btn-text-basic {
  @extend %btn;
  background: transparent;
  color: $color-primary-dark;
  flex-shrink: 0;
  &:hover {
    background: rgba(49,239,184,.12);
  }
}

.btn-icon-dark {
  @extend %btn;
  background: $color-gray-60;
  color: $color-gray-20;
  padding: $x-small;
  svg {
    fill: $color-gray-20;
  }
  &:hover {
    background: $color-primary;
    color: $color-gray-60;
    svg {
      fill: $color-gray-60;
    }
  }
}

.btn-icon-light {
  @extend %btn;
  background: $color-white;
  border: 1px solid $color-gray-20;
  color: $color-black;
  padding: $x-small;
  svg {
    fill: $color-black;
  }
  &:hover {
    background: $color-primary;
    border-color: $color-primary;
    svg {
      fill: $color-black;
    }
  }
}

.btn-icon-basic {
  @extend %btn;
  background: transparent;
  color: $color-gray-60;
  padding: $x-small;
  svg {
    fill: $color-gray-60;
  }
  &:hover {
    background: transparent;
    svg {
      fill: $color-primary;
    }
  }
}

.btn-gray {
  @extend %btn;
  background: $color-gray-30;
  color: $color-white;
  &:hover {
    background: $color-gray-40;
  }
}

.btn-ocean {
  @extend %btn;
  background: $color-ocean;
  color: $color-white;
  &:hover {
    background: darken($color-ocean, 16%);
    color: $color-white;
  }
}

.btn-option {
  display: flex;
  a {
    margin-right: .5rem;
    &:last-child {
      margin-right: 0;
    }
  }
  &.column {
    flex-direction: column;
    a {
      margin-bottom: .5rem;
      &:last-child {
        margin-bottom: 0;
      }
    }
  }
  &.mr-small {
    margin: 1rem 0;
  }
  &.btn-option-400 {
    margin: 0 auto;
    max-width: 400px;
  }
  &.mb {
    margin-bottom: .5rem;
  }
}

input[type=button][disabled],
.btn-disabled {
  background-color: $color-gray-10;
  color: $color-gray-40;
  pointer-events: none;
}

// Text color

.text-error {
  background-color: $color-danger;
  border-radius: 3px;
  color: $color-danger-lighter;
  padding: 3px 6px;
}

.text-success {
  background-color: $color-success;
  border-radius: 3px;
  color: $color-white;
  padding: 3px 6px;
}

.text-warning {
  background-color: $color-warning;
  border-radius: 3px;
  color: $color-white;
  padding: 3px 6px;
}

.text-info {
  background-color: $color-complete;
  border-radius: 3px;
  color: $color-white;
  padding: 3px 6px;
}

// Slider dots

ul.slider-dots {
  align-items: center;
  display: flex;

  li {
    background-color: transparent;
    border-radius: 50%;
    border: 2px solid $color-white;
    cursor: pointer;
    height: 12px;
    flex-shrink: 0;
    margin: 6px;
    width: 12px;

    &.current,
    &:hover {
      background-color: $color-gray-10;
    }

  }

  &.dots-purple {

    li {
      border-color: $color-complete;

      &.current,
      &:hover {
        background-color: $color-complete;
      }

    }

  }

}

// Doted list

.doted-list {

  li {
    align-items: center;
    display: flex;
    padding: $small 0;

    &::before {
      background-color: $color-complete;
      border-radius: 50%;
      content: "";
      flex-shrink: 0;
      height: 10px;
      margin-right: 6px;
      width: 10px;
    }

    &.not-included {
      text-decoration: line-through;
    }

  }

}

// Tags

.tags {
  display: flex;
  flex-wrap: wrap;

  &:last-child {
    margin-right: 0;
  }

  .tag  {
    background-color: $color-gray-20;
    border-radius: 3px;
    color: $color-white;
    cursor: pointer;
    font-size: $fs14;
    font-weight: bold;
    margin: 0 $small $small 0;
    padding: 4px 8px;
    text-transform: uppercase;

    &:hover {
      background-color: $color-gray-40;
    }

    &.tag-primary {
      background-color: $color-primary;
      color: $color-white;

      &:hover {
        background-color: $color-primary-dark;
      }

    }

    &.tag-green {
      background-color: $color-success;
      color: $color-white;

      &:hover {
        background-color: $color-success-dark;
      }

    }

    &.tag-purple {
      background-color: $color-complete;
      color: $color-white;

      &:hover {
        background-color: $color-complete-dark;
      }

    }

    &.tag-orange {
      background-color: $color-warning;
      color: $color-white;

      &:hover {
        background-color: $color-warning-dark;
      }

    }

    &.tag-red {
      background-color: $color-danger;
      color: $color-white;

      &:hover {
        background-color: $color-danger-dark;
      }

    }

  }

}

// Input elements
.input-element {
  display: flex;
  flex-shrink: 0;
  position: relative;
  width: 75px;

  &::after,
  .after {
    color: $color-gray-20;
    font-size: $fs12;
    height: 20px;
    position: absolute;
    right: $small;
    text-align: right;
    top: 26%;
    width: 18px;
  }

  .after {
      width: auto;
      right: 6px;
  }

  &.mini {
    width: 43px;
  }

  // Input amounts

  &.pixels {
    & input {
      padding-right: 20px;
    }

    &::after {
      content: "px";
    }
  }

  &.percentail {

    &::after {
      content: "%";
    }
  }

  &.miliseconds {

    &::after {
      content: "ms";
    }
  }

  &.degrees {

    &::after {
      content: "dg";
    }
  }

  &.height {

    &::after {
      content: "H";
    }
  }

  &.width {

    &::after {
      content: "W";
    }
  }

  &.Xaxis {

    &::after {
      content: "X";
    }
  }

  &.Yaxis {

    &::after {
      content: "Y";
    }
  }

  &.large {
    min-width: 7rem;
  }
}

input,
select {
  background-color: $color-white;
  box-sizing: border-box;
  color: $color-gray-60;
  font-family: "worksans", sans-serif;
  font-size: $fs14;
  margin-bottom: $medium;
  -webkit-appearance: none;
  -moz-appearance: none;
}

input[type="radio"],
input[type="checkbox"] {
  box-sizing: border-box;
  cursor: pointer;
  line-height: normal;
  margin-top: 1px 0 0;
}

input:focus,
select:focus,
textarea:focus,
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
  box-shadow: none;
  outline: none;
}

.form-errors {
  color: $color-danger;
}

// Input text

.input-text {
  border: none;
  border-bottom: 1px solid transparent;
  background-color: $color-white;
  box-shadow: none;
  outline: none;
  padding: $small $big $small $small;
  position: relative;

  @include placeholder {
    transition: all .3s ease;
  }

  &:focus {
    border-color: $color-gray-40;
    box-shadow: none;

    @include placeholder {
      opacity: 0;
      transform: translateY(-20px);
      transition: all .3s ease;
    }

  }

  &.success {
    background-color: $color-success-lighter;
    border-color: $color-success;
    color: $color-success-dark;
  }

  &.error {
    background-color: $color-danger-lighter;
    border-color: $color-danger;
    color: $color-danger-dark;
  }

}

// Element-name

input.element-name {
  background-color: $color-white;
  border: 1px solid $color-gray-40;
  border-radius: $br-small;
  color: $color-gray-60;
  font-size: $fs13;
  margin: 0px;
  padding: 3px;
  width: 100%;
}

// Input select

.input-select {
  @extend .input-text;
  background-image: url("/images/icons/arrow-down-white.svg");
  background-repeat: no-repeat;
  background-position: calc(100% - 4px) 48%;
  background-size: 10px;
  cursor: pointer;

  &.small {
    padding: $x-small $big $x-small $x-small;
  }

}


// Input radio

.input-radio,
.input-checkbox {
  align-items: center;
  color: $color-gray-40;
  display: flex;
  margin-bottom: 10px;
  margin-top: 10px;
  padding-left: 0px;

  label{
    cursor: pointer;
    display: flex;
    margin-right: 15px;
    font-size: $fs12;

    &:before{
      content:"";
      width: 20px;
      height: 20px;
      margin-right: 10px;
      background-color: $color-gray-10;
      border: 1px solid $color-gray-30;
      box-shadow: inset 0 0 0 0 $color-primary;
      box-sizing: border-box;
      flex-shrink: 0;
    }

  }

  &.column {
    align-items: flex-start;
    flex-direction: column;
  }

}

.input-radio {

  label {
    margin-bottom: 6px;

    &:before {
      border-radius: 99px;
      transition: box-shadow 0.2s linear 0s, color 0.2s linear 0s;
    }

  }

  input[type=radio]:checked {

    & + label {

      &:before {
        box-shadow: inset 0 0 0 5px $color-gray-20 ;
      }

    }

  }

  input[type=radio] {
    display: none;
  }

  input[type=radio][disabled] {

    & + label {
      opacity: 0.65;
    }

  }

}
input[type=radio]:checked + label:before{

  .input-radio.radio-success &{
    box-shadow: inset 0 0 0 5px $color-success;
  }

  .input-radio.radio-primary &{
    box-shadow: inset 0 0 0 5px $color-primary;
  }

  .input-radio.radio-info &{
    box-shadow: inset 0 0 0 5px $color-info;
  }

  .input-radio.radio-warning &{
    box-shadow: inset 0 0 0 5px $color-warning;
  }

  .input-radio.radio-danger &{
    box-shadow: inset 0 0 0 5px $color-danger;
  }

  .input-radio.radio-complete &{
    box-shadow: inset 0 0 0 5px $color-complete;
  }

}

// Input checkbox

.input-checkbox {

  input[type=radio][disabled] {

    & + label {

      &:after {
        background-color: $color-gray-10;
      }

    }

  }

  label {
    transition: border 0.2s linear 0s, color 0.2s linear 0s;
    position: relative;

    &:before {
      top: 1.4px;
      border-radius: 3px;
      transition: border 0.2s linear 0s, color 0.2s linear 0s;
    }

    &::after {
      display: inline-block;
      width: 20px;
      height: 20px;
      position: absolute;
      left: 3.2px;
      top: 0;
      font-size: $fs11;
      transition: border 0.2s linear 0s, color 0.2s linear 0s;
    }

    &:after {
      border-radius: 3px;
    }

  }

  input[type=checkbox] {
    display: none;
  }

  &.checkbox-circle {

    label {

      &:after {
        border-radius: 99px;
      }

      &:before {
        border-radius: 99px;
      }

    }

  }

  input[type=checkbox]:checked {

    & + label {

      &:before {
        border-width: 10px;
      }

      &::after {
        content:"✓";
        color: #ffffff;
        font-size: $fs16;
      }

    }

  }

  input[type=checkbox][disabled] {

    & + label {
      opacity: 0.65;

      &:before {
        background-color: #eceff3;
      }

    }

  }

  &.right {

    label {
      margin-right: 35px;
      padding-left:0 !important;

      &:before {
        right:-35px;
        left:auto;
      }

    }

    input[type=checkbox]:checked {

      & + label {
        position: relative;

        &::after {
          content:"✓";
          position: absolute;
          right: -27px;
          left: auto;
        }

      }

    }

  }

}

input[type=checkbox]:checked + label{

  .input-checkbox.check-success &:before{
    border-color: $color-success;
  }

  .input-checkbox.check-primary &:before{
    border-color: $color-primary;
  }

  .input-checkbox.check-complete &:before{
    border-color: $color-complete;
  }

  .input-checkbox.check-warning &:before{
    border-color: $color-warning;
  }

  .input-checkbox.check-danger &:before{
    border-color: $color-danger;
  }

  .input-checkbox.check-info &:before{
    border-color: $color-info;
  }

  .input-checkbox.check-success &::after,
  .input-checkbox.check-primary &::after,
  .input-checkbox.check-complete &::after,
  .input-checkbox.check-warning &::after,
  .input-checkbox.check-danger &::after,
  .input-checkbox.check-info &::after {
    color: $color-white;
  }

}

// Input slidebar

input[type=range] {
  background-color: transparent;
  -webkit-appearance: none;
  margin: 10px 0 10px 3px;
  max-width: 70px;
  width: 100%;
}
input[type=range]:focus {
  outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  animate: 0.2s;
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
  background: $color-gray-60;
  border-radius: 25px;
  border: 0px solid #000101;
}
input[type=range]::-webkit-slider-thumb {
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
  border: 0px solid #000000;
  height: 18px;
  width: 6px;
  border-radius: 7px;
  background: $color-gray-20;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -6px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
  background: $color-gray-60;
}
input[type=range]::-moz-range-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  animate: 0.2s;
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
  background: $color-gray-60;
  border-radius: 25px;
  border: 0px solid #000101;
}
input[type=range]::-moz-range-thumb {
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
  border: 0px solid #000000;
  height: 24px;
  width: 8px;
  border-radius: 7px;
  background: $color-gray-20;
  cursor: pointer;
}
input[type=range]::-ms-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  animate: 0.2s;
  background: transparent;
  border-color: transparent;
  border-width: 39px 0;
  color: transparent;
}
input[type=range]::-ms-fill-lower {
  background: $color-gray-60;
  border: 0px solid #000101;
  border-radius: 50px;
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
}
input[type=range]::-ms-fill-upper {
  background: $color-gray-60;
  border: 0px solid #000101;
  border-radius: 50px;
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
}
input[type=range]::-ms-thumb {
  box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
  border: 0px solid #000000;
  height: 24px;
  width: 8px;
  border-radius: 7px;
  background: $color-gray-20;
  cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
  background: $color-gray-60;
}
input[type=range]:focus::-ms-fill-upper {
  background: $color-gray-60;
}

// Scroll bar (chrome)

::-webkit-scrollbar {
    background-color: transparent;
    cursor: pointer;
    height: 8px;
    width: 8px;
}
::-webkit-scrollbar-track {
    background-color: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: $color-gray-20;

    &:hover {
      background-color: darken($color-gray-20, 14%);
      outline: 2px solid $color-primary;
    }

}

// Tooltip

.tooltip {
  position: relative;

  &:hover {
    &::after {
      background-color: $color-white;
      border-radius: $br-small;
      color: $color-gray-60;
      content: attr(alt);
      font-size: $fs11;
      font-weight: bold;
      padding: $x-small;
      position: absolute;
      left: 130%;
      text-align: center;
      top: 0;
      white-space: nowrap;
      z-index: 20;
      @include animation(.3s,.6s,fadeIn);
    }
  }

  &.tooltip-bottom {
    &:hover {
      &::after {
        left: -100%;
        top: 130%;
      }
    }
  }

  &.tooltip-bottom-right {
    &:hover {
      &::after {
        left: 0;
        top: 130%;
      }
    }
  }

  &.tooltip-bottom-left {
    &:hover {
      &::after {
        left: unset;
        right: 0;
        top: 130%;
      }
    }
  }

  &.tooltip-top {
    &:hover {
      &::after {
        top: -165%;
        left: -60%;
      }
    }
  }

 &.tooltip-right {
    &:hover {
      &::after {
        top: 15%;
        left: 120%;
      }
    }
  }

 &.tooltip-left {
    &:hover {
      &::after {
        left: unset;
        right: 130%;
        top: 15%;
      }
    }
  }

  &.tooltip-hover {
    &:hover {
      &::after {
        align-items: center;
        background-color: $color-white;
        box-sizing: border-box;
        border-radius: 0;
        color: $color-gray-60;
        display: flex;
        height: 100%;
        justify-content: center;
        left: 0;
        top: 0;
        white-space: normal;
        width: 100%;
      }
    }
  }
}

// Messages

.banner {
  position: relative;

  &.error {
    background-color: $color-danger;
  }

  &.success {
    background-color: $color-success;
  }

  &.warning {
    background-color: $color-warning;
  }

  &.info {
    background-color: $color-info;
  }

  &.hide {
    @include animation(0, .6s, fadeOutUp);
  }

  .icon {
    display: flex;

    svg {
      fill: $color-white;
      height: 20px;
      width: 20px;
    }
  }

  .content {
    &.bottom-actions {
      flex-direction: column;

      .actions {
        margin-top: $medium;
        display: flex;
        justify-content: flex-start;
      }
    }

    &.inline-actions {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;

      .actions {
        display: flex;
        justify-content: flex-start;

        .btn-secondary {
          margin-left: $medium;
        }
      }
    }
  }

  .btn-close {
    position: absolute;
    right: 0px;
    top: 0px;
    width: 48px;
    height: 48px;

    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: .35;

    svg {
      fill: $color-black;
      height: 18px;
      width: 18px;
      transform: rotate(45deg);
    }

    &:hover {
      opacity: .8;
    }
  }

  &.fixed {
    position: fixed;
    top: 0;
    left: 0px;
    width: 100%;
    height: 48px;
    z-index: 13;

    display: flex;
    justify-content: center;
    align-items: center;

    .wrapper {
      display: flex;
      justify-content: center;
      align-items: center;
      max-width: 60%;

      .icon {
        margin-right: $medium;
      }

      .content {
        color: $color-white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: $fs15;
      }
    }
  }

  &.floating, &.inline {
    min-height: 40px;

    .wrapper {
      display: flex;

      .icon {
        padding: $small;
        width: 48px;
        height: 48px;
        justify-content: center;
        align-items: center;
      }

      .content {
        color: $color-black;
        display: flex;
        font-size: $fs14;
        padding: $small;
        width: 100%;
        align-items: center;
      }
    }

    &.error {
      .content {
        background-color: lighten($color-danger,30%);
      }
    }

    &.success {
      .content {
        background-color: lighten($color-success,30%);
      }
    }

    &.warning {
      .content {
        background-color: lighten($color-warning,30%);
      }
    }

    &.info {
      .content {
        background-color: lighten($color-info,30%);
      }
    }
  }

  &.floating {
    box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.18);
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    width: 35rem;
    margin-left: auto;
    margin-right: auto;
    z-index: 20;

    &.error {
      border: 1px solid $color-danger;
    }

    &.success {
      border: 1px solid $color-success;
    }

    &.warning {
      border: 1px solid $color-warning;
    }

    &.info {
      border: 1px solid $color-info;
    }
  }

  &.inline {
    width: 100%;
  }
}

.close-bezier {
  fill: $color-danger;
  stroke: $color-danger-dark;
  stroke-width: 2px;
  cursor: pointer;
  &:hover {
    fill: $color-white;
  }
}

.message-inline {
  background-color: $color-info;
  color: $color-info-darker;
  margin-bottom: 1.2rem;
  padding: .8rem;
  text-align: center;
  p {
    margin: 0;
  }
  .code {
    font-family: monospace;
  }
}

[draggable] {
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  user-select: none;
  /* Required to make elements draggable in old WebKit */
  -khtml-user-drag: element;
  -webkit-user-drag: element;
}

.dnd-over > .element-list-body {
  border: 1px solid white !important;
}

.dnd-over-top {
  border-top: 1px solid white !important;
}

.dnd-over-bot {
  border-bottom: 1px solid white !important;
}