@use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;

@mixin panel($block) {
  .#{$block} {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 120px 0;
    box-sizing: border-box;
    max-width: 400px;
    margin: 0 auto;

    @include theme() {
      background-color: get(bg-color-topbar);
    }
  }

  .#{$block}__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    padding-bottom: 22px;

    @include theme() {
      border-bottom: 1px solid get(stroke-color-module);
    }
  }

  .#{$block}__main-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
  }

  .#{$block}__name {
    font-size: 18px;
    line-height: 26px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

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

  .#{$block}__id {
    font-size: 14px;
    line-height: 18px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

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

  .#{$block}__intro {
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;

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

  .#{$block}__avatar-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .#{$block}__rows {
    padding-top: 12px;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 20px;
    row-gap: 18px;
    align-items: start;
  }

  .#{$block}__row {
    display: contents;
  }

  .#{$block}__row-label {
    font-size: 16px;
    line-height: 1.8;
    font-weight: 400;
    min-width: 0;

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

  .#{$block}__row-value {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    word-break: break-word;
    font-size: 16px;
    line-height: 1.8;

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

  .#{$block}__row--center > .#{$block}__row-label,
  .#{$block}__row--center > .#{$block}__row-value {
    align-self: center;
  }

  .#{$block}__form,
  .#{$block}__status {
    margin-top: 28px;
  }

  .#{$block}__actions {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
  }

  .#{$block}__button--primary {
    flex: 1;
  }

  .#{$block}__button--secondary {
    flex: 1;
  }
}

@mixin form($block) {
  .#{$block}__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .#{$block}__form-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .#{$block}__form-label {
    font-size: 15px;
    line-height: 1.6;

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

  .#{$block}__form-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid;
    border-radius: 18px;
    overflow: hidden;

    @include theme() {
      background-color: get(bg-color-operate);
      border-color: get(stroke-color-secondary);
    }
  }

  .#{$block}__form-input {
    width: 100%;
    min-height: 112px;
    padding: 16px 18px 34px;
    border: none;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    overflow-y: auto;

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

    &:focus {
      outline: none;
    }

    &::placeholder {
      @include theme() {
        color: get(text-color-tertiary);
      }
    }
  }

  .#{$block}__form-counter {
    position: absolute;
    bottom: 10px;
    right: 16px;
    font-size: 12px;

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

@mixin status($block) {
  .#{$block}__status {
    padding: 0;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
  }

  .#{$block}__status--success {
    @include theme() {
      background-color: get(success-color-bg);
      color: get(text-color-success);
    }
  }

  .#{$block}__status--error {
    @include theme() {
      background-color: get(error-color-bg);
      color: get(text-color-error);
    }
  }
}
