$prefix: "adui-radio";

.#{$prefix}-base {
  display: inline-block;
  font-size: var(--font-size-medium);
  line-height: 36px;

  &:not(.#{$prefix}-disabled) {
    cursor: pointer;

    &:not(.#{$prefix}-checked) {
      &:hover {
        .#{$prefix}-indicator {
          background-color: var(--gray-100);
          box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1), 0 0 0 1px var(--gray-600);
        }

        &:active {
          .#{$prefix}-indicator {
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1),
              0 0 0 1px var(--primary-color);
          }
        }
      }
    }

    &.#{$prefix}-checked {
      &:not([data-actived="true"]) {
        &:active {
          .#{$prefix}-indicator {
            animation: none;
          }
        }

        .#{$prefix}-indicator {
          animation: aduiCheckboxIndicatorScale ease
            var(--adui-motion-duration-base) both;

          @keyframes aduiCheckboxIndicatorScale {
            0% {
              transform: scale(1, 1);
            }
            60% {
              transform: scale(1.05, 1.05);
            }
            100% {
              transform: scale(1, 1);
            }
          }

          &::after {
            transition: transform var(--adui-motion-duration-bounce)
              var(--adui-motion-ease-bounce);
          }
        }
      }

      &:hover {
        &:active {
          &[data-actived="true"] {
            .#{$prefix}-indicator {
              &::after {
                transform: scale(0.8);
              }
            }
          }
        }
      }

      .#{$prefix}-indicator {
        background-color: var(--primary-color);
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1),
          0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--primary-color);

        &::after {
          transform: scale(1);
        }
      }
    }
  }

  &.#{$prefix}-disabled {
    cursor: not-allowed;
    color: var(--gray-700);

    .#{$prefix}-indicator {
      background-color: rgba(0, 0, 0, 0.03);
      box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    }

    &.#{$prefix}-checked {
      .#{$prefix}-indicator {
        &::after {
          background-color: var(--gray-600);
          transform: scale(1);
        }
      }
    }
  }

  &.#{$prefix}-noChildren {
    .#{$prefix}-indicator {
      margin-right: 0;
    }
  }
}
.#{$prefix}-indicator {
  position: relative;
  display: inline-block;
  vertical-align: calc(-0.125em - (16px - var(--font-size-medium)) / 2);
  margin-right: 6px;
  width: 16px;
  height: 16px;
  line-height: 1;
  background-color: var(--gray-50);
  border-radius: 100%;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1), 0 0 0 1px var(--gray-500);
  transition: background-color var(--adui-motion-duration-base)
      var(--adui-motion-ease-base),
    box-shadow var(--adui-motion-duration-base) var(--adui-motion-ease-base);

  &::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -3px;
    margin-left: -3px;
    width: 6px;
    height: 6px;
    background-color: #fff;
    border-radius: 100%;
    transform: scale(0);
    transition: transform var(--adui-motion-duration-base)
      var(--adui-motion-ease-base);
  }
}
.#{$prefix}-helper {
  margin-left: 4px;
  vertical-align: -4px;
}
.#{$prefix}-large {
  font-size: var(--font-size-large);
  line-height: 42px;

  .#{$prefix}-indicator {
    vertical-align: calc(-0.125em - (18px - var(--font-size-large)) / 2);
    margin-right: 8px;
    width: 18px;
    height: 18px;
  }

  .#{$prefix}-helper {
    vertical-align: -1px;
  }
}

.#{$prefix}-small {
  font-size: var(--font-size-small);
  line-height: 30px;

  .#{$prefix}-indicator {
    margin-right: 4px;
    vertical-align: calc(-0.125em - (14px - var(--font-size-small)) / 2);
    width: 14px;
    height: 14px;
  }

  .#{$prefix}-helper {
    vertical-align: -4px;
  }
}

.#{$prefix}-mini {
  font-size: var(--font-size-mini);
  line-height: 26px;

  .#{$prefix}-indicator {
    margin-right: 4px;
    vertical-align: calc(-0.125em - (14px - var(--font-size-mini)) / 2);
    width: 14px;
    height: 14px;
  }

  .#{$prefix}-helper {
    vertical-align: -4px;
  }
}

/**
 * Radio.Group
 */
.#{$prefix}-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  .#{$prefix}-base {
    &:not(:last-of-type) {
      &.#{$prefix}-mini {
        margin-right: 12px;
      }

      &.#{$prefix}-small {
        margin-right: 16px;
      }

      &.#{$prefix}-medium {
        margin-right: 20px;
      }

      &.#{$prefix}-large {
        margin-right: 24px;
      }
    }
  }
}
