// scss-lint:disable IdSelector SelectorDepth NestingDepth

.protocols-index {

  .title-row {
    .fas {
      margin-right: 16px;
    }
  }

  .protocols-datatable {
    --content-header-size: 5em;
    --protocol-toolbar-size: 4em;
    height: calc(100vh - var(--navbar-height) - var(--content-header-size));

    #protocols-table_wrapper {
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;

      .dataTables_scrollHead {
        flex-shrink: 0;

        thead {
          .sci-checkbox-container {
            margin-left: .125rem;
          }
        }

        tbody {
          td {
            vertical-align: middle;
          }

          td:first-child {
            padding-top: 4px;
          }

          td:not(:first-child) {
            max-width: 30rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }

        .table.dataTable .sorting {
          &::after {
            opacity: 0;
          }

          &:hover {
            &::after {
              opacity: 1;
            }
          }
        }
      }
    }

    .toolbar {
      align-items: center;
      display: flex;

      .left-general-toolbar {
        align-items: center;
        column-gap: .5em;
        display: flex;

        .dropdown-menu {
          min-width: 150px;
        }
      }

      .view-switch {
        margin: 0 auto;
      }

      .right-general-toolbar {
        align-items: center;
        display: flex;
        margin-left: auto;
        margin-right: .5em;
      }
    }

    .dataTables_scroll {
      display: flex;
      flex-direction: column;
      flex-grow: 1;
      height: calc(100% - var(--datatable-pagination-row) - var(--protocol-toolbar-size));
      padding-bottom: 12px;
      z-index: 1;
    }

    .dataTables_scrollBody {
      flex-grow: 1;

      td {
        padding: 8px;
        vertical-align: middle;
        white-space: nowrap;
      }
    }

    // Cells

    // User access
    .users-access-cell {
      .protocol-users-link {
        align-items: center;
        color: var(--sn-black);
        display: flex;
        gap: .25rem;

        &:hover {
          text-decoration: none;
        }
      }

      .global-avatar-container {
        align-items: center;
        display: flex;
        height: 28px;
        justify-content: center;
        line-height: 28px;
        width: 28px;
      }

      .more-users {
        background: $color-volcano;
        border-radius: 50%;
        color: $color-white;
        height: 2em;
        line-height: 2em;
        margin-right: .25em;
        text-align: center;
        text-decoration: none;
        width: 2em;
      }

      .new-user {
        background: $color-concrete;
        height: 28px;
        line-height: 24px;
        text-align: center;
        width: 28px;
      }
  }

    .selected {
      .global-avatar-container,
      .more-users {
        border: 2px solid $color-concrete;
      }
    }

    .not-clickable-record {
      color: $color-alto;
    }
  }

  .protocol-filters {
    display: flex;
    position: relative;

    .filter-container {
      margin-right: 1em;
    }

    .dropdown-option.users-dropdown-list {
      padding: 8px 10px;

      .item-avatar {
        border-radius: 50%;
        height: 32px;
        margin: 0 16px 0 0;
        width: 32px;
      }
    }

    .select-block.has-draft {
      align-items: center;
      column-gap: 8px;
      display: flex;
    }

    .input-field:focus-within,
    .datetime-picker-container:focus-within {
      border: 1px solid $brand-focus;
      border-radius: 4px;
    }
  }

  &.archived {
    .only-active {
      display: none;
    }
  }

  &:not(.archived) {
    .only-archive {
      display: none;
    }
  }
}

#protocol-versions-modal {
  .modal-footer {
    border: 0;
  }

  .protocol-version-row {
    align-items: center;
    border-bottom: 1px solid $color-concrete;
    display: flex;
    flex-wrap: wrap;
    padding: 1em 0;

    .protocol-version-metadata {
      display: flex;
      flex-wrap: nowrap;
      width: 100%;
      align-items: center;

      .protocol-link {
        @include font-button;
        flex-shrink: 0;
      }

      .protocol-actions {
        display: flex;
        margin-left: auto;
        min-height: 36px;
      }

      .edit-buttons {
        margin-top: .25em;

        .btn {
          margin-left: .5em;
        }
      }

      .protocol-metadata {
        @include font-small;
        margin-left: 16px;
      }
    }

    &:not(:hover) {
      .save-as-draft {
        opacity: 0;
        pointer-events: none;
      }
    }

    .protocol-version-comment {
      @include font-button;
      flex-basis: 100%;
      margin-top: .25em;

      .view-mode {
        border: $border-transparent;
        cursor: pointer;
        min-height: 3em;
        padding: .5em;

        &:empty::before {
          @include font-button;
          color: $color-silver-chalice;
          content: attr(data-placeholder);
        }

        &:hover {
          border: $border-tertiary;
          border-radius: $border-radius-default;
        }
      }

      textarea {
        min-height: 5em;
        padding: .5em;
        width: 100%;
      }

      .protocol-comment-container {
        .sci-input-field {
          margin-bottom: 8px;
        }

        &[data-edit-mode="0"] {
          .edit-buttons {
            display: none;
          }
        }

        .edit-buttons {
          column-gap: 8px;
          display: flex;
          justify-content: end;
        }
      }
    }
  }

  .protocol-version-link {
    margin-right: 1em;
  }

  .protocol-version-comment-row {
    padding-bottom: .5em;
    padding-top: .5em;
  }
}

#protocolsioModal {
  .modal-dialog {
    width: 90vw;
  }
}

#newProtocolModal {
  .description {
    @include font-button;
    margin: 1em 0;
  }

  .default-role-container {
    @include font-button;
    display: flex;
    line-height: 24px;
    margin: 1em 0;

    .sci-checkbox-container {
      margin: 4px 8px 4px 0;
    }

    small {
      @include font-small;
      display: block;
      line-height: 16px;
    }
  }
}

#linked-children-modal {
  .dataTables_length .form-control {
    width: 160px;
  }

  .version-dropdown {
    align-items: center;
    column-gap: 8px;
    display: flex;
    margin-top: 16px;

    label {
      font-size: 14px;
      font-weight: 400;
    }

    .dropdown-selector-container {
      width: 86px;
    }
  }

  .linked-children-datatable {
    margin-bottom: 16px;
  }
}
