/* stylelint-disable */
:root {
  --primary-color: #e36929;
  --primary-color-dark: color-mix(in srgb, var(--primary-color), #000 30%);
  --primary-color-shadow: 0 0 0 0.1rem rgba(227, 105, 41, 0.2);
}

@import "~spectre.css/src/variables";
@import "variables";
@import "transitions";
@import "data-types";
@import "table-keys";
@import "fake-tables";
@import "editor-icons";
@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;
  background-color: #000;
}

a {
  color: var(--primary-color);

  &:hover {
    color: var(--primary-color-dark)
  }
}

::selection,
option:hover,
option:focus,
option:active,
option:checked {
  background-color: var(--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-query-results {
  overflow: auto;
  white-space: nowrap;

  .table {
    width: auto;
    border-collapse: separate;

    .th {
      position: sticky;
      top: 0;
      border: 2px solid;
      border-left: none;
      border-bottom-width: 2px;
      padding: 0;
      font-weight: 700;
      font-size: 0.7rem;
      z-index: 1;

      > div {
        padding: 0.1rem 0.2rem;
        min-width: -webkit-fill-available;
      }
    }

    .td {
      border-right: 2px solid;
      border-bottom: 2px solid;
      padding: 0 0.2rem;
      text-overflow: ellipsis;
      max-width: 200px;
      white-space: nowrap;
      overflow: hidden;
      font-size: 0.7rem;
      position: relative;

      &:focus {
        outline: none;
      }
    }
  }
}

.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;
}

.loading {
  &::after {
    border: 0.1rem solid var(--primary-color);
    border-right-color: transparent;
    border-top-color: transparent;
  }
}

/* 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: rgb(255 255 255 / 10%);
    box-shadow: 0 8px 32px 0 rgb(31 38 135 / 37%);
  }
}

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

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

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

    &.active {
      a {
        border-bottom-color: transparent;
      }

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

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

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

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

.panel {
  border: none;
}

.tooltip:hover {
  &::after {
    opacity: 1;
  }
}

.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;
  }
}

.has-icon-left svg.form-icon,
.has-icon-right svg.form-icon {
  width: auto;
  height: auto;
}

.form-checkbox input:checked + .form-icon, .form-radio input:checked + .form-icon, .form-switch input:checked + .form-icon {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.form-checkbox input:focus + .form-icon, .form-radio input:focus + .form-icon, .form-switch input:focus + .form-icon {
  box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
  border-color: var(--primary-color);
}

.form-select {
  cursor: pointer;

  &:focus {
    box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
  }

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

  &.select {
    &.select--open {
      border-color: var(--primary-color) !important;
      box-shadow: 0 0 0 0.1rem var(--primary-color-shadow) !important;

      @include control-shadow();
    }
  }
}

.select__list {
  margin: 0;

  li {
    margin: 0;
    padding: 0.3rem 0.8rem;

    .select-sm &,
    .small-select & {
      padding: 0.05rem 0.3rem;
    }
  }
}

.select__list-wrapper {
  z-index: 401 !important;
  border: 1px solid transparent;
  border-radius: $border-radius;
  box-shadow:
    0 8px 17px 0 rgb(0 0 0 / 20%),
    0 6px 20px 0 rgb(0 0 0 / 19%);
}

.select__option--selected {
  background: rgba(var(--primary-color), 0.25);
}

.select__option--highlight {
  background: var(--primary-color);
  text-shadow: 0 0 15px #000;
}

.form-input {
  &[type="file"] {
    overflow: hidden;
  }
  &:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
  }
}

.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 {
  color: var(--primary-color);
  border-color: var(--primary-color);

  &:not(.btn-link) {
    text-shadow: 0 0 15px #000;
  }

  &:hover {
    border-color: var(--primary-color-dark);
  }

  &:focus {
    box-shadow: 0 0 3px 1px rgba(var(--primary-color), 90%);
  }

  &.btn-success:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 3px 1px rgba(var(--primary-color), 90%);
  }

  &.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color-dark);

    &:hover {
      background: var(--primary-color-dark);
      border-color: var(--primary-color-dark);
    }
  }
}

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

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

.divider {
  margin: 0.15rem 0.3rem;
}

.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;
      }
    }
  }
}

/* sql-highlight */
code.sql {
  font-family: monospace;
}

.sql-hl-keyword {
  color: var(--primary-color);
}

.sql-hl-function {
  color: darkorchid;
}

.sql-hl-number {
  color: $number-color;
}

.sql-hl-string {
  color: $string-color;
}

.sql-hl-special {
  color: goldenrod;
}

.sql-hl-bracket {
  color: darkorchid;
}
