/**
 * = Forms
 */

 label {
    font-size: $font-size-sm;
}

.form-group {
    position: relative;
}

.form-label{
    font-weight:$font-weight-normal;
    font-size:$font-size-base;
    display:block;
}

.form-control {
    font-size: $input-font-size;
    border-radius:$input-border-radius;
    box-shadow: none;
    
    &:focus {
        &:placeholder {
            color: $input-focus-placeholder-color;
        }
    }
}


/* Textareas */

textarea[resize="none"] {
    resize: none!important;
}

textarea[resize="both"] {
    resize: both!important;
}

textarea[resize="vertical"] {
    resize: vertical!important;
}

textarea[resize="horizontal"] {
    resize: horizontal!important;
}


/* shadow styles */

.form-control-muted {
    background-color: $input-muted-bg;
    border-color: $input-muted-bg;
    box-shadow: none;

    &:focus {
        background-color: $input-muted-bg;
    }
}

.form-control-shadow {
    box-shadow: $shadow-input;
    border: 0;
    transition: box-shadow .15s ease;

    &:focus {
        box-shadow: $shadow-input-focus;
    }
}

// Sizes 
.form-control-lg {
    height: $input-height-lg;
}

.form-control-xl {
    height: $input-height-xl;
    padding: $input-padding-y-lg $input-padding-x-lg;
    line-height: $input-line-height-lg;
    @include font-size($input-font-size);
    @include border-radius($input-border-radius-lg);
  }

// Validation

.shadow-group-success,
.shadow-group-danger {
    box-shadow: $shadow-input;
}

.has-danger {
    .form-control {
        // Placeholder
        &::placeholder {
            color: $form-feedback-invalid-color;
        }
    }
}

.has-success {
    .form-control {
        // Placeholder
        &::placeholder {
            color: $form-feedback-valid-color;
        }
    }
}

// Checkboxes and radios
// Indent the labels to position radios/checkboxes as hanging controls.

.form-check{
    margin-top: .5rem;
    padding-left: 0;
}

.form-check .form-check-label{
    display: inline-block;
    position: relative;
    padding-left: 1.375rem;
    font-weight: $font-weight-normal;
    line-height: 16px;
    margin-bottom: 0;
    @include transition($transition-base);
    color: $gray;

    &:hover {
        cursor: pointer;
    }
}

.radio .form-check-sign{
    padding-left: 28px;
}

.form-check input[type="radio"] +.form-check-inline .form-check-label {
    padding-left: 5px;
    margin-right: 10px;
}

.form-check .form-check-label::before,
.form-check .form-check-label::after{
    content: " ";
    display: inline-block;
    position: absolute;
    width: 15px;
    height: 15px;
    left: 0;
    top: 0;
    background-color: $custom-checkbox-bg;
    border: 1px solid $gray-500;
    @include transition($transition-base);
    @include border-radius($custom-checkbox-indicator-border-radius);

    &:hover {
        cursor: pointer;
    }
}

.form-check .form-check-sign-white:before {
    background-color: $white;
}

.form-check input[type="checkbox"]:checked + .form-check-sign::before,
.form-check input[type="checkbox"]:checked + .form-check-sign::before{
    border: none;
}

.form-check .form-check-label::after{
    content: "\f00c";
    font-family: 'Font Awesome 5 Free';
    top: 0px;
    text-align: center;
    opacity: 0;
    color: $primary;
    font-weight: 900;
    border: 0;
    background-color: inherit;
}

.form-check.disabled .form-check-label,
.form-check.disabled .form-check-label {
    color: $gray-500;
    cursor: not-allowed;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"]{
    opacity: 0;
    position: absolute;
    visibility: hidden;
}
.form-check input[type="checkbox"]:checked + .form-check-label::after{
    background-color:$white;
    opacity: 1;
    font-size: .625rem;
    margin-top: 0;
    line-height: 1.6;
}

.form-check input[type="checkbox"]:disabled + .form-check-label::after{
    color:$custom-checkbox-disabled-checked-bg;
}

.form-check input[type="checkbox"]+ .form-check-label::after{
    opacity: 0;
}

.form-control input[type="checkbox"]:disabled + .form-check-label::before,
.checkbox input[type="checkbox"]:disabled + .form-check-label::after{
    cursor: not-allowed;
}

