@import "~spectre.css/src/variables";
@import "variables";
@import "transitions";
@import "data-types";
@import "table-keys";
@import "fake-tables";
@import "mdi-additions";
@import "db-icons";
@import "themes/dark-theme";
@import "themes/light-theme";
@import "~spectre.css/src/spectre";
@import "~spectre.css/src/spectre-exp";

body {
  user-select: none;
}

::selection,
option:hover,
option:focus,
option:active,
option:checked {
  background-color: $primary-color;
  color: $light-color;
}

/* Additions */
@include margin-variant(3, $unit-3);
@include margin-variant(4, $unit-4);
@include padding-variant(3, $unit-3);
@include padding-variant(4, $unit-4);

.p-vcentered {
  display: flex !important;
  align-items: center;
}

.c-help {
  cursor: help;
}

.no-outline {
  outline: none !important;
}

.no-radius {
  border-radius: 0 !important;
}

.no-border {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.cut-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cancellable {
  color: transparent !important;
  min-height: 0.8rem;
  position: relative;

  > .mdi,
  > .span {
    visibility: hidden;
  }

  &::after {
    content: "\2715";
    color: $light-color;
    font-weight: 700;
    top: 36%;
    display: block;
    height: 0.8rem;
    left: 50%;
    margin-left: -0.4rem;
    margin-top: -0.4rem;
    opacity: 1;
    padding: 0;
    position: absolute;
    width: 0.8rem;
    z-index: 1;
  }
}

.workspace-tabs {
  align-content: baseline;

  .workspace-query-runner {
    .workspace-query-runner-footer {
      display: flex;
      justify-content: space-between;
      padding: 0.3rem 0.6rem 0.4rem;
      align-items: center;

      .workspace-query-buttons {
        display: flex;

        .btn {
          display: flex;
          align-self: center;
          margin-right: 0.4rem;
        }
      }

      .workspace-query-info {
        display: flex;
        overflow: hidden;
        white-space: nowrap;

        > div + div {
          padding-left: 0.6rem;
        }
      }
    }
  }
}

.process-row .td:last-child {
  width: 100%;
}

// Scrollbars
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

// Animations
@keyframes rotation {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(359deg);
  }
}

.rotate {
  animation: rotation 0.8s infinite linear;
}

/* Override */
.modal {
  .modal-container,
  .modal-sm .modal-container {
    padding: 0;
    border-radius: $border-radius;

    .modal-header {
      padding: 0.4rem 0.8rem;
      text-transform: uppercase;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-radius: $border-radius $border-radius 0 0;

      .modal-title {
        overflow: hidden;
      }
    }
  }
  
  .modal-overlay{
    background: rgba( 255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 );
  }
}

#wrapper:not(.no-blur){
  .modal-overlay{
    backdrop-filter: blur( 4px );
    -webkit-backdrop-filter: blur( 4px );
  }
}

.tab {
  .tab-item {
    position: relative;
    display: flex;
    justify-content: center;

    .tab-link {
      min-width: 0;
      transition: color 0.2s;
    }

    &.active {
      .tab-link {
        border-color: transparent;
      }

      &::after {
        width: 100%;
      }
    }

    &::after {
      content: "";
      height: 2px;
      width: 0;
      transition: width 0.2s;
      background-color: $primary-color;
      position: absolute;
      bottom: 0;
    }

    .btn-clear {
      margin-top: -0.1rem;
      font-size: 0.6rem;
    }
  }
}

.panel {
  border: none;
}

.badge {
  &[data-badge],
  &:not([data-badge]) {
    &::after {
      box-shadow: none;
    }
  }

  &.badge-connected::after {
    background: $success-color;
  }

  &.badge-connecting::after {
    background: $warning-color;
    animation-name: pulse;
    animation-duration: 2s;
    animation-iteration-count: infinite;
  }

  &.badge-failed::after {
    background: $error-color;
  }
}

.form-select {
  cursor: pointer;

  &.small-select {
    height: 21px;
    font-size: 0.7rem;
    padding: 1px 0.4rem 0;
  }
}

.form-input[type="file"] {
  overflow: hidden;
}

.input-group .input-group-addon {
  z-index: 1;
}

.menu {
  font-size: 0.7rem;

  .menu-item {
    + .menu-item {
      margin-top: 0;
    }
  }
}

.accordion-body {
  max-height: 5000rem !important;
}

.btn-group {
  flex-wrap: nowrap;
}

.btn.loading {
  > .mdi,
  > span {
    visibility: hidden;
  }
}

.table-dropdown {
  .menu {
    min-width: 100%;
    padding: 0;

    .menu-item {
      padding: 0;

      > a {
        margin: 0.2rem;
        padding: 0.1rem 0.3rem;

        &:hover {
          color: inherit;
        }
      }
    }
  }
}

// Ace Editor
.ace_editor {
  &.ace_autocomplete {
    border-radius: $border-radius;

    .ace_marker-layer {
      .ace_active-line,
      .ace_line-hover {
        border-radius: $border-radius;
      }
    }
  }
}
