@import 'moda-themes/themes';
@import '01-variables/01-variables-breakpoints.scss';

.mo-display-checkbox {
  li {
    font-family: font-family('sans');
    display: flex;
    align-items: center;
    height: fit-content;
    line-height: 20px;
    margin: 4px 0;
    padding-right: 12px;
    color: color('black');
    font-size: 12px;

    input[type='checkbox'] {
      display: none;
    }

    input[type='checkbox'] + label {
      align-self: flex-start;
      width: 12px;
      height: 12px;
      margin: 4px 8px 0 0;
      background: color('white') left top no-repeat;
      border: 1px solid color('black');
      color: color('black');
      cursor: pointer;

      & + span:hover {
        cursor: pointer;
      }
    }

    input[type='checkbox']:checked + label {
      background: color('black') -19px top no-repeat;
    }

    input[type='checkbox']:disabled + label {
      border-color: color('elephant');
      cursor: not-allowed;

      & + span {
        color: color('elephant');

        &:hover {
          cursor: not-allowed;
        }
      }
    }
  }

  // with checkmark
  .container {
    font-family: font-family('sans');
    display: block;
    position: relative;
    padding-left: 20px;
    margin: 4px 12px 4px 0;
    line-height: 20px;
    font-size: 12px;
    user-select: none;
    cursor: pointer;
  }

  // Hide the default checkbox
  .container input {
    display: none;
  }

  .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 12px;
    width: 12px;
    background-color: color('white');
    border: 1px solid color('black');
    margin: 4px 8px 0 0;
  }

  // When checkbox is checked, add bg color
  .container input:checked ~ .checkmark {
    background: color('black') top no-repeat;
  }

  // Create the checkmark (hidden when not checked)
  .checkmark:after {
    content: '';
    position: absolute;
    display: none;
  }

  // Show the checkmark when checked
  .container input:checked ~ .checkmark:after {
    display: block;
  }

  // Style the checkmark
  .container .checkmark:after {
    left: 3px;
    top: 0px;
    width: 3px;
    height: 6px;
    border: solid color('white');
    border-width: 0 1px 1px 0;
    transform: rotate(45deg);
  }
}