.form-check input[type="checkbox"]:disabled + .form-check-label,
.form-check input[type="radio"]:disabled + .form-check-label{
    pointer-events: none;
}

.form-check input[type="radio"] + .form-check-label{
    padding-top: 3px;
}
.form-check input[type="radio"] + .form-check-label::before,
.form-check input[type="radio"] + .form-check-label::after{
    content: " ";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    left: 0px;
    top: 3px;
    padding: 1px;
    @include transition(opacity .3s linear);
}

.form-check input[type="radio"] + .form-check-label::before,
.form-check input[type="radio"] + .form-check-label::after{
    content: " ";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    left: 0px;
    top: 3px;
    padding: 1px;
    @include transition(opacity .3s linear);
}

.form-check input[type="radio"] + .form-check-label:after,
.form-check input[type="radio"] {
    opacity: 0;
}

.form-check input[type="radio"]:checked + .form-check-label::after {
    width: 8px;
    height: 8px;
    top: 8px;
    left: 5px;
    background-color: $custom-toggle-slider-indicator-bg;
    border-color: $custom-toggle-slider-indicator-bg;
    opacity: 1;
}

.form-check input[type="radio"]:checked + .form-check-label::before {
    background-color: $custom-checkbox-checked-bg;
}


.form-check input[type="radio"]:disabled + .form-check-label::before {
    color: $custom-checkbox-disabled-checked-bg;
}

.form-check input[type="radio"]:disabled + .form-check-label::before,
.form-check input[type="radio"]:disabled + .form-check-label::after {
    color: $gray-500;
}

//Round checkboxes 
.round-check{
    .form-check-sign::before,
    .form-check-sign::after{
        border-radius: $circle-radius;
    }
}

.custom-toggle {
    position: relative;
    display: inline-block;
    margin: 0;

    &.custom-toggle-sm {
        height: 1.3rem;
        width: 2rem;
        .custom-toggle-slider {
            width: 2rem;
            &:before {
                width: .8rem;
                height: .8rem;
            }
        }
        input:checked + .custom-toggle-slider {
            &:before {
                transform: translateX(.8rem);
            }  
        }
    }

    &.custom-toggle-md {
        height: 1.6rem;
        width: 3rem;
        .custom-toggle-slider {
            width: 3rem;
            &:before {
                height: 1.1rem;
                width: 1.1rem;
            }
        }

        input:checked + .custom-toggle-slider {
            &:before {
                transform: translateX(1.5rem);
            }  
        }
    }

    &.custom-toggle-lg {
        height: 1.9rem;
        width: 3.8rem;
        .custom-toggle-slider {
            width: 3.8rem;
            &:before {
                width: 1.4rem;
                height: 1.4rem;
            }
        }

        input:checked + .custom-toggle-slider {
            &:before {
                transform: translateX(1.9rem);
            }  
        }
    }

    input {
        display: none;

        &:checked {
             + .custom-toggle-slider {
                background-color: $custom-toggle-checked-bg;
                &:before {
                    background: $custom-toggle-slider-indicator-bg;
                }  
            }
        }
        
        &:disabled {
            + .custom-toggle-slider {
                background-color: $custom-toggle-disabled-bg;
                &:before{
                    background: $custom-toggle-slider-indicator-bg;
                }
                &:hover {
                    cursor: not-allowed;
                }
            }

            &:checked {
                + .custom-toggle-slider {
                    background-color: $custom-toggle-disabled-checked-bg;
                    &:before {
                        background-color: $custom-toggle-slider-indicator-bg;
                    }
                }
            }
        }
    }
}

.custom-toggle-slider {
    position: absolute;
    top: 0;
    left: -2px;
    bottom: 3px;
    border-radius: $border-radius-sm;
    background-color: $custom-toggle-slider-bg;

    &:before {
        content: "";
        position: absolute;
        border-radius: $border-radius-sm;
        left: 3px;
        bottom: 3px;
        background-color: $custom-toggle-slider-indicator-bg;
        transition: $input-transition;
    }

    &.rounded-toggle{
        border-radius: $custom-toggle-border-radius;
        &:before{
            border-radius: $circle-radius;
        }
    }

}
