@use 'apps/dashboard/src/variables' as *;
@use '../select-account.tokens' as tokens;

:host {
  height: 100%;
}

.select-kb {
  display: flex;
  flex-direction: column;
  height: 100%;

  .select-kb-header {
    border-bottom: 1px solid $color-neutral-regular;
    display: flex;
    flex: 0 0 auto;
    justify-content: space-around;
    padding-bottom: rhythm(1);
    position: relative;

    .select-kb-title {
      flex: 1 0 auto;
      margin-bottom: 0;
      max-width: calc(100% - #{rhythm(20)});
      text-align: center;
    }

    .select-kb-back,
    .manage-account-button {
      bottom: rhythm(0.5);
      position: absolute;
    }

    .select-kb-back {
      left: 0;
    }

    .manage-account-button {
      right: 0;
    }
  }

  .select-kb-body {
    flex: 1 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    // Move scrollbar to the edge
    padding: 0 rhythm(2);
    margin: 0 -#{rhythm(2)};
    max-height: calc(#{tokens.$height-page-container} - #{tokens.$vertical-padding} * 4 - #{rhythm(9)});
    @include scrollbar-black();
  }

  .select-kb-footer {
    display: flex;
    gap: rhythm(2);
    justify-content: center;
    padding: rhythm(6) 0;
  }

  .kb {
    align-items: center;
    border-bottom: 1px solid $color-border-menu-separator;
    color: inherit;
    cursor: pointer;
    display: flex;
    height: rhythm(5);
    justify-content: space-between;
    position: relative;
    text-decoration: none;
    transition: background-color $transition-hint;
    width: 100%;

    &.disabled {
      cursor: default;
      color: $color-text-menu-option-disabled;
      pointer-events: none;
    }
    .delete-btn {
      opacity: 0;
      position: absolute;
      top: 50%;
      left: rhythm(1.5);
      transform: translateY(-50%);
      transition: opacity $transition-hint;
    }

    &:hover {
      background-color: $color-background-menu-option-hover;
      .delete-btn {
        opacity: 1;
      }
    }

    .kb-title {
      flex: 1;
      text-align: center;
    }

    pa-icon {
      padding: 0 rhythm(1);
    }
  }

  .select-kb-empty {
    text-align: center;
    .select-kb-empty-message {
      margin-top: rhythm(6);
      font-style: italic;
    }
    pa-button {
      margin-top: rhythm(6);
    }
  }

  .select-kb-input {
    padding: rhythm(2) 0;
  }
  &-error {
    margin-top: 12px;
    font-weight: var(--stf-font-weight-semibold);
    color: var(--stf-primary);
    text-align: center;
  }
}
