
// Variables
@import 'admin-variables';

// Bootstrap
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-select/sass/bootstrap-select';

// jQuery
@import '~jquery-datetimepicker/build/jquery.datetimepicker.min';

// Other
@import 'global/dropzone';

$base-path: '/' !default;
$box-bg: $gray-300 !default;
$box-border: $gray-400 !default;

html { height: 100%; }

body {
  min-height: 100%;
  min-width: 320px;
  width: 100%;
}

body,
body > .vue-root,
body > .vue-root > [id$="-page"] {
  display: flex;
  flex-direction: column;
  flex: auto;
}

svg {
  width: 20px;
  height: 20px;
}

section {
  position: relative;
}

.navbar {
  &.navbar-dark {
    background-color: $black;
  }

  .navbar-brand {
    svg {
      width: 135px;
      height: 50px;
      max-height: 50px;
      vertical-align: middle;
    }
  }

  .exit {
    svg {
      fill: $bar-color;
      padding-right: 10px;
      width: 25px;
    }
  }
}

.footer {
  background-color: $black;
  color: $bar-color;

  svg {
    fill: $bar-color;
    width: 80px;
    height: 35px;
    max-height: 45px;
    vertical-align: middle;
  }
}

.bg-gradient {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  right: 0;
  top: 0;
  background: rgb(209,6,84);
  background: linear-gradient(to right, rgba(209,6,84,1) 0%,rgba(117,24,101,1) 100%);
  z-index: -1;

  &:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url($base-path + 'img/global/bg_pattern.png');
  }
}

