@import "../../style/mixins.less";

// Forms.less
// Base styles for various input types, form layouts, and states
// -------------------------------------------------------------
// vars {{{
@inputBorderRadius:             3px;

@inputBorder:                   #ddd;
@inputBorderTop:                #bbb;
@inputBorderHover:              @grayLighter;
@inputBorderTopHover:           @grayLight;
@inputBorderFocus:              #488fcd;
@inputBorderError:              #ec0000;
@placeholderText:               @grayLighter;
@inputTextColor:                @grayDark;

@inputDisabledBackground:       #f5f5f5;
@formActionsBackground:         #f5f5f5;

// Form states and alerts
// -------------------------
@warningText:             #c09853;
@warningBackground:       #fcf8e3;
@warningBorder:           darken(spin(@warningBackground, -10), 3%);

@errorText:               #ec0000;
@errorBackground:         #f2dede;
@errorBorder:             darken(spin(@errorBackground, -10), 3%);

@successText:             #468847;
@successBackground:       #dff0d8;
@successBorder:           darken(spin(@successBackground, -10), 5%);

@infoText:                #3a87ad;
@infoBackground:          #d9edf7;
@infoBorder:              darken(spin(@infoBackground, -10), 7%);
//}}}

// Inputs, Textareas
.input,
.textarea {
    display: inline-block;
    width: 210px;
    height: @baseLineHeight;
    padding: 2px 8px 3px;
    margin-bottom: 9px;
    line-height: @baseLineHeight;
    color: @inputTextColor;
    border: 1px solid @inputBorder;
    border-top-color: @inputBorderTop;
    border-radius: 2px;

    @transition: border linear .2s, box-shadow linear .2s;
    .transition(@transition);

    &:hover {
        border-color: @inputBorderHover;
        border-top-color: @inputBorderTopHover;
        .box-shadow(~"inset 0 1px #f5f5f5");
    }
    &:focus {
        border-color: @inputBorderFocus;
        outline: 0;
        .box-shadow(~"0 0 8px rgba(72,143,205,.6)");
    }
}

.input-error,
.textarea-error {
    border-color: @inputBorderError;
    .box-shadow(~"0 0 8px rgba(236, 0, 0, .6)");
}

// Disabled and read-only inputs
.input-disabled {
    cursor: not-allowed;
    border-color: @grayLighter;
    color: @grayLighter;
    background-color: @inputDisabledBackground;
}

// Make textarea height behave
.textarea {
    padding-top: 4px;
    padding-right: 4px;
    height: auto;
}

// CHECKBOXES & RADIOS
// -------------------
.radio,
.checkbox {
    margin-top: 5px;

    input {
        float: left; _display: inline;
        border: none;
        /*margin-left: -18px;*/
        width: auto;
        margin: 3px 4px 9px 0;
    }
}

// Increase spacing between groups
.control-group {
    margin-bottom: 18px;
    .clearfix();
}
// Float the labels left
.control-label {
    float: left;
    width: 150px;
    padding-top: 5px;
    text-align: right;
}
// Move over all input controls and content
.controls {
    // Super jank IE7 fix to ensure the inputs in .input-append and input-prepend
    // don't inherit the margin of the parent, in this case .controls
    *display: inline-block;
    *padding-left: 20px;
    margin-left: 160px;
    *margin-left: 0;
    &:first-child {
        *padding-left: 160px;
    }
    .inline {
        display: inline-block;
        margin-right: 10px; // space out consecutive inline controls
        margin-bottom: 0;
        vertical-align: middle;
        white-space: nowrap;
    }

    // Identify controls by their labels
    label {
        display: block;
        margin-bottom: 5px;
        color: @grayDark;
    }
}
// Remove bottom margin on block level help text since that's accounted for on .control-group
.help-block {
    margin-top: 5px;
    margin-bottom: 0;
}

.bx-controls {
    input {
        display: none;
    }
    .control {
        float: left;
        margin-left: -19px;
        margin-bottom: 9px;
        width: 16px;
        height: 18px;
        background: url(http://img02.taobaocdn.com/tps/i2/T10ubJXkteXXbyGkri-18-360.png) 0 -178px;
    }

    .checkbox {
        padding-left: 19px;

        .checked {
            background-position: 0 -214px;
        }
        .disabled {
            background-position: 0 -286px;
        }
        .checked-disabled {
            background-position: 0 -322px;
        }
    }

    .radio {
        padding-left: 19px;

        .control {
            background-position: 0 2px;
        }
        .checked {
            background-position: 0 -34px;
        }
        .disabled {
            background-position: 0 -106px;
        }
        .checked-disabled {
            background-position: 0 -142px;
        }
    }
}
