﻿.beautify {
    margin-right: 6px;
    margin-left: 2px;
    font-size: 14px;
    display: inline-block;
}

.beautify > * {
    vertical-align: middle;
}

.beautify input[type=radio], .beautify input[type=checkbox] {
    display: none;
}

.beautify input + i::before {
    font-family: layui-icon !important;
    font-size: 22px;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin-right: 6px;
    height: 28px;
    line-height: 28px;
    text-indent: 0;
    width: 22px;
    display: inline-block;
    color: #C2C2C2;
    cursor: pointer;
    position: relative;
    text-align: center;
    transition: color 0.2s;
}

.beautify input[type=radio] + i::before {
    content: "\e63f";
}

.beautify input[type=radio]:checked + i::before {
    content: "\e643";
    color: #5FB878;
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-name: layui-scale-spring;
}

.beautify-sm input[type=radio] + i::before {
    font-size: 18px;
    width:14px;
}

.beautify input[type=checkbox] + i::before {
    content: "\e605";
    color: #FFF;
    border: solid 1px #ddd;
    border-radius: 2px;
    width: 26px;
    height: 26px;
    animation-duration: 0.2s;
    animation-fill-mode: both;
    animation-name: layui-scale;
}

.beautify input[type=checkbox]:checked + i::before {
    color: #5FB878;
    animation-duration: 0.2s;
    animation-fill-mode: both;
    animation-name: layui-scale-spring;
}

.beautify input[type=checkbox]:disabled + i:before {
    cursor: not-allowed !important;
    border: solid 1px #f1f1f1;
    color: #FFF;
}

.beautify input[type=checkbox]:checked:disabled + i:before {
    color: #d2d2d2;
}

.beautify.small input[type=checkbox] + i::before {
    width: 18px;
    height: 18px;
    vertical-align: -2%;
    line-height: 20px;
    font-size: 16px;
}

/*使用方法：<label><input type='checkbox'><text data-on="显示" data-off="隐藏"></text><i></i></label>*/
.pui-switch {
    border-radius: 20px;
    display: inline-block;
    height: 30px;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    font-size: 14px;
    vertical-align: middle;
    cursor: pointer;
}

.pui-switch input[type=checkbox] {
    display: none;
}

.pui-switch input[type=checkbox] ~ text {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    line-height: 200%;
    transition: all 0.3S ease 0.08S;
}

.pui-switch input[type=checkbox] ~ text:before, .pui-switch input[type=checkbox] ~ text:after {
    width: 100%;
    height: 100%;
    text-shadow: 0 1px 0 rgba(0,0,0,0.4);
    position: absolute;
    display: inline-block;
    top: 0;
    padding: 0 10px;
    box-sizing: border-box;
    background-color: #DDD;
    transition: all 0.3S ease
}

.pui-switch input[type=checkbox]:checked ~ text:before, .pui-switch input[type=checkbox]:checked ~ text:after {
    background-color: #86d993;
}

.pui-switch input[type=checkbox] ~ text:before {
    content: attr(data-off);
    left: 0;
    text-align: left;
    position: relative;
    padding: 0 32px 0 12px;
}

.pui-switch input[type=checkbox] ~ text:after {
    content: attr(data-on);
    left: 100%;
    text-align: left;
    padding: 0 0 0 32px;
}

.pui-switch input[type=checkbox]:checked ~ text {
    transform: translateX(-100%);
}

@keyframes pui-switch-unchecked {
    0% {
        left: 0%;
        margin-left: 2px;
    }

    30% {
        width: 60%;
    }

    100% {
        left: 100%;
        margin-left: -28px;
    }
}

.pui-switch input[type=checkbox] ~ i {
    display: block;
    width: 26px;
    height: 26px;
    position: absolute;
    top: 0;
    border-radius: 100px;
    left: 100%;
    margin: 2px 2px 2px -28px;
    background: #fff;
    animation: pui-switch-unchecked 0.3S forwards;
}

@keyframes pui-switch-checked {
    0% {
        left: 100%;
        margin-left: -28px;
    }

    30% {
        width: 60%;
    }

    100% {
        left: 0%;
        margin-left: 2px;
    }
}

.pui-switch input[type=checkbox]:checked ~ i {
    left: 0%;
    margin-left: 2px;
    animation: pui-switch-checked 0.3S forwards;
}

.pui-switch.pui-switch-sm {
    font-size: 12px;
    height: 22px;
}

.pui-switch.pui-switch-sm input[type=checkbox] ~ text {
    line-height: 21px;
}

.pui-switch.pui-switch-sm input[type=checkbox] ~ text:before {
    padding: 0 23px 0 10px;
}

.pui-switch.pui-switch-sm input[type=checkbox] ~ text:after {
    padding: 0 0 0 23px;
}

.pui-switch.pui-switch-sm input[type=checkbox] ~ i {
    width: 18px;
    height: 18px;
    transform: translateX(8px);
}

.pui-switch.pui-switch-sm input[type=checkbox]:checked ~ i {
    transform: translateX(0px);
}
