@import "../../theme.scss";

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;

  &.checkbox-disabled {
    opacity: 0.5;
    pointer-events: none;
  }

  .checkbox-root {
    display: inline-flex;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    background-color: transparent;
    outline: 0px;
    border: 0px;
    margin: 0px;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    appearance: none;
    text-decoration: none;
    border-radius: 50%;
    color: rgba(0, 0, 0, 0.4);
    padding: 9px;

    &.checkbox-checked {
      color: $secondary;
    }

    &:hover {
      background-color: rgba(25, 118, 210, 0.04);
    }

    .checkbox {
      cursor: inherit;
      position: absolute;
      opacity: 0;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      margin: 0;
      padding: 0;
      z-index: 1;

      html[dir="rtl"] & {
        left: unset;
        right: 0;
      }
    }

    svg {
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      width: 0.9em;
      height: 0.9em;
      display: inline-block;
      fill: currentColor;
      -webkit-flex-shrink: 0;
      -ms-flex-negative: 0;
      flex-shrink: 0;
      -webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
      transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
      font-size: 1.5rem;
    }
  }

  &.has-label {
    .checkbox-root {
      padding: 0;
    }
  }

  .checkbox-errorMessage {
    display: flex;
    align-items: center;
    gap: 6px;
    color: $red;
    font-size: 0.775rem;

    p {
      margin: 0;
      color: inherit;
      font-size: inherit;
    }

    svg {
      fill: currentColor;
      height: 1.2em;
      width: 1.2em;
    }
  }
}
