// scss-lint:disable SelectorDepth
// scss-lint:disable NestingDepth
// scss-lint:disable SelectorFormat
// scss-lint:disable ImportantRule

@import "constants";
@import "mixins";

.content-pane.my-modules-protocols-index {
  padding: 10px;
}

.content-pane.protocols-repository-edit-view {
  margin: 0;
}

.task-section {
  border-left: 3px solid $color-concrete;
  margin: 16px 0;
  padding-left: 16px;

  .task-section-caret {
    color: $color-volcano;
    display: inline-block;
    text-decoration: none;

    .fas {
      margin-right: 5px;
    }

    &:not(.collapsed) .fas {
      @include rotate(90deg);
    }
  }

  .task-section-title {
    display: inline-block;

    h2 {
      margin: 10px 0;

      &.assigned-items-title {
        &::after {
          @include font-h3;
          color: $color-alto;
          content: '[' attr(data-assigned-items-count) ']';
          display: inline;
          line-height: 22px;
          padding-left: 5px;
        }
      }
    }
  }

  .task-section-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;

    .actions-block {
      display: flex;
      flex-grow: 1;
      justify-content: flex-end;

      .caret {
        margin-left: 25px;
      }

      .repositories-assign-container {
        flex-grow: 1;
        max-width: 200px;

        .btn {
          text-align: left;

          .caret {
            margin: 8px 0;
          }
        }

        .repositories-dropdown-menu {
          .repository {
            @include font-button;
            cursor: pointer;
            display: flex;
            padding: 8px 16px;

            .assigned-items,
            .shared-icon {
              flex-shrink: 0;

              .fas {
                padding-right: 5px;
              }
            }

            .assigned-items {
              color: $color-alto;
            }

            .name {
              flex-grow: 1;
            }
          }
        }
      }

      .dropdown-menu {
        @include font-button;

        a {
          padding: 8px 20px;
        }

        .fas {
          padding-right: 5px;
        }
      }
    }
  }
}

.complete-button-container {
  display: inline;
  float: right;
  width: 260px;

  .my_module-state-buttons {
    padding-top: 0;
  }
}

.task-details {
  .fas.block-icon {
    margin-right: 8px;
  }

  .flex-block {
    align-items: center;
    display: flex;
    line-height: 34px;

    .flex-block-label {
      align-items: center;
      display: flex;
      margin-right: 4px;
    }
  }

  .empty-label {
    color: $color-silver-chalice;
    font-weight: normal;
  }

  .datetime-container {
    align-items: center;
    display: inline-flex;

    .date-text {
      border: 1px solid transparent;
      font-weight: bold;
      line-height: 32px;
      margin-right: 25px;
      padding: 0 4px;
      position: relative;

      .alert-green {
        color: $brand-success;
      }

      .alert-yellow {
        color: $brand-warning;
      }

      .alert-red {
        color: $brand-danger;
      }

      .clear-date {
        color: $color-silver;
        cursor: pointer;
        display: none;
        font-size: 20px;
        left: 100%;
        line-height: 34px;
        margin-left: 5px;
        position: absolute;
        top: 0;
      }
    }

    .datetime-picker-container {
      color: $color-emperor;
      left: 0;
      position: absolute;
      top: 0;
      width: 100%;

      #calendarDueDate {
        opacity: 0;
      }

      #calendarStartDate {
        opacity: 0;
      }

      .fa-calendar-alt {
        display: none;
      }
    }

    &:hover {
      .date-text[data-editable=true] {
        background-color: $color-concrete;
        border-radius: 4px;

        .clear-date {
          display: inline;
        }
      }
    }
  }

  .module-tags {
    #module-tags {
      align-items: center;
      display: flex;
      width: 100%;
    }

    .dropdown-selector-container {
      .my-module-white-tags {
        color: $color-white;
      }

      .my-module-tags-color {
        border-radius: 8px;
        display: inline-block;
        height: 16px;
        margin-right: 5px;
        width: 16px;
      }

      .my-module-tags-create-new {
        opacity: .6;
      }

      .input-field {
        border: 1px solid transparent;
        padding-right: 110px;
      }

      &.open {
        .input-field {
          border: 1px solid $color-alto;
        }
      }

      &:not(.view-mode):hover {
        .input-field {
          border: 1px solid $color-alto;
        }
      }
    }

    .badge-icon {
      display: inline-block;
      line-height: 32px;
      padding: 0 5px 0 0;
      width: 28px;
    }

    .tags-title {
      display: inline-block;
      font-size: 14px;
      line-height: 32px;
      margin-right: 4px;
    }

    .select-container {
      display: flex;
      flex-basis: 100px;
      flex-grow: 1;
      flex-shrink: 1;
      max-width: 100%;
      position: relative;
      z-index: 110;

      select {
        display: none;
      }

      .edit-button-container {
        height: 36px;
        padding-right: 10px;
        position: absolute;
        right: 0;
        text-align: right;
        top: 0;
        width: 120px;
        z-index: 20;

        &.hidden {
          display: none;
        }

        a {
          color: inherit;
          display: inline-block;
          line-height: 36px;
          opacity: .7;
          text-decoration: none;

          i {
            float: left;
            font-size: 16px;
            line-height: 36px;
            margin-right: 5px;
            padding-top: 1px;
          }

          span {
            float: left;
            line-height: 36px;
          }
        }
      }
    }
  }

  #manage-module-tags-modal {
    .well {
      border: 0;
      box-shadow: none;
    }
  }

  .task-assigned-users {
    align-items: center;
    border-radius: 17px;
    display: flex;

    &.empty {
      border-radius: 4px;
      padding: 0 4px;
    }

    &:hover {
      background-color: $color-concrete;
      text-decoration: none;
    }
  }

  .assign-new-user {
    background-color: $color-alto;
    color: $color-volcano;
    text-align: center;

    .fa-plus {
      font-size: 16px;
    }
  }
}

