// 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) KALEIDOS INC

// SCROLLBAR
.new-scrollbar {
  ::-webkit-scrollbar {
    background-color: transparent;
    cursor: pointer;
    height: $s-12;
    width: $s-12;
  }
  ::-webkit-scrollbar-track,
  ::-webkit-scrollbar-corner {
    background-color: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background-color: rgba(170, 181, 186, 0.3);
    background-clip: content-box;
    border: $s-2 solid transparent;
    border-radius: $br-8;
    &:hover {
      background-color: rgba(170, 181, 186, 0.7);
      outline: none;
    }
  }

  ::selection {
    background-color: var(--color-accent-primary-muted);
  }
}

// BUTTONS
.button-primary {
  @include buttonStyle;
  @include flexCenter;
  @include focusPrimary;
  background-color: var(--button-primary-background-color-rest);
  border: $s-1 solid var(--button-primary-border-color-rest);
  color: var(--button-primary-foreground-color-rest);
  border-radius: $br-8;
  svg,
  span svg {
    stroke: var(--button-primary-foreground-color-rest);
  }
  &:hover {
    background-color: var(--button-primary-background-color-hover);
    border: $s-1 solid var(--button-primary-border-color-hover);
    color: var(--button-primary-foreground-color-hover);
    svg,
    span svg {
      stroke: var(--button-primary-foreground-color-hover);
    }
  }
  &:active {
    background-color: var(--button-primary-background-color-active);
    border: $s-1 solid var(--button-primary-border-color-active);
    color: var(--button-primary-foreground-color-active);
    outline: none;
    svg,
    span svg {
      stroke: var(--button-primary-foreground-color-active);
    }
  }
  &:global(.disabled),
  &[disabled],
  &:disabled {
    background-color: var(--button-background-color-disabled);
    border: $s-1 solid var(--button-border-color-disabled);
    color: var(--button-foreground-color-disabled);
    cursor: unset;
  }
}

.button-secondary {
  @include buttonStyle;
  @include flexCenter;
  @include focusSecondary;
  border-radius: $br-8;
  background-color: var(--button-secondary-background-color-rest);
  border: $s-1 solid var(--button-secondary-border-color-rest);
  color: var(--button-secondary-foreground-color-rest);
  svg,
  span svg {
    stroke: var(--button-secondary-foreground-color-rest);
  }
  &:hover {
    background-color: var(--button-secondary-background-color-hover);
    border: $s-1 solid var(--button-secondary-border-color-hover);
    color: var(--button-secondary-foreground-color-hover);
    text-decoration: none;
    svg,
    span svg {
      stroke: var(--button-secondary-foreground-color-hover);
    }
  }
  &:active {
    outline: none;
    background-color: var(--button-secondary-background-color-active);
    border: $s-1 solid var(--button-secondary-border-color-active);
    color: var(--button-secondary-foreground-color-active);
    svg,
    span svg {
      stroke: var(--button-secondary-foreground-color-active);
    }
  }
  &:global(.disabled),
  &[disabled],
  &:disabled {
    background-color: var(--button-background-color-disabled);
    border: $s-1 solid var(--button-border-color-disabled);
    color: var(--button-foreground-color-disabled);
    cursor: unset;
  }
}

.button-tertiary {
  @include buttonStyle;
  @include flexCenter;
  @include focusTertiary;
  border-radius: $br-8;
  color: var(--button-tertiary-foreground-color-rest);
  background-color: transparent;
  border: $s-1 solid transparent;
  svg,
  span svg {
    stroke: var(--button-tertiary-foreground-color-rest);
  }
  &:hover {
    background-color: var(--button-tertiary-background-color-hover);
    color: var(--button-tertiary-foreground-color-hover);
    border: $s-1 solid var(--button-secondary-border-color-hover);
    svg,
    span svg {
      stroke: var(--button-tertiary-foreground-color-hover);
    }
  }
  &:active {
    outline: none;
    border: $s-1 solid transparent;
    background-color: var(--button-tertiary-background-color-active);
    color: var(--button-tertiary-foreground-color-active);
    svg,
    span svg {
      stroke: var(--button-tertiary-foreground-color-active);
    }
  }
  &:global(.disabled),
  &[disabled],
  &:disabled {
    color: var(--button-foreground-color-disabled);
    cursor: unset;
    pointer-events: none;

    svg,
    span svg {
      stroke: var(--button-background-color-disabled);
    }
  }
}

