.form-group {
  --input-background-color: var(--color-white);
  --toggle-switch-on-background-color: var(--color-blue-205-100-50);
  --toggle-switch-off-background-color: var(--color-grey-225-10-55);
  --toggle-switch-disabled-background-color: var(--color-grey-225-10-85);
  --toggle-switch-switcher-background-color: var(--color-white);

  .form-control {
    border-radius: 3px;
    border: solid 1px var(--color-grey-225-10-75);
    background-color: var(--input-background-color);
    width: 100%;
    height: 30px;
    font-size: 13px;
    padding-left: 8px;
    color: var(--color-grey-225-10-15);
    font-family: inherit;
    font-weight: normal;
    font-stretch: normal;
    font-style: normal;
    line-height: normal;
    letter-spacing: normal;
    float: left;
  }

  p.form-control {
    border: none;
    padding: 6px 0 0 0;
    height: auto;
    color: var(--color-grey-225-10-35);
  }

  textarea.form-control {
    max-height: 50vh;
    min-height: 12em;
    resize: vertical;
  }

  // hide but remain accessible: https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
  input[type=file].form-control {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px 1px 1px 1px);
  }

  // make sure outline doesn't cover the block
  input[type=file].form-control + label {
    height: 20px;
    width: 20px;
    padding: 2px;
    position: absolute;
    right: 9px;
    top: 11px;
    /* display: inline-flex;
    justify-content: center;
    align-items: center;

    margin-left: 4px;
    min-width: 50px;
    height: 25px;

    font-size: 13px;
    color: var(--color-white);
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
    border: solid 1px var(--color-blue-205-100-45);
    background-color: var(--color-blue-205-100-50); */

    &:hover {
      border-radius: 100%;
      background-color: var(--color-blue-205-100-45);

      path {
        fill: var(--color-white);
      }
    }
  }

  input[type=password].form-control::placeholder,
  textarea.form-control::placeholder,
  input[type=text].form-control::placeholder {
    font-size: 13px;
    font-weight: normal;
    font-stretch: normal;
    font-style: italic;
    line-height: normal;
    letter-spacing: normal;
    color: var(--color-grey-225-10-55);
  }

  input[type=password].form-control:focus,
  input[type=text].form-control:focus,
  textarea.form-control:focus,
  select.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--color-blue-205-100-50), 0 0 0 1px var(--color-grey-225-10-75) inset;
    border: solid 1px var(--color-blue-205-100-50);
  }

  input[type=password].form-control.is-invalid,
  textarea.form-control.is-invalid,
  input[type=text].form-control.is-invalid {
    border: solid 1px var(--color-red-360-100-45);
  }

  input[type=password].form-control.is-invalid:focus,
  textarea.form-control.is-invalid:focus,
  input[type=text].form-control.is-invalid:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--color-red-360-100-92), 0 0 0 1px var(--color-grey-225-10-75) inset;
    border: solid 1px var(--color-red-360-100-45);
  }

  label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: normal;
    font-stretch: normal;
    font-style: normal;
    line-height: normal;
    letter-spacing: normal;
    color: var(--color-grey-225-10-15);
  }

  .form-check-inline {
    display: grid;
    grid-auto-columns: 0.4fr;
    grid-auto-flow: column;
  }

  .custom-control {

    label {
      font-size: 13px;
    }

    font-weight: normal;
    font-stretch: normal;
    font-style: normal;
    line-height: normal;
    letter-spacing: normal;
    color: var(--color-grey-225-10-15);

    .custom-control-input:checked,
    .custom-control-input:not(:checked) {
      position: absolute;
      left: -9999px;
    }

    // the text
    .custom-control-input:checked + .custom-control-label,
    .custom-control-input:not(:checked) + .custom-control-label {
        position: relative;
        padding-left: 26px;
        line-height: 20px;
        display: inline-block;
    }

    // radio control
    .custom-control-input:not(:checked) + .custom-control-label:after {
        opacity: 0;
    }
    .custom-control-input:checked + .custom-control-label:after {
        opacity: 1;
    }

    .custom-control-label:focus {
      outline: none;
    }

    .custom-control-input:focus + .custom-control-label:before {
      box-shadow: 0 0 0 1px var(--color-blue-205-100-50), 0 0 0 1px var(--color-grey-225-10-75) inset;
      border: solid 1px var(--color-blue-205-100-50) !important;
    }
  }

  .custom-checkbox {

    // border of the radio
    .custom-control-input:checked + .custom-control-label:before,
    .custom-control-input:not(:checked) + .custom-control-label:before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 16px;
      height: 16px;
      border: 1px solid var(--color-grey-225-10-75);
      border-radius: 3px;
      background: var(--color-white);
      box-sizing: content-box;
    }

    // inside the checkbox
    .custom-control-input:checked + .custom-control-label:after,
    .custom-control-input:not(:checked) + .custom-control-label:after {
      position: absolute;
      left: 1px;
      width: 16px;
      height: 16px;
      content: "";
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpolygon fill-rule='evenodd' points='5.743 14.314 1 9.57 2.897 7.673 5.743 10.519 13.103 3.16 15 5.057'/%3E%3C/svg%3E%0A");
      box-sizing: content-box;
    }

    .custom-control-input:disabled + label {
      color: var(--color-grey-225-10-35);
    }
  }

  .custom-radio {

    // border of the radio
    .custom-control-input:checked + .custom-control-label:before,
    .custom-control-input:not(:checked) + .custom-control-label:before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 16px;
      height: 16px;
      border: 1px solid var(--color-grey-225-10-75);
      border-radius: 100%;
      background: var(--color-white);
      box-sizing: content-box;
    }

    // inside the radio
    .custom-control-input:checked + .custom-control-label:after,
    .custom-control-input:not(:checked) + .custom-control-label:after {
      content: '';
      width: 8px;
      height: 8px;
      background-color: var(--color-grey-225-10-15);
      position: absolute;
      top: 5px;
      left: 5px;
      border-radius: 100%;
      box-sizing: content-box;
    }

    // radio control
    .custom-control-input:not(:checked) + .custom-control-label:after {
      opacity: 0;
    }
    .custom-control-input:checked + .custom-control-label:after {
      opacity: 1;
    }

    .custom-control-label:focus {
      outline: none;
    }

    .custom-control-input:focus + .custom-control-label:before {
      box-shadow: 0 0 0 1px var(--color-blue-205-100-50), 0 0 0 1px var(--color-grey-225-10-75) inset;
      border: solid 1px var(--color-blue-205-100-50) !important;
    }
  }

  .custom-control-codemirror {
    .cm-editor {
      border-radius: 3px;
      border: solid 1px var(--color-grey-225-10-75);

      &.cm-focused {
        border: solid 1px var(--color-blue-205-100-50);
        outline: none;
        box-shadow: 0 0 0 1px var(--color-blue-205-100-50), 0 0 0 1px var(--color-grey-225-10-75) inset;

        :focus-visible {
          outline-style: none;
        }
      }
    }

    &.is-invalid .cm-editor {
      border: solid 1px var(--color-red-360-100-45);

      &.cm-focused {
        border: solid 1px var(--color-red-360-100-45);
        outline: none;
        box-shadow: 0 0 0 1px var(--color-red-360-100-92), 0 0 0 1px var(--color-grey-225-10-75) inset;

        :focus-visible {
          outline-style: none;
        }
      }
    }
  }

  // feedback / tooltip
  .invalid-feedback {
    color: var(--color-red-360-100-45);
    margin-top: 6px;
    font-size: 13px;
    display: inline-block;

    .invalid-tooltip {
      visibility: hidden;
      padding-left: 10px;
      padding-right: 10px;
      height: 32px;
      border-radius: 3px;
      box-shadow: 0 1px 2px 0 var(--color-black-opacity-30);
      border: solid 1px var(--color-grey-225-10-75);
      top: 20px;
      right: -13px;
      white-space: nowrap;
      background-color: var(--color-white);
      position: absolute;
      z-index: 1;
      font-size: 13px;
      font-weight: normal;
      font-stretch: normal;
      font-style: normal;
      line-height: normal;
      letter-spacing: normal;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--color-grey-225-10-15);
    }

    .invalid-tooltip:before,
    .invalid-tooltip:after {
      position: absolute;
      content: ' ';
      pointer-events: none;
      color: transparent;
      border-style: solid;
      bottom: 100%;
    }

    .invalid-tooltip:before {
      right: 15px;

      border-width: 5px;
      border-bottom-color: var(--color-grey-225-10-75);
    }

    .invalid-tooltip:after {
      right: 16px;

      border-width: 4px;
      border-bottom-color: var(--color-white);
    }

    &:hover .invalid-tooltip {
      visibility: visible;
    }
  }

  .file-list {
    padding: 0;
    margin: 10px 0;

    list-style-type: none;
    max-height: 86px;
    overflow-y: auto;
  }

  .file-list-item {
    display: grid;
    align-items: center;
    grid-template-columns: 100% auto;
  }

  .file-list-item-content {
    display: flex;
    align-items: center;
    grid-column: 1;
    position: relative;
    padding: 4px 0 3px;
    height: 24px;

    svg {
      width: 16px;
      height: 16px;
      margin-right: 5px;
    }

    .error-icon {
      margin-right: 2px;
      margin-left: -3px;
      width: 22px;
      height: 22px;
      fill: var(--color-red-360-100-45);
    }

    .file-list-item-name {
      text-overflow: ellipsis;
      overflow: hidden;
      max-width: 234px;
      white-space: nowrap;
    }


    .default_file-icon {
      background-color: var(--overlay-font-color);
      border-radius: 100%;
      padding: 2px;
      margin: 6px;
      margin-right: 10px;
    }

    &:hover .remove {
      visibility: visible;
    }

    .remove {
      visibility: hidden;
      padding: 2px;
      display: flex;
      border: none;
      background-color: transparent;
      margin-right: 2px;
      position: absolute;
      right: -2px;
      top: 1px;

      svg {
        color: var(--color-red-360-100-45);
        margin: 0;
      }

      &:hover,
      &:focus
       {
        background-color: var(--color-red-360-100-92);
        border-radius: 100%;
      }
    }
  }

  .file-list-item .invalid-feedback {
    grid-column: 2;

    margin-top: 0;
  }

  .file-list-item.is-invalid {
    color: var(--color-red-360-100-45);

    .error {
      margin-left: 3px;
    }
  }

  .custom-control-description:not(:empty) {
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--color-grey-225-10-35);
  }
}

