/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';
@import './vars.less';

@radio-button-prefix-cls: ~'@{css-prefix}radio-button';

.@{radio-button-prefix-cls} {
  .inject-RadioButton-vars();
  border-radius: var(--tv-RadioButton-border-radius);

  &,
  &__inner {
    display: inline-block;
    position: relative;
    outline: 0;
    margin-right: 2px;
  }

  &__inner {
    color: var(--tv-RadioButton-text-color);
    font-size: var(--tv-RadioButton-font-size);
    background: var(--tv-RadioButton-bg-color);
    border: 1px solid var(--tv-RadioButton-border-color);
    padding: 5px 24px;
    font-weight: 500;
    border-radius: var(--tv-RadioButton-border-radius);
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
    appearance: none;
    text-align: center;
    box-sizing: border-box;
    margin: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);

    &.is-round {
      padding: 12px 20px;
    }

    &:hover {
      background-color: var(--tv-RadioButton-checked-hover-bg-color);
      outline: 0;
    }

    [class*='tiny-icon'] {
      line-height: 0.9;

      & + span {
        margin-left: 5px;
      }
    }
  }

  &__orig-radio {
    opacity: 0;
    outline: 0;
    position: absolute;
    z-index: -1;

    &:checked {
      & + .@{radio-button-prefix-cls}__inner {
        color: #fff;
        background-color: var(--tv-RadioButton-checked-bg-color);
      }
    }

    &:disabled {
      & + .@{radio-button-prefix-cls}__inner {
        color: var(--tv-RadioButton-disabled-text-color);
        border-color: var(--tv-RadioButton-border-color);
        background-color: var(--tv-RadioButton-disabled-bg-color);
        background-image: none;
        box-shadow: none;
        cursor: not-allowed;
      }
    }

    &:disabled:checked {
      & + .@{radio-button-prefix-cls}__inner {
        background-color: var(--tv-RadioButton-checked-disabled-bg-color);
        color: var(--tv-RadioButton-disabled-checked-text-color);
      }
    }
  }

  &--default &__inner {
    display: flex;
    align-items: center;
    height: var(--tv-RadioButton-size-height-md);
    padding: 5px 24px;

    &.is-round {
      padding: 10px 20px;
    }
  }

  &--medium &__inner {
    display: flex;
    align-items: center;
    height: var(--tv-RadioButton-size-height-md);
    padding: 5px 24px;

    &.is-round {
      padding: 10px 20px;
    }
  }

  &--small &__inner {
    font-size: 12px;
    display: flex;
    align-items: center;
    height: var(--tv-RadioButton-size-height-sm);
    padding: 5px 24px;

    &.is-round {
      padding: 9px 15px;
    }
  }

  &--mini &__inner {
    font-size: 12px;
    display: flex;
    align-items: center;
    height: var(--tv-RadioButton-size-height-xs);
    padding: 3px 16px;
    border-radius: 4px;

    &.is-round {
      padding: 7px 15px;
    }
  }

  &.is-active.is-disabled {
    color: var(--tv-RadioButton-disabled-checked-text-color);
    background-color: var(--tv-RadioButton-checked-disabled-bg-color);
  }
}
