:host {
  width: fit-content;
  height: var(--height, inherit);
  display: block;
}

.jb-button-web-component {
  width: inherit;
  height: 100%;
  box-sizing: border-box;
  margin: var(--margin);

  button {
    width: inherit;
    height: 100%;
    box-sizing: border-box;
    font-family: inherit;
    border-radius: var(--border-radius);
    corner-shape: var(--box-corner-shape);
    background-color: var(--bg-color);
    border-color: var(--border-color);
    border-width: var(--border-width);
    border-style: var(--border-style);
    color: var(--color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--font-size);
    font-weight: var(--font-weight);
    cursor: var(--cursor);
    transition: ease 0.3s all;
    text-shadow: var(--text-shadow);
    padding-inline: var(--inline-padding);
    padding-block: var(--block-padding);
    box-sizing: border-box;
    box-shadow: var(--box-shadow);
    &:focus-visible {
      outline: 2px solid var(--jb-button-focus-ring-color, Highlight);
      outline-offset: 2px;
    }

    &:hover {
      background-color: var(--bg-color-hover);
      color: var(--color-hover);
      border-color: var(--border-color-hover);
      transition: ease 0.3s all;
      box-shadow: var(--box-shadow-hover);
      .loading-wrapper {
        --jb-loading-color: var(--loading-color-hover, var(--loading-color));
      }
    }

    &:active {
      background-color: var(--bg-color-pressed);
      color: var(--color-pressed);
      border-color: var(--border-color-pressed);
    }

    &.--loading {
      .button-content {
        display: none;
      }

      .loading-wrapper {
        display: flex;
      }
    }

    &:disabled {
      cursor: var(--cursor-disabled);
      text-shadow: var(--text-shadow-disabled);
    }

    .button-content {
      display: flex;
      gap: var(--content-gap);
      justify-content: center;
      align-items: center;
    }

    .loading-wrapper {
      display: none;
      font-size: 0.8em;
      justify-content: center;
      align-items: center;
      gap: 0.5rem;
      --jb-loading-color: var(--loading-color);

      jb-loading {
        width: 1.5rem;
        height: 1.5rem;
      }

      .loading-text {
        &:empty {
          display: none;
        }
      }
    }

    ::slotted(*) {
      text-box-trim: trim-both;
      text-box-edge: ex alphabetic;
    }

    ::slotted(svg),
    ::slotted(img),
    ::slotted(.icon){
      width: var(--button-icon-size);
      height: var(--button-icon-size);
    }
  }
}