.button-icon-selected {
  outline: none;
  border: $s-1 solid transparent;
  background-color: var(--button-tertiary-background-color-hover);
  color: var(--button-tertiary-foreground-color-active);
  svg {
    stroke: var(--button-tertiary-foreground-color-active);
  }
}

.button-radio {
  @include buttonStyle;
  @include flexCenter;
  @include focusRadio;
  border-radius: $br-8;
  color: var(--button-radio-foreground-color-rest);
  border: $s-1 solid var(--button-radio-background-color-rest);
  svg,
  span svg {
    stroke: var(--button-radio-foreground-color-rest);
  }
  &:hover {
    background-color: var(--button-radio-background-color-rest);
    color: var(--button-radio-foreground-color-hover);
    border: $s-1 solid transparent;
    svg,
    span svg {
      stroke: var(--button-radio-foreground-color-hover);
    }
  }
  &:active {
    outline: none;
    border: $s-1 solid transparent;
    background-color: var(--button-radio-background-color-active);
    color: var(--button-radio-foreground-color-active);
    svg,
    span svg {
      stroke: var(--button-radio-foreground-color-active);
    }
  }
}

.button-warning {
  @include buttonStyle;
  @include flexCenter;
  background-color: var(--button-warning-background-color-rest);
  border: $s-1 solid var(--button-warning-border-color-rest);
  color: var(--button-warning-foreground-color-rest);
}

.button-disabled {
  @include buttonStyle;
  @include flexCenter;
  background-color: var(--button-background-color-disabled);
  border: $s-1 solid var(--button-border-color-disabled);
  color: var(--button-foreground-color-disabled);
  cursor: unset;
}

.button-tag {
  @include buttonStyle;
  @include flexCenter;
  @include focus;
  &:hover {
    svg {
      stroke: var(--title-foreground-color-hover);
    }
  }
  &:active {
    border: none;
    background-color: transparent;
  }
}

.button-icon {
  @include flexCenter;
  height: $s-16;
  width: $s-16;
  color: transparent;
  fill: none;
  stroke-width: 1px;
}

.button-icon-small {
  @extend .button-icon;
  height: $s-12;
  width: $s-12;
  stroke-width: 1.33px;
}

.button-constraint {
  @include buttonStyle;
  width: $s-32;
  height: $s-4;
  border-radius: $br-8;
  background-color: var(--button-constraint-background-color-rest);
  padding: 0;
  margin: 0;
  &:hover {
    outline: $s-4 solid var(--button-constraint-border-color-hover);
    background-color: var(--button-constraint-background-color-hover);
  }
}

// INPUTS
.input-base {
  @include removeInputStyle;
  @include titleTipography;
  @include textEllipsis;
  // @include focusInput;
  height: $s-28;
  width: 100%;
  flex-grow: 1;
  margin: $s-2 0;
  padding: 0 0 0 $s-6;
  border-radius: $br-8;
  color: var(--input-foreground-color-active);
  &[disabled] {
    opacity: 0.5;
    pointer-events: none;
  }
}

.input-icon {
  @include flexCenter;
  min-width: $s-12;
  height: $s-32;
  svg {
    @extend .button-icon-small;
  }
}

.input-label {
  @include tabTitleTipography;
  @include flexCenter;
  width: $s-20;
  padding-left: $s-8;
  height: $s-32;
  color: var(--input-foreground-color);
}

