تأثير جميل على الـ checkbox

تأثير جميل على الـ checkbox

html

<label>
    <input type="checkbox">
    <div>
        <span>
            <i class="fa fa-check"></i>
        </span>
        <span>
            <i class="fa fa-close"></i>
        </span>
    </div>
</label>

css

body {
    direction: rtl;
    margin: 0;
    padding: 150px;
    box-sizing: border-box;
}
label {
    position: relative;
    width: 160px;
    height: 80px;
    display: flex;
    cursor: pointer;
}
label input {
    position: relative;
    z-index: 1;
    appearance: none;
}
label div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #c0392b;
    border-radius: 80px;
}
label span {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 72px;
    height: 72px;
    background-color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 50px;
}
label span:last-child i {
    color: #c0392b;
}
label span:first-child i {
    color: #27ae60;
}
label input:checked ~ div {
    background-color: #27ae60;
    transition: 0.5s;
}
label input:checked ~ div span {
    left: 84px;
    transition: 0.5s;
}
label input:checked ~ div span:last-child {
    display: none;
    transition: 0.5s;
}