// j01.form.forms.less

/*---[ form control ]---------------------------------------------------------*/
.form-control {
    display: block;
    width: 100%;
    height: @input-height;
    padding: @input-padding-y @input-padding-x;
    // LESS PORT: Less doesn’t strip “empty” property values so we have to
    // check for a value first.
    & when not (@input-font-family = ~"") { font-family: @input-font-family; }
    #font-size(@input-font-size);
    font-weight: @input-font-weight;
    line-height: @input-line-height;
    color: @input-color;
    background-color: @input-bg;
    background-clip: padding-box;
    border: @input-border-width solid @input-border-color;

    // Note: This has no effect on <select>s in some browsers, due to the
    // limited stylability of `<select>`s in CSS.
    #border-radius(@input-border-radius, 0);

    #box-shadow(@input-box-shadow);
    #transition(@input-transition);

    // Unstyle the caret on `<select>`s in IE10+.
    &::-ms-expand {
        background-color: transparent;
        border: 0;
    }

    // Remove select outline from select box in FF
    &:-moz-focusring {
        color: transparent;
        text-shadow: 0 0 0 @input-color;
    }

    // Customize the `:focus` state to imitate native WebKit styles.
    #form-control-focus(@ignore-warning: true);

    // Placeholder
    &::placeholder {
        color: @input-placeholder-color;
        // Override Firefox's unusual default opacity;
        // see https://github.com/twbs/bootstrap/pull/11526.
        opacity: 1;
    }

    // Disabled and read-only inputs
    //
    // HTML5 says that controls under a fieldset > legend:first-child won't be
    // disabled if the fieldset is disabled. Due to implementation difficulty,
    // we don't honor that edge case; we style them as disabled anyway.
    &:disabled,
    &[readonly] {
        background-color: @input-disabled-bg;
        // iOS fix for unreadable disabled content;
        // see https://github.com/twbs/bootstrap/issues/11655.
        opacity: 1;
    }
}

select.form-control {
    &:focus::-ms-value {
        // Suppress the nested default white text on blue background highlight
        // given to the selected option text when the (still closed) <select>
        // receives focus in IE and (under certain conditions) Edge, as it
        // looks bad and cannot be made to match the appearance of the native
        // widget.
        // See https://github.com/twbs/bootstrap/issues/19398.
        color: @input-color;
        background-color: @input-bg;
    }
}


// TODO: implement readonly display text;
// // Readonly controls as plain text
// //
// // Apply class to a readonly input to make it appear like regular plain
// // text (without any border, background color, focus indicator)

// .form-control-plaintext {
//     display: block;
//     width: 100%;
//     padding: @input-padding-y 0;
//     margin-bottom: 0; // match inputs if this class comes on inputs with default margins
//     #font-size(@input-font-size);
//     line-height: @input-line-height;
//     color: @input-plaintext-color;
//     background-color: transparent;
//     border: solid transparent;
//     border-width: @input-border-width 0;

//     &.form-control-sm,
//     &.form-control-lg {
//         padding-right: 0;
//         padding-left: 0;
//     }
// }

/*---[ radio, checkbox widget]------------------------------------------------*/
// fix bootstrap checkbox and radio label/input space
.radio,
.checkbox {
    // adjust space between label -> checkbox and radio input
    margin-top: 0;
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
  margin-top: 1px \9;
}

.radio + .radio,
.checkbox + .checkbox {
    // Move up sibling radios or checkboxes for tighter spacing
    margin-top: -5px;
}

// .form-check {
//     position: relative;
//     display: block;
//     padding-left: @form-check-input-gutter;
// }

// .form-check-input {
//     position: absolute;
//     margin-top: @form-check-input-margin-y;
//     margin-left: -@form-check-input-gutter;

//     // Use disabled attribute instead of :disabled pseudo-class
//     // Workaround for: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11295231
//     &[disabled] ~ .form-check-label {
//         color: @text-muted;
//     }
// }

// .form-check-label {
//     margin-bottom: 0; // Override default `<label>` bottom margin
// }

// .form-check-inline {
//     display: inline-flex;
//     align-items: center;
//     padding-left: 0; // Override base .form-check
//     margin-right: @form-check-inline-margin-x;

//     // Undo .form-check-input defaults and add some `margin-right`.
//     .form-check-input {
//         position: static;
//         margin-top: 0;
//         margin-right: @form-check-inline-input-margin-x;
//         margin-left: 0;
//     }
// }

/*---[ multi widget]----------------------------------------------------------*/
.multi-control-widget {
    #clearfix();
    padding-bottom: 10px;
    .multi-control-checkbox {
        float: left;
    }
    .multi-control-input {
        margin-left: 25px;
    }
}

/*---[ sizing ]---------------------------------------------------------------*/

select.form-control {
    &[size],
    &[multiple] {
        height: auto;
    }
}

textarea.form-control {
    height: auto;
}

// groups

.form-group {
    margin-bottom: @form-group-margin-bottom;
}

.form-text {
    display: block;
    margin-top: @form-text-margin-top;
}


/*---[ addon ]----------------------------------------------------------------*/
// input-group-addon non border if addon get used
.input-group.input-group-before {
    .form-control {
        border-left: 0;
    }
    .input-group-addon:first-child {
        background-color: @input-group-addon-before-bg;
    }
}
.input-group.input-group-after {
    .form-control {
        border-right: 0;
    }
    .input-group-addon:last-child {
        background-color: @input-group-addon-after-bg;
    }
}

/*---[ errors ]---------------------------------------------------------------*/
// custom widget error representation
.widget-error {
    // absolute positioning
    position: relative;
    // icons don't overlap text
    // .form-control {
    //     -right: (@input-height * 1.25);
    // }
    #widget-error(@widget-error-color; @widget-error-color; @widget-error-bg);
}


/*---[ display mode ]---------------------------------------------------------*/
// display mode (given from default widget display layout template)
.widget-display {
    .form-control {
        color: @input-plaintext-color;
        background-color: transparent;
        border: 0;
    }
}
