@mixin glass {
  border: none;
  border-radius: var(--border-radius);
  background: none;
  background-color: var(--glass-bg);
  box-shadow: var(--glassy);
}

@mixin quick-transition {
  $transitionTime: 0.15s;
  transition: text-shadow $transitionTime ease-in-out, background-color $transitionTime ease-in-out,
    border $transitionTime ease-in-out, color $transitionTime ease-in-out, box-shadow $transitionTime ease-in-out,
    backdrop-filter $transitionTime ease-in-out, border-radius $transitionTime, outline $transitionTime;
}

@mixin gold-border {
  border: none;
  margin: 2px;
  /* prettier-ignore */
  box-shadow:
    0 0 0 1px var(--tertiary),
    0 0 0 2px var(--gold-brown);
}

@mixin sheet {
  @include gold-border;
  background-image: var(--sheet);
  background-size: cover;
}

@mixin dui-app {
  background: var(--app-background);
  border: var(--app-border-width) solid var(--app-border-color);
  text-shadow: var(--app-text-shadow);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  color: var(--text-color-3);
  // backdrop-filter: var(--app-backdrop-filter);
}

@mixin dui-grayscale {
  > img {
    filter: sepia() brightness(0.7) sepia(1) grayscale(0.7) drop-shadow(0px 1px 1px black);
  }

  &:hover > img {
    filter: sepia() grayscale(0.95) brightness(1) drop-shadow(0px 1px 1px black);
  }
}

@mixin dui-button {
  @include dui-app;
  background: var(--dui-button-background);
  border: var(--app-border-width) solid var(--dui-button-border-color);
  color: var(--dui-button-text-color);
  box-shadow: var(--box-shadow);
  text-decoration: none;
  cursor: pointer;
  text-shadow: var(--app-text-shadow);

  &:not(.disabled, :disabled, .empty):hover {
    background: var(--button-hover-background);
    color: var(--dui-button-hover-text-color);
    border: var(--app-border-width) solid var(--button-hover-border-color);
    box-shadow: var(--box-shadow);
  }

  &.view,
  &.selected,
  &.active:not(.empty) {
    background: var(--button-hover-background);
    outline: 1px solid var(--dui-button-focus-outline-color);
    border-color: var(--button-hover-border-color);
    color: var(--dui-button-hover-text-color);
    text-decoration: none !important;
    font-weight: unset !important;
  }

  // tabs on NPC sheets
  &.empty.active {
    outline: 1px solid var(--dui-button-focus-outline-color);
  }

  &.empty,
  &.disabled,
  &:disabled {
    --dui-button-background: var(--button-disabled-background);
    --button-hover-background: var(--button-disabled-background);
    --dui-button-border-color: var(--button-disabled-border-color);
    --dui-button-text-color: var(--text-color-5);
  }
}

@mixin dui-button-bright {
  @include dui-button;
  transition: background 0.1s ease-in-out;
  --dui-button-background: var(--accent-color);
  --dui-button-border-color: var(--accent-color-dark);
  --dui-button-text-color: var(--accent-text-color);
  --app-text-shadow: none;
  --button-hover-background: var(--accent-color-light);
  --button-hover-border-color: var(--accent-color);
  --dui-button-hover-text-color: var(--accent-text-color);

  &:disabled {
    --dui-button-background: color-mix(in srgb, var(--dui-button-background) 50%, transparent 50%);
    --dui-button-border-color: color-mix(in srgb, var(--dui-button-border-color) 50%, transparent 50%);
    --button-hover-background: color-mix(in srgb, var(--button-hover-background) 50%, transparent 50%);
  }
}

@mixin dui-button-toggle {
  @include dui-button;
  transition: background 0.1s ease-in-out;
  --dui-button-background: var(--button-toggle-background);
  --dui-button-border-color: var(--button-toggle-border-color);
  --dui-button-focus-outline-color: var(--button-toggle-focus-outline-color);
  --button-hover-background: var(--button-toggle-hover-background);
  --button-hover-border-color: var(--button-toggle-hover-border-color);

  &:disabled {
    --dui-button-background: color-mix(in srgb, var(--dui-button-background) 50%, transparent 50%);
    --dui-button-border-color: color-mix(in srgb, var(--dui-button-border-color) 50%, transparent 50%);
    --button-hover-background: color-mix(in srgb, var(--button-hover-background) 50%, transparent 50%);
  }
}

@mixin dui-input {
  background: var(--dui-input-background);
  border: var(--app-border-width) solid;
  border-color: var(--dui-input-border-color) !important;
  color: var(--dui-input-text-color);
  box-shadow: var(--input-box-shadow) !important;
  align-items: center;
  // height: var(--input-height);
  // line-height: var(--input-height);
  // padding: 0 0.3rem;
  border-radius: 4px;
  outline: 0px solid transparent;
  user-select: text;
  // font-size: var(--font-size);
  transition: outline-color 0.5s;

  &:not(:disabled, .disabled, [type="checkbox"]):hover,
  &:focus {
    outline: 1px solid var(--dui-input-focus-outline-color);
    border: var(--app-border-width) solid;
    border-color: var(--dui-input-border-color);
    color: var(--dui-input-focus-text-color);
    box-shadow: var(--box-shadow);
  }

  &.disabled,
  &:disabled {
    --dui-input-text-color: var(--text-color-disabled);
    --dui-input-background: var(--input-disabled-background);
    --dui-input-border-color: var(--input-disabled-border-color);
    &::placeholder {
      color: color-mix(in srgb, var(--dui-input-placeholder-color) 50%, transparent);
    }
  }

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

  &::selection {
    // color: var(--dui-input-text-color);
    // background: rgba(122, 122, 122, 0.5);
  }

  &[type="checkbox"] {
    outline: unset !important;
    border: unset !important;
    box-shadow: unset !important;
  }
}

@mixin dui-tooltip {
  @include dui-app;
  background: var(--app-background);
  border: var(--app-border-width) solid var(--app-border-color);
  box-shadow: var(--window-app-box-shadow);
  border-radius: var(--border-radius);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-shadow: 0px 1px 2px black;
}
