@import '../index.less';
@btri-radio-group: ~'@{ant-prefix}-btri-radio-group';
@btri-radio-button: ~'@{ant-prefix}-btri-radio-button';
@btri-radio: ~'@{ant-prefix}-btri-radio';

.@{btri-radio} {
  &-box {
    .@{ant-prefix}-radio-checked:not(.@{ant-prefix}-radio-disabled) {
      .@{ant-prefix}-radio-inner {
        background: linear-gradient(var(--primary-5), var(--primary-6));
        border-width: 0px;
        &::after {
          background-color: var(--white);
        }
      }
    }
    .@{ant-prefix}-radio-checked.@{ant-prefix}-radio-disabled {
      // 只读的文字颜色
      & + span {
        color: var(--caption-font);
      }
      .@{ant-prefix}-radio-inner {
        background: var(--gray-2);
        background-color: var(--gray-2);
      }
    }
    .@{ant-prefix}-radio-inner {
      border-color: var(--gray-3);
      border-width: 1px;
    }
    .@{ant-prefix}-radio-disabled {
      .@{ant-prefix}-radio-inner {
        border-color: var(--gray-3) !important;
        border-width: 1px;
      }
    }
    .@{ant-prefix}-radio-wrapper:hover .@{ant-prefix}-radio,
    .@{ant-prefix}-radio:hover .@{ant-prefix}-radio-inner,
    .@{ant-prefix}-radio-input:focus + .@{ant-prefix}-radio-inner {
      border-color: var(--primary-6);
      border-width: 1px;
    }
  }
}

// 默认白底蓝字
.@{btri-radio-button}-box {
  &.@{ant-prefix}-radio-button-wrapper-checked:not(
      .@{ant-prefix}-radio-button-wrapper-disabled
    ) {
    border-color: var(--primary-6);
    box-shadow: none;
    &::before {
      background-color: var(--primary-6);
    }
    .@{ant-prefix}-btri-radio-button-ctx-font,
    .@{ant-prefix}-btri-radio-button-ctx-icon-font,
    .@{ant-prefix}-btri-radio-button-ctx-icon {
      color: var(--primary-6);
    }
  }
  &.@{ant-prefix}-radio-button-wrapper {
    padding: 0 16px;
    &:hover {
      color: var(--primary-6);
    }
    &:not(.@{ant-prefix}-radio-button-wrapper-checked) {
      border-color: var(--gray-blue-6);
    }
  }
  &.@{ant-prefix}-radio-button-wrapper-disabled {
    color: var(--disable-font);
    background-color: var(--bg-2);
    &.@{ant-prefix}-radio-button-wrapper-checked {
      background-color: var(--white);
      color: var(--primary-3);
      border-color: var(--primary-3);
      &::before {
        background-color: var(--primary-3);
      }
    }
    &:hover {
      color: var(--disable-font);
      background-color: var(--bg-2);
    }
    .i-icon {
      font-size: 18px;
    }
  }
}
.@{btri-radio-group}-outline {
  .@{ant-prefix}-radio-button-wrapper-checked:not(
      .@{ant-prefix}-radio-button-wrapper-disabled
    ) {
    border-color: var(--primary-6);
    color: var(--primary-3);
  }

  .@{ant-prefix}-radio-button-wrapper {
    &:not(:first-child):not(
        .@{ant-prefix}-radio-button-wrapper-checked
      )::before {
      background-color: var(--gray-blue-6);
    }
  }

  // 选中禁用
  .@{ant-prefix}-radio-button-wrapper-disabled {
    &:first-child {
      background-color: var(--white);
    }
    &.@{ant-prefix}-radio-button-wrapper-checked {
      border-color: var(--primary-3);
      color: var(--primary-3);
      & + .@{ant-prefix}-radio-button-wrapper::before {
        background-color: var(--primary-3);
      }
    }
  }
}

