@import "./var";
// radio button
.#{$prefix}radio-wrap{
    display: inline-block;
    font-size: 0;
}

.#{$prefix}radio,
input[type=radio] {
    width: $radio-width;
    height: $radio-height;
    cursor: pointer;
    vertical-align: middle;
    outline: none;
    -webkit-appearance: none;
    border: 1px solid $radio-border-color;
    border-radius: 100%;
    background-position: inherit;
    background-color: $radio-bg-color;
    color:$radio-text-color;
}

.#{$prefix}radio-wrap:hover .#{$prefix}radio,
.#{$prefix}radio:hover,
.#{$prefix}radio:focus,
input[type=radio]:hover,
input[type=radio]:focus {
    border-color: $radio-border-color-hover;
    background-position: inherit;
}

.#{$prefix}radio:checked,
input[type=radio]:checked {
    // background-image: url(../../assets/image/slice/svg/radio.svg);
    background-color: $radio-bg-color-checked;
    border: 1px solid $radio-border-color-checked;
}
.#{$prefix}radio:checked::-ms-check,
input[type=radio]:checked::-ms-check {
    background-color: $radio-bg-color-checked;
    border          : 1px solid $radio-border-color-checked;
}
// 用节点代替之前的背景图。没有用父级的伪类是为了不增加新的的控制状态的类名
.#{$prefix}radio + .#{$prefix}radio__dot, 
input[type=radio] + .#{$prefix}radio__dot {
    display         : block;
    background-color: transparent;
    width           : 8px;
    height          : 8px;
    border-radius   : 100%;
    position        : absolute;
    top             : 50%;
    left            : 50%;
    margin          : -4px;
    cursor: pointer;
}
.#{$prefix}radio:checked+.#{$prefix}radio__dot,
input[type=radio]:checked+.#{$prefix}radio__dot{
    background-color: $radio-dot-bg-color;
}

// .tea-radio:checked + .tea-radio__dot,
// input[type=radio]:checked + .tea-radio__dot{
//     content: "";
//     display: block;
//     width:8px;
//     height: 8px;
//     background-color: #fff;
//     border-radius: 100%;
//     position: absolute;
//     top:50%;
//     left:50%;
//     margin:-4px;
// }

.#{$prefix}radio:checked:hover,
input[type=radio]:checked:hover,
.#{$prefix}radio:checked:focus,
input[type=radio]:checked:focus {
    background-color: $radio-bg-color-checked;
}

.#{$prefix}radio[disabled],
input[type=radio][disabled] {
    background-color: $radio-bg-color-disabled;
    background-position: inherit;
    border-color: $radio-border-color-disabled;
    cursor: not-allowed;
}

.#{$prefix}radio[disabled]:hover,
.#{$prefix}radio[disabled]:focus,
input[type=radio][disabled]:hover,
input[type=radio][disabled]:focus {
    border-color: $radio-border-color-disabled;
}

.#{$prefix}radio[disabled]:checked,
input[type=radio][disabled]:checked {
    
    background-color: $radio-bg-color-checked-disabled;
    border: 1px solid $radio-border-color-checked-disabled;
    
}
// 为了兼容ie11
.#{$prefix}radio[disabled]:checked::-ms-check,
input[type=radio][disabled]:checked::-ms-check{
    background-color: $radio-bg-color-checked-disabled;
    border: 1px solid $radio-border-color-checked-disabled;
}

// .tea-radio[disabled]:checked::before,
// input[type=radio][disabled]:checked::before{
//     content         : "";
//     display         : block;
//     width           : 8px;
//     height          : 8px;
//     background-color: #fff;
//     border-radius   : 100%;
//     position        : absolute;
//     top             : 50%;
//     left            : 50%;
//     margin          : -4px;
// }


//checkbox
.#{$prefix}checkbox,
input[type=checkbox] {
    width: $radio-width;
    height: $radio-height;
    cursor: pointer;
    vertical-align: middle;
    outline: none;
    -webkit-appearance: none;
    border: 1px solid $radio-border-color;
    background-color: $radio-bg-color;
    border-radius: $radio-radius;
    color:$radio-text-color;
}

.#{$prefix}checkbox:hover,
.#{$prefix}checkbox:focus,
input[type=checkbox]:hover,
input[type=checkbox]:focus {
    border-color: $radio-border-color-hover;
}