.input-element {
  @include titleTipography;
  @include focusInput;
  display: flex;
  align-items: center;
  height: $s-32;
  border-radius: $br-8;
  background-color: var(--input-background-color);
  border: $s-1 solid var(--input-background-color);
  color: var(--input-foreground-color);
  span,
  label {
    @extend .input-label;
    svg {
      @extend .button-icon-small;
      stroke: var(--input-foreground-color);
    }
  }

  input {
    @extend .input-base;
  }

  ::placeholder {
    color: var(--input-placeholder-color);
  }

  &:hover {
    border: $s-1 solid var(--input-background-color-hover);
    span {
      color: var(--input-foreground-color);
    }
    input {
      color: var(--input-foreground-color-active);
    }
    background-color: var(--input-background-color-hover);
  }
}

.input-element-label {
  @include titleTipography;
  display: flex;
  align-items: flex-start;
  padding: 0;
  input {
    @extend .input-base;
    padding-left: $s-8;
    display: flex;
    align-items: flex-start;
    height: $s-32;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    border-radius: $br-8;
    border: $s-1 solid var(--input-background-color);
    color: var(--input-foreground-color-active);
    background-color: var(--input-background-color);
  }
  ::placeholder {
    color: var(--input-placeholder-color);
  }
  &:hover {
    input {
      color: var(--input-foreground-color-active);
      background-color: var(--input-background-color-hover);
    }
  }

  &:focus-within,
  &:active {
    input {
      color: var(--input-foreground-color-active);
      background-color: var(--input-background-color-active);
      border: $s-1 solid var(--input-border-color-active);
    }
  }
}

.disabled-input {
  background-color: var(--input-background-color-disabled);
  border: $s-1 solid var(--input-border-color-disabled);
  color: var(--input-foreground-color-disabled);
  input {
    pointer-events: none;
    cursor: default;
    color: var(--input-foreground-color-disabled);
  }
  span svg {
    stroke: var(--input-foreground-color-disabled);
  }
}

.checkbox-icon {
  @include flexCenter;
  width: $s-16;
  height: $s-16;
  min-width: $s-16;
  min-height: $s-16;
  border-radius: $br-6;

  background-color: var(--input-checkbox-inactive-background-color);
  border-radius: $br-4;
  box-shadow: inset 0 0 0px 2px rgb(255 255 255 / 20%);
  svg {
    display: none;
    stroke: var(--input-checkbox-inactive-foreground-color);
  }
  &:hover {
    border-color: var(--input-checkbox-border-color-hover);
  }
  &:focus {
    border-color: var(--input-checkbox-border-color-focus);
  }
  &:global(.checked) {
    border-color: var(--input-checkbox-border-color-active);
    background-color: var(--input-checkbox-active-background-color);
    svg {
      @extend .button-icon-small;
      stroke: var(--input-checkbox-active-foreground-color);
    }
  }
  &:global(.intermediate) {
    background-color: var(--input-checkbox-background-color-intermediate);
    border-color: var(--input-checkbox-border-color-active);
    svg {
      @extend .button-icon-small;
      stroke: var(--input-details-color);
    }
  }
  &:global(.unchecked) {
    background-color: var(--input-checkbox-background-color-rest);
    border: $s-1 solid var(--input-checkbox-background-color-rest);
    svg {
      display: none;
    }
  }
}

.input-checkbox {
  display: flex;
  align-items: center;
  label {
    @include titleTipography;
    display: flex;
    align-items: center;
    gap: $s-6;
    cursor: pointer;
    span {
      @extend .checkbox-icon;
    }
    input {
      margin: 0;
    }
    &:hover {
      span {
        border-color: var(--input-checkbox-border-color-hover);
      }
    }
  }
}

.input-with-label {
  display: flex;
  flex-direction: column;
  label {
    @include titleTipography;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: $s-16;
    color: var(--input-foreground-color-active);
  }

  input {
    @extend .input-base;
    @include titleTipography;
    border-radius: $br-8;
    height: $s-32;
    min-height: $s-32;
    margin-top: $s-8;
    background-color: var(--input-background-color);
    border: $s-1 solid var(--input-background-color);
    color: var(--input-foreground-color-active);
    &:focus-within,
    &:active {
      input {
        color: var(--input-foreground-color-active);
      }
      background-color: var(--input-background-color-active);
      border: $s-1 solid var(--input-border-color-active);
    }
  }
  &:global(.disabled) {
    @extend .disabled-input;
  }

  &:global(.invalid) {
    input {
      border: $s-1 solid var(--input-border-color-error);
    }
  }
}