.flex {
  &-center {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.bg-box {
  background-color: $box-bg;

  &-darker {
    background-color: $box-bg-darker;
  }

  &-lighter {
    background-color: $box-bg-lighter;
  }
}

.border-box {
  border: 1px solid $box-border;
}

.no-padding {
  &.container,
  &.container-fluid {
    padding-right: 0;
    padding-left: 0;
  }
}

.bootstrap-select {
  > .dropdown-toggle {
    &.bs-placeholder {
      &.btn-secondary {
        //color: $secondary;
      }
    }
  }
}

.tooltip {
  display: block !important;
  z-index: 10000;

  .tooltip-inner {
    background: $white;
    color: $black;
    border: $border-width solid $border-color;
    border-radius: $tooltip-border-radius;
    padding: 5px 10px 4px;
  }

  .tooltip-arrow {
    width: 0;
    height: 0;
    border-style: solid;
    position: absolute;
    margin: 5px;
    border-color: white;
    z-index: 1;
  }

  &[x-placement^="top"] {
    margin-bottom: 5px;

    .tooltip-arrow {
      border-width: 5px 5px 0 5px;
      border-left-color: transparent !important;
      border-right-color: transparent !important;
      border-bottom-color: transparent !important;
      bottom: -5px;
      left: calc(50% - 5px);
      margin-top: 0;
      margin-bottom: 0;
    }
  }

  &[x-placement^="bottom"] {
    margin-top: 5px;

    .tooltip-arrow {
      border-width: 0 5px 5px 5px;
      border-left-color: transparent !important;
      border-right-color: transparent !important;
      border-top-color: transparent !important;
      top: -5px;
      left: calc(50% - 5px);
      margin-top: 0;
      margin-bottom: 0;
    }
  }

  &[x-placement^="right"] {
    margin-left: 5px;

    .tooltip-arrow {
      border-width: 5px 5px 5px 0;
      border-left-color: transparent !important;
      border-top-color: transparent !important;
      border-bottom-color: transparent !important;
      left: -5px;
      top: calc(50% - 5px);
      margin-left: 0;
      margin-right: 0;
    }
  }

  &[x-placement^="left"] {
    margin-right: 5px;

    .tooltip-arrow {
      border-width: 5px 0 5px 5px;
      border-top-color: transparent !important;
      border-right-color: transparent !important;
      border-bottom-color: transparent !important;
      right: -5px;
      top: calc(50% - 5px);
      margin-left: 0;
      margin-right: 0;
    }
  }

  &.popover {
    $color: #f9f9f9;

    .popover-inner {
      background: $white;
      color: $body-color;
      padding: 24px;
      border-radius: 5px;
      box-shadow: 0 5px 30px rgba(black, .1);
    }

    .popover-arrow {
      border-color: $color;
    }
  }

  &[aria-hidden='true'] {
    visibility: hidden;
    opacity: 0;
    transition: opacity .15s, visibility .15s;
  }

  &[aria-hidden='false'] {
    visibility: visible;
    opacity: 1;
    transition: opacity .15s;
  }

  &.image-tooltip {
    .tooltip-inner {
      overflow: hidden;
      max-width: none;
      padding: 0;
    }
  }
}

textarea {
  resize: vertical;
  &.no-resize { resize: none; }
  &.resize { resize: both; }
  &.resize-x { resize: horizontal; }
  &.resize-y { resize: vertical; }

  &.form-control {
    height: calc(6em + .75rem + 2px);
    font-size: .875em;
  }
}

.input-height {
  height: $input-height;
}

.input-height-square {
  height: $input-height;
  width: $input-height;
}

#tpl { display: none; }

.loading-fixed {
  position: fixed;
  left: 0;
  bottom: 10vh;
  display: flex;
  align-items: flex-end;
  box-shadow: 0 0 5px rgba(#000,.2);
  background: $box-bg;
  border-color: $box-border;
  border-width: 1px 1px 1px 0;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  border-style: solid;

  .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 50px;
    height: 50px;

    svg {
      width: 35px;
      height: 35px;
    }
  }
}

.alerts-root {
  position: fixed;
  top: 10px;
  right: 10px;
  max-width: 300px;
}

.alerts {
  display: flex;
  flex-direction: column;

  .alert {
    margin-bottom: 0;

    & + .alert {
      margin-top: .5rem;
    }
  }
}

.list-config {
  margin-top: $form-check-input-margin-y;
  margin-bottom: $form-check-input-margin-y;
}

.config-modal {
  .modal-header {
    align-items: center;
  }

  .list-config {
    margin-top: $nav-divider-margin-y;
    margin-bottom: $nav-divider-margin-y;
  }

  .config-remove {
    cursor: pointer;
    color: $danger;
  }

  .type-btn {
    margin-right: .5rem;
  }

  .add-many {
    display: flex;
    align-items: center;

    &__buttons {
      display: flex;
      margin-left: 5px;
      align-items: center;
    }

    &__button {
      width: 25px;
      height: 25px;
      margin: 0 3px;
      display: flex;
      line-height: 1;
      color: $primary;
      cursor: pointer;
      user-select: none;
      border-radius: 50%;
      align-items: center;
      justify-content: center;
      transition: all .15s ease;
      border: 1px solid $primary;

      &:hover {
        color: $white;
        background-color: $primary;
      }

      &:active {
        transform: scale(1.1);
      }
    }
  }

  .img-config {
    .preview-img {
      max-width: 100%;
    }
  }
}

.row-config {
  padding-top: $nav-divider-margin-y;
  padding-bottom: $form-check-input-margin-y;
  position: relative;

  .config-name {
    margin-bottom: .2rem;
  }
}

.row-input {
  margin-bottom: $form-group-margin-bottom;

  .form-group {
    margin-bottom: 0;
  }
}

.row-heading {
  font-size: 1.2em;
  padding-left: 0;
  padding-right: 15px;
  flex: 0 0 100%;
  max-width: 100%;

  @include media-breakpoint-up(md) {
    flex: 0 0 10%;
    max-width: 10%;
  }
}

$icon-btn-map: (
  "trash": $danger,
);

.icon-btn {
  cursor: pointer;

  @each $class, $color in $icon-btn-map {
    .type-#{$class} {
      fill: $color;
      path {
        fill: $color;
      }
    }
  }

  &.type-plus-minus,
  &.type-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 16px;
    height: 16px;
  }

  &.type-plus-minus {
    .h, .v {
      content: '';
      position: absolute;
      height: 12.5%;
      width: 100%;
      top: 50%;
      left: 50%;
      transition: transform .3s $cubic;
      transform: translate(-50%, -50%);
    }

    &:not(.active) {
      .h {
        transform: translate(-50%, -50%) rotate(-90deg);
      }

      &:hover .h {
        transform: translate(-50%, -50%) rotate(90deg);
      }
    }
  }

  &.type-arrow {
    svg {
      transition: transform .15s $cubic;
    }

    &:not(.active) {
      svg {
        transform: rotate(90deg);
      }
    }
  }
}

.cursor {
  &-grab {
    cursor: grab;
  }
  &-pointer {
    cursor: pointer;
  }
}
