@charset "UTF-8";
@import "./common/var.css";
@import './mixins/button';

@component-namespace el {

  @b radio {
    color: var(--radio-color);
    position: relative;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
    @utils-user-select none;

    & + .el-radio {
      margin-left: 15px;
    }
    
    @e input {
      white-space: nowrap;
      cursor: pointer;
      outline: none;
      display: inline-block;
      line-height: 1;
      position: relative;
      vertical-align: middle;

      @when disabled {
        .el-radio__inner {
          background-color: var(--radio-disabled-input-fill);
          border-color: var(--radio-disabled-input-border-color);
          cursor: not-allowed;

          &::after {
            cursor: not-allowed;
            background-color: var(--radio-disabled-icon-color);
          }

          & + .el-radio__label {
            cursor: not-allowed;
          }
        }
        &.is-checked {
          .el-radio__inner {
            background-color: var(--radio-disabled-checked-input-fill);
            border-color: var(--radio-disabled-checked-input-border-color);

            &::after {
              background-color: var(--radio-disabled-checked-icon-color);
            }
          }
        }
        & + .el-radio__label {
          color: var(--disabled-color-base);
          cursor: not-allowed;
        }
      }

      @when checked {
        .el-radio__inner {
          border-color: var(--radio-checked-input-border-color);
          background: var(--radio-checked-icon-color);

          &::after {
            transform: translate(-50%, -50%) scale(1);
          }
        }
      }

      @when focus {
        .el-radio__inner {
          border-color: var(--radio-input-border-color-hover);
        }
      }
    }
    @e inner {
      border: var(--radio-input-border);
      border-radius: var(--radio-input-border-radius);
      circle: var(--radio-input-width) var(--radio-input-fill);
      position: relative;
      cursor: pointer;
      display: inline-block;
      box-sizing: border-box;

      &:hover {
        border-color: var(--radio-input-border-color-hover);
      }

      &::after {
        circle: 6px var(--color-white);
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) scale(0);
        transition: transform .15s cubic-bezier(.71,-.46,.88,.6);
      }
    }

    @e original {
      opacity: 0;
      outline: none;
      position: absolute;
      z-index: -1;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: 0;
    }

    @e label {
      font-size: var(--radio-font-size);
      padding-left: 5px;
    }
  }

  @b radio-group {
    display: inline-block;
    font-size: 0;
    line-height: 1;

    & .el-radio {
      font-size: var(--radio-font-size);
    }

  }
  @b radio-button {
    position: relative;
    display: inline-block;

    @e inner {
      display: inline-block;
      line-height: 1;
      white-space: nowrap;
      vertical-align: middle;
      cursor: pointer;
      background: var(--button-default-fill);
      border: var(--border-base);
      border-left: 0;
      color: var(--button-default-color);
      -webkit-appearance: none;
      text-align: center;
      box-sizing: border-box;
      outline: none;
      margin: 0;
      position: relative;
      cursor: pointer;
      transition: var(--all-transition);
      @utils-user-select none;

      @mixin button-size var(--button-padding-vertical), var(--button-padding-horizontal), var(--button-font-size), 0;

      &:hover {
        color: var(--color-primary);
      }

      & [class*="el-icon-"] {
        line-height: 0.9;

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

    @e orig-radio {
      opacity: 0;
      outline: none;
      position: absolute;
      z-index: -1;
      left: -999px;

      &:checked {
        & + .el-radio-button__inner {
          color: var(--radio-button-checked-color);
          background-color: var(--radio-button-checked-fill);
          border-color: var(--radio-button-checked-border-color);
          box-shadow: -1px 0 0 0 var(--radio-button-checked-border-color);
        }
      }

      &:disabled {
        & + .el-radio-button__inner {
          color: var(--button-disabled-color);
          cursor: not-allowed;
          background-image: none;
          background-color: var(--button-disabled-fill);
          border-color: var(--button-disabled-border);
        }
      }
    }

    &:first-child {
      .el-radio-button__inner {
        border-left: var(--border-base);
        border-radius: var(--border-radius-base) 0 0 var(--border-radius-base);
        box-shadow: none !important;
      }
    }
    &:last-child {
      .el-radio-button__inner {
        border-radius: 0 var(--border-radius-base) var(--border-radius-base) 0;
      }
    }
    @m large {
      & .el-radio-button__inner {
        @mixin button-size var(--button-large-padding-vertical), var(--button-large-padding-horizontal), var(--button-large-font-size), 0;
      }
    }
    @m small {
      & .el-radio-button__inner {
        @mixin button-size var(--button-small-padding-vertical), var(--button-small-padding-horizontal), var(--button-small-font-size), 0;
      }
    }
    @m mini {
      & .el-radio-button__inner {
        @mixin button-size var(--button-mini-padding-vertical), var(--button-mini-padding-horizontal), var(--button-mini-font-size), 0;
      }
    }
  }
}