//MODALS
.modal-background {
  @include menuShadow;
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: $s-12;
  border-radius: $br-8;
  z-index: $z-index-10;
  color: var(--color-foreground-primary);
  background-color: var(--modal-background-color);
}

.modal-overlay-base {
  @include flexCenter;
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  z-index: $z-index-modal;
  background-color: var(--color-background-subtle);
}

.modal-container-base {
  position: relative;
  padding: $s-32;
  border-radius: $br-8;
  background-color: var(--modal-background-color);
  min-width: $s-364;
  min-height: $s-192;
  max-width: $s-512;
  max-height: $s-512;
}

.modal-close-btn-base {
  @extend .button-tertiary;
  position: absolute;
  top: $s-8;
  right: $s-6;
  height: $s-32;
  width: $s-28;
  svg {
    @extend .button-icon;
  }
}

.modal-hint-base {
  @include titleTipography;
  color: var(--modal-title-foreground-color);
  border-top: $s-1 solid var(--modal-hint-border-color);
  border-bottom: $s-1 solid var(--modal-hint-border-color);
}

.modal-action-btns {
  display: flex;
  justify-content: flex-end;
  gap: $s-16;
}

.modal-cancel-btn {
  @extend .button-secondary;
  @include tabTitleTipography;
  padding: $s-8 $s-24;
  border-radius: $br-8;
  height: $s-32;
  margin: 0;
}

.modal-accept-btn {
  @extend .button-primary;
  @include tabTitleTipography;
  padding: $s-8 $s-24;
  border-radius: $br-8;
  height: $s-32;
  margin: 0;
}

.modal-danger-btn {
  @extend .button-primary;
  @include tabTitleTipography;
  padding: $s-8 $s-24;
  border-radius: $br-8;
  height: $s-32;
  margin: 0;
  background-color: var(--modal-button-background-color-error);
  border: $s-1 solid var(--modal-button-background-color-error);
  color: var(--modal-button-foreground-color-error);
}

// UI ELEMENTS
.asset-element {
  @include titleTipography;
  display: flex;
  align-items: center;
  height: $s-32;
  border-radius: $br-8;
  padding: $s-8 $s-12;
  background-color: var(--assets-item-background-color);
  color: var(--assets-item-name-foreground-color-hover);
  &:hover {
    background-color: var(--assets-item-background-color-hover);
    color: var(--assets-item-name-foreground-color-hover);
  }
}

.shortcut {
  @include flexCenter;
  gap: $s-2;
  color: var(--menu-shortcut-foreground-color);
}

.shortcut-key {
  @include titleTipography;
  @include flexCenter;
  height: $s-20;
  padding: $s-2 $s-6;
  border-radius: $br-6;
  background-color: var(--menu-shortcut-background-color);
}

.user-icon {
  @include flexCenter;
  @include titleTipography;
  height: $s-24;
  width: $s-24;
  border-radius: $br-circle;
  margin-left: calc(-1 * $s-4);
  img {
    border-radius: $br-circle;
    border: $s-2 solid var(--user-count-foreground-color);
  }
}

.mixed-bar {
  @include titleTipography;
  display: flex;
  align-items: center;
  flex-grow: 1;
  border-radius: $br-8;
  height: $s-32;
  padding: $s-8;
  background-color: var(--input-background-color);
  color: var(--input-foreground-color-active);
}

.link {
  background: unset;
  border: none;
  color: var(--link-foreground-color);
  cursor: pointer;
  text-decoration: none;
}

.colorpicker-handler {
  position: absolute;
  left: 50%;
  top: 50%;
  width: $s-24;
  height: $s-24;
  border: $s-2 solid var(--colorpicker-details-color);
  border-radius: $br-circle;
  transform: translate(calc(-1 * $s-12), calc(-1 * $s-12));
  z-index: $z-index-1;
  &:hover,
  &:active {
    border-color: var(--colorpicker-details-color-selected);
  }
}

