@import '../dynamic.scss';

form {
    label {
        margin-right: 1rem;
    }

    select.form-control {
        &.single-select {
            width: auto;
            height: 3rem !important;
            font: $font-weight-normal $font-size-base;
            border-radius: 15rem;
            background-color: $select-background-color;
            color: $select-color;
            padding-right: $input-padding-x-lg + 1.5rem; // Pad to make space for arrow icon
            padding-left: $input-padding-x-lg;
            border-color: $dark;

            -webkit-appearance: none;
            -moz-appearance: none;
            background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 34 34'><path d='M31.858 9.967l-14.372 16.8A.634.634 0 0 1 17 27c-.231 0-.393-.078-.486-.233L2.142 9.967c-.162-.178-.185-.39-.07-.634A.583.583 0 0 1 2.628 9h28.744c.255 0 .44.111.556.333.115.245.092.456-.07.634z'/></svg>")
                #fff;
            background-position: 94% 55%;
            background-repeat: no-repeat;
        }
    }
}

input[type='checkbox'] {
    width: auto;
}

.form-control-with-icon {
    position: relative;
    & > .form-control {
        padding-right: 2rem;
        &:disabled + .icon {
            opacity: 0.5;
        }
    }
    & > .icon {
        height: 100%;
        position: absolute;
        right: 0.5rem;
        left: auto;
        top: 0;
        pointer-events: none;
    }
}

.form-control-radio-switch,
.form-control-radio-switch-lg {
    display: flex;
    justify-content: space-evenly;
    background-color: $white;
    border: solid 1px $dark;
    border-radius: 15rem;
    white-space: nowrap;
    line-height: 2.5rem;

    .form-check-inline {
        display: inline-flex;
        align-items: center;
        padding-left: 0;
        margin: 0.2rem 0;
        width: 100%;
        text-align: center;
        overflow: hidden;
        flex-shrink: 10;
        &:first-child {
            margin-left: 0.2rem;
        }
        &:last-child {
            margin-right: 0.2rem;
        }
        &.form-check-inline-noclip {
            overflow: visible;
        }
        &.form-check-inline-sm {
            flex-shrink: 11;
        }
        &.form-check-inline-lg {
            flex-shrink: 8;
        }
        &.form-check-inline-xl {
            flex-shrink: 6;
        }
    }

    input {
        display: none;
    }
    input:checked + .form-check-label {
        background-color: $dark;
        color: $white;
    }
    .form-check-label {
        width: 100%;
        padding: 0 5px;
        border-radius: 15rem;
        margin: auto;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }
}

.form-control-radio-switch-lg {
    line-height: 3.5rem;
}

/* The radio-button */
.radio-button {
    display: block;
    position: relative;
    padding-left: 2.5rem;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Hide the browser's default radio button */
.radio-button input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

/* Create a custom radio button */
.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    margin: auto;
    height: 16px;
    width: 16px;
    background-color: white;
    border-radius: 50%;
    -webkit-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.75);
    -moz-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.75);
    box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.75);
}

/* On mouse-over, add a grey background color */
.radio-button:hover input ~ .checkmark {
    background-color: #ccc;
}

/* When the radio button is checked, add a white background */
.radio-button input:checked ~ .checkmark {
    background-color: white;
}

/* Create the indicator (the dot/circle - hidden when not checked) */
.checkmark:after {
    content: '';
    position: absolute;
    display: none;
}

/* Show the indicator (dot/circle) when checked */
.radio-button input:checked ~ .checkmark:after {
    display: block;
}

/* Style the indicator (dot/circle) */
.radio-button .checkmark:after {
    position: absolute;
    margin: auto;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: black;
}
