@use "sass:color";
@use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
@use "../../../styles/mixins/scrollbar" as scrollbar;
@use "../../../styles/mixins/text" as text;

.read-receipt-info {
  display: flex;
  flex-direction: column;
  height: 480px;
  overflow: hidden;

  &__header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 10%);
  }

  &__title {
    font-size: 16px;
    font-weight: 500;

    @include theme() {
      color: get(text-color-primary);
    }
  }

  &__close-icon {
    position: absolute;
    left: 16px;
    cursor: pointer;

    @include theme() {
      color: get(text-color-secondary);

      &:hover {
        color: get(text-color-primary);
      }
    }
  }

  &__tabs {
    height: 48px;
    display: flex;
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 10%);
  }

  &__tab-button {
    flex: 1;
    height: 100%;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    padding: 0;

    @include theme() {
      color: get(text-color-secondary);

      &:hover {
        color: get(text-color-primary);
      }

      &:focus {
        outline: none;
      }
    }

    &--active {
      @include theme() {
        color: get(text-color-link);
        font-weight: 500;

        &::after {
          content: "";
          position: absolute;
          bottom: 0;
          left: 50%;
          transform: translateX(-50%);
          width: 40px;
          height: 2px;
          background-color: get(text-color-link);
        }
      }
    }
  }

  &__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  &__user-list {
    flex: 1;
    overflow-y: auto;

    @include scrollbar.scrollbar-default();
  }

  &__user-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: opacity 0.3s ease, transform 0.3s ease;

    &:not(:last-child) {
      margin-bottom: 4px;
    }

    @include theme() {
      &:hover {
        background-color: rgba(0, 0, 0, 3%);
      }
    }

    &-info {
      flex: 1;
      min-width: 0;
    }

    &-name {
      font-size: 14px;
      line-height: 20px;

      @include text.text-ellipsis;

      @include theme() {
        color: get(text-color-primary);
      }
    }
  }

  &__user-list-container {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;

    &--visible {
      opacity: 1;
      transform: translateY(0);
    }
  }

  &__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 0;

    &-icon {
      animation: read-receipt-info-spin 1s linear infinite;

      @include theme() {
        color: get(text-color-link);
      }
    }

    &-text {
      margin-top: 8px;
      font-size: 14px;

      @include theme() {
        color: get(text-color-secondary);
      }
    }
  }

  &__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    font-size: 14px;

    @include theme() {
      color: get(text-color-secondary);
    }
  }

  &__list-end {
    text-align: center;
    padding: 12px 0;
    font-size: 12px;

    @include theme() {
      color: get(text-color-secondary);
    }
  }
}

@keyframes read-receipt-info-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
