@use "../colors" as c;
@use "ilios-button";
@use "ilios-form";
@use "ilios-heading";
@use "ilios-list";

@use "sass:color";

@mixin objectives() {
  .header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5em;

    span {
      display: flex;
      align-items: center;
      justify-content: flex-end;

      .expand-collapse-button {
        margin: 0 0.5em;
      }

      .visualizer-course-objectives {
        width: 2rem;
        height: 2rem;
      }
    }

    .title {
      @include ilios-heading.ilios-heading-h5;
    }
  }

  .new-objective {
    border: 1px solid c.$culturedGrey;
    margin: 1rem;
    padding: 0.5rem;

    .title {
      margin-bottom: 0.25em;
    }

    .new-objective-form {
      margin-left: 0.5em;

      label {
        font-weight: bold;
        margin: 0.25em;
      }
      .buttons {
        @include ilios-form.ilios-form-buttons;
      }
    }
  }
}

@mixin objective-list() {
  .headers {
    font-weight: bold;
  }
  .grid-row {
    display: grid;
    grid-template-columns: 5fr 3fr 3fr 3fr 1fr;
    grid-template-rows: auto;
    margin-right: 0.5em;

    .grid-item {
      border-bottom: 1px solid c.$davysGrey;
      padding: 0.5em 0.25em;
    }

    &:last-of-type {
      .grid-item {
        border-bottom: 0;
      }
    }

    &.is-loading {
      @keyframes shimmer {
        0% {
          background-position: -1000px 0;
        }
        100% {
          background-position: 1000px 0;
        }
      }

      animation: shimmer 2s infinite;
      background: linear-gradient(
        to right,
        #eff1f3 4%,
        #e2e2e2 25%,
        #eff1f3 36%
      );
      background-size: 1000px 100%;

      .grid-item {
        color: transparent;
        text-shadow: rgba(0, 0, 0, 0.3) 0px 0px 10px;
      }
    }
  }
  .objective-row {
    transition: background-color 1s ease-out;

    &.highlight-ok {
      transition: none;
      background-color: color.adjust(c.$fernGreen, $lightness: 60%);
    }

    &.is-managing {
      border: 2px solid c.$blueMunsell;
      .grid-item {
        background-color: c.$culturedGrey;
        border: 0;
      }
    }

    .description {
      p {
        margin: 0;
      }
    }

    &.confirm-removal {
      background-color: c.$lavenderBlush;

      .grid-item {
        border: 0;
      }

      .confirm-message {
        color: c.$crimson;
        grid-column: 1 / -1;
        font-weight: bold;
        text-align: center;
        margin-bottom: 1em;
      }

      .remove {
        background-color: c.$white;
        color: c.$crimson;

        &:hover {
          background-color: c.$crimson;
          color: white;
        }
      }
    }
  }
  .actions {
    text-align: right;
  }

  .taxonomy-manager {
    margin: 1em 2em;
    grid-column: 1 / -1;
  }
}

@mixin objective-list-item($space) {
  ul {
    @include ilios-list.ilios-list-reset;

    li {
      margin-bottom: $space;

      &:last-of-type {
        margin-bottom: 0;
      }
    }
  }

  .bigadd {
    background-color: c.$fernGreen;
    color: c.$white;
  }

  .bigcancel {
    background-color: c.$crimson;
    color: c.$white;
    margin-left: 0.5em;
  }

  .detail-terms-list {
    // override the generic rule specified in this mixin above,
    li:last-of-type {
      margin-bottom: inherit;
    }
  }
}
