/* stylelint-disable */
@import "../../settings/includes/colors";

.c-form {
  width: 100%;

  &-checkbox {
    opacity: 0;
    position: absolute;
    z-index: -1;

    + .c-form-label {
      min-width: 20px;
      display: flex;
      align-items: center;
      cursor: pointer;
      position: relative;
      font-size: 0.875em;

      &::before {
        background-color: $White;
        border: 2px solid map-get($MonoPalette, 60);
        transition: border-color, 0.3s;
        content: "";
        width: 24px;
        height: 24px;
        display: inline-block;
        margin-right: 8px;
        border-radius: 4px;
      }
    }

    &:focus,
    &:active {
      + .c-form-label {
        outline: none;
      }
    }

    &:checked {
      + .c-form-label {
        &::before {
          border-color: $Pacific;
        }

        &::after {
          content: "";
          width: 6px;
          height: 13px;
          display: inline-block;
          transform: rotate(45deg);
          border-bottom: 2px solid $Pacific;
          border-right: 2px solid $Pacific;
          position: absolute;
          left: 9px;
          top: 4px;
        }
      }

      &[indeterminate] {
        + .c-form-label {
          &::after {
            width: 16px;
            height: 2px;
            background-color: $Pacific;
            position: absolute;
            margin-left: 0;
            margin-top: 0;
            transform: rotate(0);
            border: 0;
            left: 4px;
            top: 11px;
          }
        }
      }
    }

    &[disabled] {
      + .c-form-label {
        cursor: not-allowed;
        color: map-get($MonoPalette, 70);

        &::before {
          background-color: map-get($MonoPalette, 50);
        }
      }

      &:checked {
        + .c-form-label {
          &::before {
            border-color: map-get($MonoPalette, 70);
          }

          &::after {
            border-bottom: 2px solid map-get($MonoPalette, 70);
            border-right: 2px solid map-get($MonoPalette, 70);
          }
        }

        &[indeterminate] {
          + .c-form-label {
            &::after {
              background-color: map-get($MonoPalette, 70);
              border: 0;
            }
          }
        }
      }
    }

    &:not([disabled]) {
      + .c-form-label {
        &:hover,
        &:focus {
          &::before {
            border-color: $Pacific;
          }
        }
      }
    }

    &--error:not([disabled]) {
      + .c-form-label {
        color: $Demask;

        &::before {
          background-color: $White;
          border-color: map-get($DemaskPalette, 60);
        }

        &::after {
          border-bottom: 2px solid map-get($DemaskPalette, 60);
          border-right: 2px solid map-get($DemaskPalette, 60);
        }

        + .c-form-message {
          color: map-get($DemaskPalette, 60);
        }
      }

      &[indeterminate] {
        + .c-form-label {
          &::after {
            background-color: map-get($DemaskPalette, 60);
            border: 0;
          }
        }
      }
    }

    &--warning:not([disabled]) {
      + .c-form-label {
        color: $Sandy;

        &::before {
          background-color: $White;
          border-color: map-get($SandyPalette, 30);
        }

        &::after {
          border-bottom: 2px solid map-get($SandyPalette, 30);
          border-right: 2px solid map-get($SandyPalette, 30);
        }

        + .c-form-message {
          color: map-get($SandyPalette, 30);
        }
      }

      &[indeterminate] {
        + .c-form-label {
          &::after {
            background-color: map-get($SandyPalette, 30);
            border: 0;
          }
        }
      }
    }

    &--success:not([disabled]):required {
      + .c-form-label {
        color: $Paradiso;

        &::before {
          background-color: $White;
          border-color: map-get($ParadisoPalette, 40);
        }

        &::after {
          border-bottom: 2px solid map-get($ParadisoPalette, 40);
          border-right: 2px solid map-get($ParadisoPalette, 40);
        }

        + .c-form-message {
          color: map-get($ParadisoPalette, 40);
        }
      }

      &[indeterminate] {
        + .c-form-label {
          &::after {
            background-color: map-get($ParadisoPalette, 40);
            border: 0;
          }
        }
      }
    }
  }

  &-message {
    color: $Fiord;
    clear: both;
    line-height: 1em;
    font-size: 0.875em;
    display: block;
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 8px;
    margin-top: 8px;
  }

  &--background {
    border-radius: 4px;
    background-color: white;
  }
}