.#{$prefix}checkbox:checked,
input[type=checkbox]:checked {
    background-image: url(../../assets/image/slice/svg/checkbox.svg);
    background-color: $radio-bg-color-checked;
    border-color: $radio-border-color-checked;
    background-position: inherit;
    background-size: 100% auto;
}

.#{$prefix}checkbox:checked:hover,
.#{$prefix}checkbox:checked:focus,
input[type=checkbox]:checked:hover,
input[type=checkbox]:checked:focus {
    background-image: url(../../assets/image/slice/svg/checkbox.svg);
    background-color: $radio-bg-color-checked;
    border-color: $radio-border-color-checked;
    background-position: inherit;
    background-size: 100% auto;
}

.#{$prefix}checkbox[disabled],
input[type=checkbox][disabled] {
    background-image: none;
    background-color: $radio-bg-color-disabled;
    border-color: $radio-border-color-disabled;
    background-position: inherit;
    cursor: not-allowed;
}

.#{$prefix}checkbox[disabled]:checked,
input[type=checkbox][disabled]:checked {
    background-image: url(../../assets/image/slice/svg/checkbox.svg);
    background-position: inherit;
    background-size: 100% auto;
    background-color: $radio-bg-color-checked-disabled;
    border-color: $radio-border-color-checked-disabled;
}

.#{$prefix}checkbox[disabled]:checked:hover,
input[type=checkbox][disabled]:checked:hover {
    background-color: $radio-bg-color-checked-disabled;
    border: 1px solid $radio-border-color-checked-disabled;
    cursor: not-allowed;
}

.#{$prefix}checkbox:indeterminate,
input[type=checkbox]:indeterminate {
    background-image: url(../../assets/image/slice/svg/indeterminate.svg);
    background-color: $radio-bg-color-checked;
    border: 1px solid $radio-border-color-checked;
    background-position: inherit;
    background-size: 100% auto;
}

.#{$prefix}checkbox:indeterminate:hover,
input[type=checkbox]:indeterminate:hover {
    background-color: $radio-bg-color-checked;
}

.#{$prefix}checkbox[disabled]:indeterminate,
input[type=checkbox][disabled]:indeterminate {
    background-image: url(../../assets/image/slice/svg/indeterminate.svg);
    background-position: inherit;
    background-size: 100% auto;
    background-color: $radio-bg-color-checked-disabled;
    border: 1px solid $radio-border-color-checked-disabled;
}

//容器
.#{$prefix}form-check-group{  //多个checkbox或者radio，换行时通过此容器添加间距和收归间距
    margin-bottom:-8px;
    display: inline-block;
    vertical-align: middle; //为了和前后内容对齐
    .#{$prefix}form-check{
        margin-bottom:8px;
    }
    & + .#{$prefix}icon-valid{
        vertical-align: -3px;
    }
}
.#{$prefix}form-check {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    padding-left: $radio-width + 4px; //icon width: 16 + spacing 4 
    margin-top: 0;
    margin-right: 18px;
    min-height:16px;
    color:$radio-text-color;
}
.#{$prefix}form-check:last-child{
    margin-right: 0px;
}
.#{$prefix}form-check__label {
    line-height: $radio-height;
    cursor: pointer;
    font-size: $radio-font-size;
    // vertical-align: middle; 去掉才会对齐
}

.#{$prefix}form-check .#{$prefix}radio-wrap,
.#{$prefix}form-check .#{$prefix}checkbox {
    position: absolute;
    top: 0;
    left: 0;
}

.#{$prefix}checkbox[disabled]+.#{$prefix}form-check__label,
.#{$prefix}radio[disabled]+.#{$prefix}form-check__label {
    //cursor: default;
    cursor: not-allowed;
}

.#{$prefix}form-check--block {
    display: block;
}

.#{$prefix}form-check--block+.#{$prefix}form-check--block {
    margin-top: 8px;
    margin-right: 0;
}

// 主要用于表格中，行选择的时候，会把checkbox和文本放到一个td下，确保内部的overflow会生效
// 前端组件也只会在这个情况下添加此类名
.#{$prefix}form-check--table-select{
    max-width: 100%;
    box-sizing: border-box;
}