@use '../variables' as vars;
@use 'variables' as compatVars;

@mixin sky-deemphasized {
  font-family: compatVars.$sky-font-family;
  color: var(--sky-text-color-deemphasized);
  font-weight: 400;
  font-size: compatVars.$sky-font-size-base;
  font-style: italic;
}

@mixin sky-btn-tab {
  background-color: transparent;
  border: none;
  border-radius: 4px 4px 0 0;
  color: var(--sky-text-color-deemphasized);
  cursor: pointer;
  display: inline-block;
  font-weight: 600;
  line-height: 1.8;
  padding: compatVars.$sky-tab-btn-padding-top-bottom
    compatVars.$sky-tab-btn-padding-left-right;

  &:hover:not(.sky-btn-tab-disabled) {
    background-color: var(--sky-background-color-neutral-light);
    color: var(--sky-text-color-default);
    text-decoration: none;
  }

  &.sky-btn-tab-disabled {
    background-color: var(--sky-background-color-disabled);
    cursor: not-allowed;
    pointer-events: none;
    outline: none;
    text-decoration: none;

    &:hover {
      color: var(--sky-text-color-deemphasized);
      cursor: default;
      text-decoration: none;
    }
  }
}

@mixin sky-btn-tab-selected {
  background-color: var(--sky-background-color-primary-dark);
  color: var(--sky-text-color-on-dark);

  &:hover:not(.sky-btn-tab-disabled) {
    background-color: var(--sky-background-color-primary-dark);
    color: var(--sky-text-color-on-dark);
  }
}

@mixin sky-danger {
  content: '\f071';
  font-family: FontAwesome;
  margin-right: 5px;
  color: var(--sky-highlight-color-danger);
}

@mixin sky-dropdown-item-btn {
  background-color: transparent;
  border: none;
  color: var(--sky-text-color-default);
  cursor: pointer;
  display: block;
  padding: 3px compatVars.$sky-padding-double;
  text-align: left;
  width: 100%;

  &[disabled] {
    color: var(--sky-text-color-deemphasized);

    &:hover {
      cursor: default;
    }
  }
}

@mixin sky-dropdown-item($encapsulate: true) {
  background-color: transparent;
  border: none;
  display: block;
  margin: 4px;
  min-width: 160px;
  text-align: left;
  transition: background-color compatVars.$sky-transition-time-short;

  &.sky-dropdown-item-active,
  &:hover {
    a,
    button {
      background-color: var(--sky-background-color-neutral-light);
    }
  }

  button[disabled],
  a[disabled] {
    cursor: default;
    &:hover {
      background-color: transparent;
    }
  }

  @if ($encapsulate == true) {
    ::ng-deep > button {
      @include sky-dropdown-item-btn();
    }
  } @else {
    & > button {
      @include sky-dropdown-item-btn();
    }
  }
}

@mixin sky-field-status($status) {
  @if ($status == 'active') {
    box-shadow: 0 0 8px rgba(vars.$sky-highlight-color-info, 0.6);
    border: 1px solid var(--sky-highlight-color-info);
    outline: none;
  }
  @if ($status == 'invalid') {
    box-shadow: 0 0 8px rgba(vars.$sky-highlight-color-danger, 0.6);
    border: 1px solid var(--sky-highlight-color-danger);
    outline: none;
  }
  @if ($status == 'success') {
    box-shadow: 0 0 8px rgba(vars.$sky-highlight-color-success, 0.6);
    border: 1px solid var(--sky-highlight-color-success);
    outline: none;
  }
}

@mixin sky-icon-button-borderless {
  color: vars.$sky-text-color-icon-borderless;
  cursor: pointer;

  &:hover {
    color: darken(vars.$sky-text-color-icon-borderless, 20%);
    transition: color compatVars.$sky-transition-time-short;
  }
}

@mixin sky-focus-outline {
  //default
  outline: thin dotted;

  //webkit
  outline: -webkit-focus-ring-color auto 5px;
}

@mixin sky-required-field {
  /* TODO: remove this fallback `content` line, once support for content alt text is added to firefox & safari */
  content: '*';
  content: '*' / '';
  color: var(--sky-highlight-color-danger);
  padding-left: compatVars.$sky-padding-half;
}

@mixin sky-screen-reader-only {
  width: 0;
  height: 0;
  padding: 0;
  opacity: 0;
  position: absolute;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  outline: none;
  white-space: nowrap;
}

@mixin sky-subsection-heading {
  font-family: compatVars.$sky-font-family;
  color: var(--sky-text-color-deemphasized);
  font-weight: 300;
  font-size: 19px;
}
