@import '../../../../lib/style/themes/default';
@import '../../../../lib/style/mixins/index';
@import 'mixin';

@pro-radio-prefix-cls: ~'@{c7n-pro-prefix}-radio';
@radio-duration: @animation-duration-slow;

.@{pro-radio-prefix-cls} {
  .radio-btn;

  &-wrapper,
  &-wrapper.@{field-prefix-cls} {
    display: inline-flex;
  }

  &-wrapper.@{field-prefix-cls} {
    width: auto;
  }

  &-inner {
    position: relative;
    display: inline-block;
    width: @radio-size;
    height: @radio-size;
    vertical-align: middle;
    background-color: #fff;
    border: @radio-border-width @border-style-base @radio-border-color;
    border-radius: 50%;
    transition: all @radio-duration;

    &::before {
      position: absolute;
      // top: @radio-dot-distance;
      // left: @radio-dot-distance;
      width: @radio-dot-size;
      height: @radio-dot-size;
      inset: 0;
      margin: auto;
      background-color: @radio-dot-color;
      border-radius: 50%;
      transform: scale(0);
      opacity: 0;
      transition: all @radio-duration @ease-in-out-circ;
      content: ' ';
    }

    & + span {
      padding-right: 0.08rem;
      padding-left: 0.08rem;
    }
  }

  &&:checked + &-inner {
    border-color: @radio-check-border-color;
    border-width: @radio-check-border-width;

    &::before {
      background-color: @radio-check-dot-color;
      transform: scale(1);
      opacity: 1;
    }
  }

  &&:hover:not(:checked) + &-inner,
  &-wrapper:hover &&:not(:checked) + &-inner,
  &&:focus:not(:checked) + &-inner {
    border-color: @radio-uncheck-hover-border-color;

    &::before {
      background-color: @radio-uncheck-hover-border-color;
    }
  }

  &-highlight &-inner {
    border-color: @input-highlight-border-color;
  }

  &-highlight &&:checked + &-inner {
    border-color: @input-highlight-border-color;

    &::before {
      background-color: @radio-highlight-check-dot-color;
    }
  }

  &&:focus + &-inner {
    box-shadow: 0 0 @outline-blur-size @outline-width @radio-shadow-color;
  }

  &&:disabled + &-inner {
    color: @radio-disabled-color;
    background-color: @radio-disabled-bg;
    border-color: @radio-disabled-border-color !important;

    &::before {
      background-color: @radio-disabled-color;
    }
  }

  &&:disabled:checked + &-inner {
    color: @radio-disabled-check-color;
    background-color: @radio-disabled-check-bg;
    border-color: @radio-disabled-check-border-color !important;

    &::before {
      background-color: @radio-disabled-check-color;
    }
  }

  &-label {
    flex-basis: 0;
    flex-grow: 1;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &-button {
    min-width: @radio-button-min-width;
    padding: @radio-button-padding;
    line-height: @radio-button-line-height;
    text-align: center;
    background-color: #fff;

    .@{pro-radio-prefix-cls}-inner {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      width: auto;
      height: auto;
      background-color: transparent;
      border-radius: @radio-button-radius;

      &::before {
        display: none;
      }

      & + span {
        position: relative;
        z-index: 1;
        padding: 0;
      }
    }

    .@{pro-radio-prefix-cls}:not(:disabled):checked + .@{pro-radio-prefix-cls}-inner {
      z-index: 1;
      background-color: @radio-button-check-bg;

      & + span {
        color: @radio-button-check-color;
      }
    }

    &:not(.@{pro-radio-prefix-cls}-disabled):hover .@{pro-radio-prefix-cls}-inner + span {
      color: @radio-dot-color;
    }
  }

  &-wrapper&-button &:checked + &-inner {
    border-width: @radio-button-check-border-width;
  }

  &-wrapper&-button &:disabled:checked + &-inner {
    background-color: @radio-button-disabled-check-bg;
    border-color: @radio-button-disabled-check-border-color !important;
    + span {
      color: @radio-button-disabled-check-color;
    }
  }

  &-button + &-button {
    margin-left: @btn-group-spacing;
  }
}
