/*
 * MIT License
 *
 * Copyright (c) 2020-present Cloudogu GmbH and Contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

@import "utils/_pre.scss";

/* Base */
$red: #e63453;

$light-gray: #f2f2f2;

$primary-invert: #050514;
$link-invert: #050514;
$info-invert: #050514;
$success-invert: #050514;
$danger-invert: #050514;

$scheme-main: #050514;
$background: $grey-dark;

$border: $white-ter;
$border-width: 2px;

$text: $white-ter;
$text-strong: $white-bis;

$code: lighten($red, 25%);

$link-hover: $white-bis;
$link-focus: $white-ter;

$hr-background-color: $white-bis;

$secondary-least: $scheme-main;
$secondary-less: $black-ter;
$secondary: $white-bis;
$secondary-more: $white-ter;
$secondary-most: $white;

/* Layout */
$footer-background-color: $black-ter;
$footer-color: $white-ter;

/* Elements */
$box-background-color: $grey-darker;

$table-row-hover-background-color: $grey-darker;

/* Components */
$menu-label-color: $scheme-main;
$menu-item-color: $white-ter;

$modal-card-head-background-color: $black-ter;
$modal-card-body-background-color: $scheme-main;

$panel-heading-background-color: $black-ter;

/* Form */
$input-placeholder-color: $white;
$input-disabled-color: $white-bis;

/* Extensions */
$popover-background-color: $grey-dark;

$tooltip-background-color: $white-bis;
$tooltip-background-opacity: 0.9 !default;
$tooltip-color: $scheme-main;

@import "utils/_post.scss";

:root {
  --scm-secondary-background: #{$scheme-main};
  --scm-secondary-text: #{$white};
  --scm-hover-color: #{$grey};
  --scm-column-selection: #{$link-dark};
  --scm-sh-focus-line-background: hsl(0, 0%, 10%);
  --scm-sh-focus-line-contrast: hsl(0, 0%, 60%);

  --sh-base-color: #fff;
  --sh-font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  --sh-block-background: #{$scheme-main};
  --sh-inline-code-color: #ff3860;
  --sh-inline-code-background: #fbe7eb;
  --sh-comment-color: #9a9a9a;
  --sh-punctuation-color: #999999;
  --sh-property-color: #2c99c7;
  --sh-selector-color: #009dff;
  --sh-operator-color: #999999;
  --sh-operator-bg: inherit;
  --sh-variable-color: #c386ca;
  --sh-function-color: #ff6181;
  --sh-keyword-color: #00a984;
  --sh-selected-color: #{$warning-dark};
  --sh-highlight-background: #f5f5f5;
  --sh-highlight-accent: #99d8f3;

  --diff-background-color: #{$scheme-main};
  --diff-text-color: #{$white-bis};
  --diff-font-family: Consolas, Courier, monospace;
  --diff-selection-background-color: #b3d7ff;
  --diff-gutter-insert-background-color: #05c71d;
  --diff-gutter-delete-background-color: #eb7a85;
  --diff-gutter-selected-background-color: #fffce0;
  --diff-code-insert-background-color: #05240b;
  --diff-code-delete-background-color: #230608;
  --diff-code-insert-edit-background-color: #c0dc91;
  --diff-code-delete-edit-background-color: #000;
  --diff-code-selected-background-color: #fffce0;
  --diff-omit-gutter-line-color: #cb2a1d;
}

