﻿/*
    For using this CustomCheckBox:
        <label> your_Label_here </label>                    //this is your customcheckbox label
        <input id="_checkbox" type="checkbox"/>             //custombox input adding id="_checkbox" is mandatory
        <label class="customCheckbox" for="_checkbox">      //this is where the magic happens just added after your input
            <div id="tick_mark"></div>
        </label>
*/

/* to add another checkbox add new id here */
#_checkbox, #_checkbox1, #_checkbox2 {
    display: none;
}

.customCheckbox {
    position: relative;
    top: 20px;
    right: 0;
    left: 0;
    width: 10px;
    height: 10px;
    margin: 0 5px;
    transform: translateY(-50%);
    border-radius: 50%;
    transition: 0.2s ease transform, 0.2s ease background-color, 0.2s ease box-shadow;
    overflow: hidden;
}

    .customCheckbox:before {
        content: "";
        position: absolute;
        top: 50%;
        right: 0;
        left: 0;
        width: 30px;
        height: 30px;
        margin: 0 auto;
        background-color: var(--ThirdColor);
        transform: translateY(-50%);
        border-radius: 50%;
        transition: 0.2s ease width, 0.2s ease height;
    }

    .customCheckbox:hover:before {
        width: 30px;
        height: 30px;
        box-shadow: inset 0px 0px 5px var(--SecondaryColor);
    }

    .customCheckbox:active {
        transform: translateY(-50%) scale(0.9);
    }

#tick_mark {
    position: absolute;
    top: 0px;
    right: 0;
    left: 0;
    width: 20px;
    height: 20px;
    margin: 0 5px;
    transform: rotateZ(-40deg);
}

    #tick_mark:before, #tick_mark:after {
        content: "";
        position: absolute;
        background-color: var(--ThirdColor);
        border-radius: 2px;
        opacity: 0;
        transition: 0.2s ease transform, 0.2s ease opacity;
    }

    #tick_mark:before {
        left: 0;
        bottom: 0;
        width: 4px;
        height: 11px;
        box-shadow: -2px 0 5px rgba(0,0,0,0.23);
        transform: translateY(-68px);
    }

    #tick_mark:after {
        left: 0;
        bottom: 0;
        width: 18px;
        height: 4px;
        box-shadow: 0 3px 5px rgba(0,0,0,0.23);
        transform: translateX(78px);
    }

#_checkbox:checked + .customCheckbox {
    background-color: var(--PrimaryColor);
    box-shadow: 0 2px 8px var(--SecondaryColor);
}

    #_checkbox:checked + .customCheckbox:before {
        width: 0;
        height: 0;
    }

    #_checkbox:checked + .customCheckbox #tick_mark:before, #_checkbox:checked + .customCheckbox #tick_mark:after {
        transform: translate(0);
        opacity: 1;
    }

#_checkbox1:checked + .customCheckbox {
    background-color: var(--PrimaryColor);
    box-shadow: 0 2px 8px var(--SecondaryColor);
}

    #_checkbox1:checked + .customCheckbox:before {
        width: 0;
        height: 0;
    }

    #_checkbox1:checked + .customCheckbox #tick_mark:before, #_checkbox1:checked + .customCheckbox #tick_mark:after {
        transform: translate(0);
        opacity: 1;
    }

/* duplicate this section to add another checkbox id */
#_checkbox2:checked + .customCheckbox {
    background-color: var(--PrimaryColor);
    box-shadow: 0 2px 8px var(--SecondaryColor);
}

    #_checkbox2:checked + .customCheckbox:before {
        width: 0;
        height: 0;
    }

    #_checkbox2:checked + .customCheckbox #tick_mark:before, #_checkbox2:checked + .customCheckbox #tick_mark:after {
        transform: translate(0);
        opacity: 1;
    }
/* end section */