.@{btri-radio-group}-box {
  &.@{ant-prefix}-radio-group {
    display: inline-flex;

    .@{ant-prefix}-radio-button-wrapper {
      display: flex;
      align-items: center;
    }
    &.@{ant-prefix}-radio-group-large .@{ant-prefix}-radio-button-wrapper {
      padding: 0 24px;
    }
    &.@{ant-prefix}-radio-group-small .@{ant-prefix}-radio-button-wrapper {
      padding: 0 8px;
    }
  }

  // // 边框型——蓝底白字
  &.@{btri-radio-group}-secondaryOutline {
    .@{ant-prefix}-radio-button-wrapper-checked:not(
        .@{ant-prefix}-radio-button-wrapper-disabled
      ) {
      background-color: var(--primary-6);
      color: var(--white);
      .@{ant-prefix}-btri-radio-button-ctx-font,
      .@{ant-prefix}-btri-radio-button-ctx-icon-font,
      .@{ant-prefix}-btri-radio-button-ctx-icon {
        color: var(--white);
      }
    }

    .@{ant-prefix}-radio-button-wrapper {
      &:not(:first-child):not(
          .@{ant-prefix}-radio-button-wrapper-checked
        )::before {
        background-color: var(--gray-blue-6);
      }
    }

    // 选中禁用
    .@{ant-prefix}-radio-button-wrapper-disabled {
      &:first-child {
        background-color: var(--white);
      }
      &.@{ant-prefix}-radio-button-wrapper-checked {
        border-color: var(--primary-3);
        color: var(--white);
        background-color: var(--primary-3);
        & + .@{ant-prefix}-radio-button-wrapper::before {
          background-color: var(--primary-3);
        }
      }
    }
  }

  // 填充型——蓝底白字
  &.@{btri-radio-group}-solid {
    padding: 2px;
    background-color: var(--gray-2);
    border-radius: 4px;
    gap: 2px;
    .@{ant-prefix}-radio-button-wrapper {
      background-color: var(--gray-2);
    }
    .@{ant-prefix}-radio-button-wrapper:not(
        .@{ant-prefix}-radio-button-wrapper-disabled
      ) {
      border-color: transparent !important;
      box-shadow: none;

      &::before {
        background-color: transparent;
      }
    }
    .@{ant-prefix}-radio-button-wrapper {
      border-radius: 4px;
      height: 28px;
    }
    &.@{ant-prefix}-radio-group-large .@{ant-prefix}-radio-button-wrapper {
      height: 36px;
    }
    &.@{ant-prefix}-radio-group-small .@{ant-prefix}-radio-button-wrapper {
      border-radius: 2px;
      height: 20px;
    }
    .@{ant-prefix}-radio-button-wrapper-checked {
      background-color: var(--primary-6);
    }

    .@{ant-prefix}-radio-button-wrapper-checked:not(
        .@{ant-prefix}-radio-button-wrapper-disabled
      ) {
      background-color: var(--primary-6);
      .@{ant-prefix}-btri-radio-button-ctx-font,
      .@{ant-prefix}-btri-radio-button-ctx-icon-font,
      .@{ant-prefix}-btri-radio-button-ctx-icon {
        color: var(--white);
      }
    }
    .@{ant-prefix}-radio-button-wrapper-checked.@{ant-prefix}-radio-button-wrapper-disabled {
      background-color: var(--primary-3);
      color: var(--white);
    }

    .@{ant-prefix}-radio-button-wrapper-disabled {
      color: var(--disable-font);
      border: none;
      &::before {
        background-color: var(--gray-2);
      }
    }
  }

  // 填充型——白底蓝字
  &.@{btri-radio-group}-secondarySolid {
    padding: 2px;
    background-color: var(--gray-2);
    border-radius: 4px;
    gap: 2px;
    &.@{ant-prefix}-radio-group-large .@{ant-prefix}-radio-button-wrapper {
      height: 36px;
    }
    &.@{ant-prefix}-radio-group-small .@{ant-prefix}-radio-button-wrapper {
      border-radius: 2px;
      height: 20px;
    }
    .@{ant-prefix}-radio-button-wrapper-checked {
      background-color: var(--bg-2);
    }
    .@{ant-prefix}-radio-button-wrapper {
      border-radius: 4px;
      background-color: var(--gray-2);
      height: 28px;
    }
    .@{ant-prefix}-radio-button-wrapper.@{ant-prefix}-radio-button-wrapper-checked {
      background-color: var(--bg-2);
    }
    .@{ant-prefix}-radio-button-wrapper-checked:not(
        .@{ant-prefix}-radio-button-wrapper-disabled
      ) {
      .@{ant-prefix}-btri-radio-button-ctx-font,
      .@{ant-prefix}-btri-radio-button-ctx-icon-font,
      .@{ant-prefix}-btri-radio-button-ctx-icon {
        color: var(--primary-6);
      }
    }
    .@{ant-prefix}-radio-button-wrapper:not(
        .@{ant-prefix}-radio-button-wrapper-disabled
      ) {
      border-color: transparent !important;
      box-shadow: none;
      &::before {
        background-color: transparent;
      }
    }
    .@{ant-prefix}-radio-button-wrapper-disabled {
      color: var(--disable-font);
      background-color: var(--gray-2);
      border: none;
      &::before {
        background-color: var(--gray-2);
      }
    }
  }

  // 默认间距
  .@{btri-radio-button}-ctx-icon-font {
    gap: 4px;
  }

  &.@{ant-prefix}-radio-group-large {
    .@{btri-radio-button}-ctx-icon-font {
      gap: 6px;
    }
    .i-icon {
      font-size: 20px;
    }
  }
  &.@{ant-prefix}-radio-group-small {
    .@{btri-radio-button}-ctx-icon-font {
      gap: 2px;
    }
    .i-icon {
      font-size: 16px;
    }
  }
}
