@use "lib/viewport";

.admin-contents .ai-persona-list-editor {
  margin-top: 0;
}

.ai-persona-list-editor {
  @include viewport.until(md) {
    td {
      border: none;
      padding: 0;

      &.d-admin-row__llms,
      &.d-admin-row__features {
        padding-block: 0;

        .--card-label {
          display: inline-block;
          font-size: var(--font-down-1);
          color: var(--primary-high);
        }
      }
    }
  }

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 1em 0;

    h3 {
      margin: 0;
    }
  }

  &__current {
    padding-left: 20px;
  }

  li.disabled {
    opacity: 0.5;
  }

  &__controls {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);

    .filter-input-container {
      flex: 4 1 auto;
    }

    .d-select {
      flex: 1 1 auto;
      width: auto;
      height: auto;
    }
  }

  &__no-results {
    display: flex;
    flex-direction: column;
    text-align: center;
    justify-content: center;
    padding: var(--space-6);
    gap: var(--space-2);

    h3 {
      font-weight: normal;
    }

    .btn {
      align-self: center;
    }
  }

  &.--layout-table {
    .--card-label {
      display: none;
    }
  }

  &.--layout-card {
    tbody {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(18em, 1fr));
      gap: var(--space-4);
      border: none;
    }

    thead {
      display: none;
    }

    .d-admin-row__content {
      display: grid;
      grid-template-rows: auto 1fr auto auto;
      grid-template-columns: 1fr auto;
      border: 1px solid var(--primary-low);
      padding: var(--space-2) var(--space-4) var(--space-4);
      border-radius: var(--d-border-radius);

      .d-admin-row__overview,
      .ai-persona-list__name-with-description {
        display: contents;
      }

      .ai-persona-list__name {
        grid-row: 1;
        grid-column: 1;
        font-size: var(--font-up-1);
        display: inline;
        align-self: center;

        .avatar {
          height: 1.25em;
          position: relative;
          bottom: 0.15em;
        }
      }

      .ai-persona-list__description {
        grid-row: 2;
        grid-column: 1;
        margin: var(--space-2) 0;
      }

      .d-admin-row__controls {
        grid-row: 1;
        grid-column: 2;
      }

      .d-admin-row__features {
        grid-row: 4;
        grid-column: 1 / span 2;
        padding: 0;

        .btn {
          margin-top: var(--space-0);
        }
      }

      .d-admin-row__llms {
        grid-row: 3;
        grid-column: 1 / span 2;
        padding: 0;

        .btn {
          margin-top: var(--space-2);
        }
      }

      .--card-label {
        color: var(--primary-high);
        font-size: var(--font-down-1);
      }
    }
  }

  .ai-persona-list {
    &__row-item-feature {
      padding: 0;
      text-align: left;
    }

    &__description {
      color: var(--primary-high);
    }

    &__name {
      display: flex;
      align-items: center;
      gap: var(--space-1);
      font-size: var(--font-up-0);
      color: var(--primary);
      margin: 0;
      padding: 0;
      line-height: var(--line-height-medium);

      .avatar {
        width: auto;
        height: 1.25em;
      }
    }

    &__row {
      &:hover {
        background: transparent;
      }

      &__overview {
        padding-left: var(--space-2);
      }
    }
  }

  .d-admin-row__row-feature-list {
    color: var(--primary-medium);
  }
}

.ai-persona-tool-option-editor {
  &__instructions {
    color: var(--primary-medium);
    font-size: var(--font-down-1);
    line-height: var(--line-height-large);
  }
}

.ai-personas__container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ai-persona-editor {
  padding-left: 0.5em;

  &__tool-options {
    padding: 1em;
    border: 1px solid var(--primary-low-mid);
    width: 480px;
  }

  &__tool-options-name {
    margin-bottom: 10px;
    font-size: var(--font-down-1);
  }

  &__response-format {
    width: 100%;
    display: block;
  }

  &__response-format-pre {
    margin-bottom: 0;
    white-space: pre-line;
  }

  &__response-format-none {
    margin-bottom: 1em;
    margin-top: 0.5em;
  }
}

.rag-options {
  &__indexing-options {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
  }
}

.rag-uploader {
  &__search-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--primary-400);
    width: 100%;
    box-sizing: border-box;
    height: 35px;
    padding: 0 0.5rem;

    &:focus,
    &:focus-within {
      @include default-focus;
    }

    &-container {
      display: flex;
      flex-grow: 1;
    }

    &__search-icon {
      background: none !important;
      color: var(--primary-medium);
    }

    &__input {
      width: 100% !important;
    }

    &__input,
    &__input:focus {
      margin: 0 !important;
      border: 0 !important;
      appearance: none !important;
      outline: none !important;
      background: none !important;
    }
  }

  &__uploads-list {
    &:has(tr) {
      margin-bottom: 20px;
    }

    tbody {
      border-top: none;
    }
  }

  &__upload-status {
    text-align: right;
    padding-right: 0;

    .indexed {
      color: var(--success);
    }

    .uploaded,
    .indexing {
      color: var(--primary-low-mid);
    }
  }

  &__remove-file {
    text-align: right;
    padding-left: 0;
  }

  &__rag-file-icon {
    margin-right: 5px;
  }

  .hidden-upload-field {
    visibility: hidden;
    position: absolute;
  }
}