.custom-control-toggle {

  > .description {
    margin: 6px 0 6px 38px;
    font-size: 13px;
    color: var(--color-grey-225-10-35);

  }

  .toggle-switch .field-wrapper > label {
    display: flex;
    align-items: center;
  }

  .toggle-switch .toggle-switch__label {
    margin: 0;
    margin-left: 6px;
  }

  .toggle-switch .toggle-switch__switcher {
    position: relative;
    width: 32px;
    height: 16px;
    margin: 0;
  }

  .toggle-switch .toggle-switch__switcher input[type='checkbox'] {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .toggle-switch .toggle-switch__switcher .toggle-switch__slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-switch-off-background-color);
    -webkit-transition: 0.4s;
    transition: 0.4s;
    border-radius: 34px;
  }

  .toggle-switch .toggle-switch__switcher .toggle-switch__slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--toggle-switch-switcher-background-color);
    -webkit-transition: 0.4s;
    transition: 0.4s;
    border-radius: 50%;
  }

  .toggle-switch .toggle-switch__switcher input[type='checkbox']:checked + .toggle-switch__slider {
    background-color: var(--toggle-switch-on-background-color);
    box-shadow: 0 0 1px ;
  }

  .toggle-switch .toggle-switch__switcher input[type='checkbox']:disabled + .toggle-switch__slider {
    background-color: var(--toggle-switch-disabled-background-color);
    box-shadow: none ;
  }

  .toggle-switch .toggle-switch__switcher input[type='checkbox']:checked + .toggle-switch__slider:before {
    -webkit-transform: translateX(16px);
    -ms-transform: translateX(16px);
    transform: translateX(16px);
  }
}

.custom-select {
  min-height: 60px;
}

.documentation-icon {
  margin-left: 8px;
  margin-right: 8px;

  svg {
    color: var(--color-blue-205-100-50);
    position: relative;
    top: 2px;
  }

  &:hover svg {
    color: var(--color-blue-205-100-45);
  }
}