.empty-icon {
  @include flexCenter;
  height: $s-48;
  width: $s-48;
  border-radius: $br-circle;
  background-color: var(--empty-message-background-color);
  svg {
    @extend .button-icon;
    height: $s-28;
    width: $s-28;
    stroke: var(--empty-message-foreground-color);
  }
}

.attr-title {
  div {
    margin-left: 0;
    color: var(--entry-foreground-color-hover);
  }
  button {
    @extend .button-tertiary;
    display: none;
    svg {
      @extend .button-icon-small;
      stroke: var(--icon-foreground);
    }
  }
  &:hover {
    button {
      display: flex;
    }
  }
}

.attr-row {
  display: grid;
  grid-template-areas: "name content";
  grid-template-columns: $s-92 1fr;
  gap: $s-4;
  height: $s-32;
  :global(.attr-label) {
    @include titleTipography;
    @include twoLineTextEllipsis;
    width: $s-92;
    margin: auto 0;
    color: var(--entry-foreground-color);
    grid-area: name;
  }

  :global(.attr-value) {
    grid-area: content;
    display: flex;
    color: var(--entry-foreground-color-hover);
    @include titleTipography;
  }
}

.copy-button-children {
  @include titleTipography;
  color: var(--color-foreground-primary);
  text-align: left;

  display: grid;
  grid-template-columns: 1fr 22px;
  grid-template-areas: "name button";
  width: 100%;
  margin: 0;
  padding: 0;
  height: fit-content;
  &:hover {
    div {
      color: var(--entry-foreground-color-hover);
    }
  }
}

.comment-bubbles {
  @include titleTipography;
  @include flexCenter;
  height: $s-32;
  width: $s-32;
  border-radius: $br-circle;
  background-color: var(--comment-bullet-background-color-rest);
  border: $s-1 solid var(--comment-bullet-border-color-rest);
  color: var(--comment-bullet-foreground-color-rest);
}

.resolved-comment-bubble {
  background-color: var(--comment-bullet-background-color-resolved);
  border: $s-1 solid var(--comment-bullet-border-color-resolved);
  color: var(--comment-bullet-foreground-color-resolved);
}
.unread-comment-bubble {
  background-color: var(--comment-bullet-background-color-unread);
  border: $s-1 solid var(--comment-bullet-border-color-unread);
  color: var(--comment-bullet-foreground-color-unread);
}

// SELECTS AND DROPDOWNS
.menu-dropdown {
  @include menuShadow;
  @include flexColumn;
  position: absolute;
  padding: $s-4;
  border-radius: $br-8;
  z-index: $z-index-10;
  color: var(--title-foreground-color-hover);
  background-color: var(--menu-background-color);
}

.menu-item {
  @include titleTipography;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: $s-28;
  width: 100%;
  padding: $s-6;
  border-radius: $br-8;
  cursor: pointer;
  &:hover {
    background-color: var(--menu-background-color-hover);
  }
}

.dropdown-element-base {
  @include titleTipography;
  display: flex;
  align-items: center;
  gap: $s-8;
  height: $s-32;
  padding: 0 $s-8;
  border-radius: $br-6;
  cursor: pointer;
  color: var(--menu-foreground-color-rest);

  span {
    @include flexCenter;
    @include textEllipsis;
    svg {
      @extend .button-icon-small;
      stroke: var(--icon-foreground);
    }
  }
  &:hover {
    background-color: var(--menu-background-color-hover);
    color: var(--menu-foreground-color);
    span svg {
      stroke: var(--menu-foreground-color-hover);
    }
  }
}

.dropdown-wrapper {
  @include menuShadow;
  position: absolute;
  top: $s-32;
  left: 0;
  width: 100%;
  max-height: $s-300;
  padding: $s-2;
  margin: 0;
  margin-top: $s-1;
  border-radius: $br-8;
  z-index: $z-index-3;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--menu-background-color);
  color: var(--menu-foreground-color);
}

.select-wrapper {
  @include titleTipography;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: normal;
  width: 100%;
}