.task-notes {
  display: inline-block;
  position: relative;
  width: 100%;

  .no-description {
    font-size: 16px;
  }

  .task-notes-content {
    margin-left: 10px;
  }
}

.my-module-protocol-status {
  position: relative;

  .status-label {
    @include font-h3;
    color: $color-alto;
    float: left;
    margin: 0 3px;

    &.linked {
      color: $brand-primary;
    }
  }

  .status-info {
    @include font-h2;
    color: inherit;
    text-decoration: none;

    &:hover,
    &:active {
      color: inherit;
      text-decoration: none;
    }

    &.protocol-newer {
      color: $brand-focus;
    }

    &.parent-newer {
      color: $brand-warning;
    }
  }

  .status-info-dropdown {
    left: -125px;
    max-width: 100vw;
    width: 650px;

    .dropdown-body {
      border-bottom: $border-tertiary;
      padding: 10px 32px;

      .info-line {
        align-items: center;
        display: flex;
        flex-wrap: wrap;
        margin: 9px 0;

        .description {
          @include font-button;
          flex-grow: 1;
          min-width: 120px;
        }

        .value {
          @include font-h3;
          flex-shrink: 0;
        }

        &.new-parent-version {
          .value {
            color: $brand-warning;

            &::before {
              @include font-awesome;
              content: "\f2f1";
              margin-right: 5px;
            }
          }
        }
      }

      .notification-line {
        @include font-button;
        color: $color-silver-chalice;
        display: flex;
        margin: 8px 0;

        .fas {
          line-height: 21px;
          margin-right: 3px;
        }

        &.new-parent-version {
          color: $brand-warning;
        }

        &.new-protocol-version {
          color: $brand-focus;
        }
      }
    }

    .dropdown-footer {
      padding: 16px;
    }
  }
}

.task-details-dropdown-container {
  .task-details-button {
    @include font-h2;
    color: inherit;
    margin: 0 3px;
    text-decoration: none;
  }

  .dropdown-menu {
    @include font-button;
    min-width: 500px;
    padding: 1em 2em;

    .task-details-value {
      @include font-h3;
    }

    .row-v-margin {
      margin-bottom: .5em;
      margin-top: .5em;
    }
  }
}

.task-information {
  column-gap: 1em;
  display: grid;
  grid-template-columns: auto minmax(max-content, 18em);

  .task-section-header {
    grid-column: 1 / span 1;
  }

  .task-details {
    grid-column: 1 / span 1;
    grid-row: 2 / span 1;
  }

  .task-flows {
    grid-column: 2 / span 1;
    grid-row: 1 / span 2;

    .status-label {
      @include font-small;
      font-weight: bold;
    }
  }
}

@media (max-width: 700px) {
  .my-module-protocol-status {
    .status-info-dropdown {
      left: -75px;
      width: 300px;

      .dropdown-footer {
        .btn {
          float: left !important;
          margin: 5px 0;
          width: auto;
        }
      }
    }
  }

  .task-information {
    grid-template-columns: auto;
    row-gap: .5em;

    .task-details {
      grid-row: 3 / span 1;
    }

    .task-flows {
      grid-column: unset;
      grid-row: 2 / span 1;
    }
  }
}
