@use "sass:math";

.ordering-answer-items {
  display: flex;
  flex: 1;
  gap: $answer-item-margin-bottom;

  // remove <ul> styles
  margin: 0;
  padding: 0;
  list-style-type: none;

  > li {
    flex: 1;
  }
}

.empty-placeholder,
.ordering-answer-items {
  + .btn {
    margin-top: $answer-item-margin-bottom * 2;
  }
}

.ordering-answer-items.horizontal {
  flex-direction: row;
  flex-wrap: wrap;

  .ordering-answer-item {
    min-width: 200px;
    flex-direction: column;
    align-items: stretch;

    .text-fields {
      order: 2;
      margin-top: ($grid-gutter-width * .5);
    }

    .ordering-item-content {
      order: 2;
      margin-top: ($answer-item-padding * .5);
    }

    .item-actions,
    .right-controls {
      order: 1;
      margin-left: auto;
    }
  }
}

.ordering-answer-items.vertical {
  flex-direction: column;

  .ordering-answer-item {
    flex-direction: row;

    .ordering-item-content,
    .text-fields {
      margin-right: ($grid-gutter-width * .5);
    }
  }
}

.ordering-answer-item {
  margin: 0;
  display: flex;
  align-items: flex-start;

  .ordering-item-tick {
    flex-shrink: 0;
    align-self: flex-start; // make sure tick is always in the top left corner
    margin-top: .25em; // same as checkboxes/radios
    width: 1em; // same as checkboxes/radios
    height: 1em; // same as checkboxes/radios
    text-align: center;
    margin-right: ($grid-gutter-width * .5);
  }

  .ordering-item-content {
    flex: 1;
  }

  .score {
    margin-right: ($grid-gutter-width * .5);
  }

  .btn-feedback {
    margin-left: ($grid-gutter-width * .5);
  }

  .ordering-item-drag {
    line-height: $btn-line-height;
  }

  .item-actions {
    display: flex;
    align-self: flex-start;
    gap: $answer-item-padding;

    .btn {
      border: 0;
      padding: 0;
    }
  }
}

.ordering-drop-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--#{$prefix}secondary-color);
  border-radius: $answer-item-border-radius;
  height: auto;
  text-align: center;
  padding: $answer-item-padding;
}

.ordering-player,
.ordering-feedback,
.ordering-paper {
  display: flex;
  gap: $grid-gutter-width;

  &.vertical {
    flex-direction: row;
  }

  &.horizontal {
    flex-direction: column;
  }
}

.ordering-player {
  .ordering-answer-item {
    cursor: move;
  }
}

.ordering-paper {
  .stats-item {
    justify-content: flex-end;
  }

  .stats-success {
    .answer-stats {
      color: $selected-answer-bg;
      background-color: $selected-answer-color;
    }
  }
}