.button {
  &.is-primary:hover,
  &.is-primary.is-hovered {
    background-color: scale-color($primary, $lightness: -5%);
  }

  &.is-primary:active,
  &.is-primary.is-active {
    background-color: scale-color($primary, $lightness: -10%);
  }

  &.is-primary[disabled] {
    background-color: scale-color($primary, $lightness: -50%);
  }

  &.is-info:hover,
  &.is-info.is-hovered {
    background-color: scale-color($info, $lightness: -5%);
  }

  &.is-info:active,
  &.is-info.is-active {
    background-color: scale-color($info, $lightness: -10%);
  }

  &.is-info[disabled] {
    background-color: scale-color($info, $lightness: -50%);
  }

  &.is-link:hover,
  &.is-link.is-hovered {
    background-color: scale-color($link, $lightness: -5%);
  }

  &.is-link:active,
  &.is-link.is-active {
    background-color: scale-color($link, $lightness: -10%);
  }

  &.is-link[disabled] {
    background-color: scale-color($link, $lightness: -50%);
  }

  &.is-success:hover,
  &.is-success.is-hovered {
    background-color: scale-color($success, $lightness: -5%);
  }

  &.is-success:active,
  &.is-success.is-active {
    background-color: scale-color($success, $lightness: -10%);
  }

  &.is-success[disabled] {
    background-color: scale-color($success, $lightness: -50%);
  }

  &.is-warning:hover,
  &.is-warning.is-hovered {
    background-color: scale-color($warning, $lightness: -5%);
  }

  &.is-warning:active,
  &.is-warning.is-active {
    background-color: scale-color($warning, $lightness: -10%);
  }

  &.is-warning[disabled] {
    background-color: scale-color($warning, $lightness: -50%);
    color: #e1d4c2;
  }

  &.is-danger:hover,
  &.is-danger.is-hovered {
    background-color: scale-color($danger, $lightness: -5%);
  }

  &.is-danger:active,
  &.is-danger.is-active {
    background-color: scale-color($danger, $lightness: -10%);
  }

  &.is-danger[disabled] {
    background-color: scale-color($danger, $lightness: -50%);
  }
}

//footer is overwritten in _main.scss
footer.footer {
  a {
    color: scale-color($link, $lightness: 25%);
  }
}

.card {
  border: 1px solid $border;
  box-shadow: none;
}

//card
.modal-card {
  border: 1px solid $border;

  & .modal-close,
  & .delete {
    background-color: $white-ter;
  }
}

//card tables
.card-table {
  tr {
    a {
      color: $white-bis;
    }

    &:hover {
      td {
        background-color: $grey-darker;

        &.is-darker {
          background-color: $grey-darker;
        }
      }
    }
  }
  td {
    background-color: $grey-dark;
    border-bottom: 1px solid $grey;

    &:first-child {
      border-left-width: 9px;
    }
    &.is-darker {
      background-color: $grey-dark;
    }
  }
  &.is-hoverable tbody tr:not(.is-selected):hover {
    background-color: $grey-darker;
  }
}

.panel {
  border-color: $white-bis;
}

//diffs
.diff-code-conflict {
  background-color: #332900;
}

.diff-gutter-conflict {
  background-color: #ffd11a;
}

.diff-gutter-delete,
.diff-gutter-insert,
.diff-gutter-conflict {
  color: $scheme-main;
}

/* transport meaning with more than color */
td:nth-child(2).diff-gutter-delete:before {
  content: "-";
}

td:first-child.diff-gutter-insert:before {
  content: "+";
}

td:first-child.diff-gutter-conflict:before {
  content: "!";
}

.diff-split td:nth-child(3).diff-gutter-insert:before {
  content: "+";
}

.diff-split td:first-child.diff-gutter-delete:before {
  content: "-";
}

.diff-split td:nth-child(3).diff-gutter-conflict:before {
  content: "!";
}

.diff-decoration-content div {
  color: $scheme-main;
}

//inline member tags
.tag:not(body) {
  &.is-delete {
    &::before,
    &::after {
      background-color: $scheme-main;
    }

    &:hover::before,
    &:hover::after {
      background-color: $white-bis;
    }
  }

  //dark tags have light borders to separate from background
  &.is-dark,
  &.is-black {
    border: 1px solid $white-bis;
  }

  //blue text in light tags
  &.is-light .has-text-link {
    color: scale-color($link, $lightness: -50%) !important;
  }
}

//cards receive white border
.box-link-shadow {
  box-shadow: 0 0 0 1px $white-bis;
}

//Display darker version of background image
.has-scm-background {
  background-image: url(images/scmManagerHeroDark.jpg) !important;
}

.has-background-light {
  color: $grey-dark;
}

.has-hover-visible:hover {
  color: $white-bis !important;
}

.repository-export-info-box {
  background-color: scale-color($info, $lightness: -75%);
  border: 0.2rem solid;
}

.search-syntax-accordion {
  border: 1px solid $info;
  box-shadow: none;
}
