// The class gradetreebox matches the pages displaying the gradebook
// "Gradebook setup" > "Simple view" and "Full view".
.gradetreebox {
    h4 {
        // Force back the base font-size to minimise width.
        font-size: @baseFontSize;
    }
    th.cell,
    input[type=text] {
        // Fallback on the minimum width.
        width: auto;
    }
    input[type=text],
    select {
        // Remove the bottom margin to gain height.
        margin-bottom: 0;
    }
}

// Grade upgrade notice.
.core_grades_notices {
    .singlebutton {
        display: inline-block;
    }
}

// Rubrics
#page-grade-grading-manage {
    #activemethodselector {
        label {
            display: inline-block;
        }
        .helptooltip {
            margin-right: 0.5em;
        }
    }
    .actions {
        display: block;
        text-align: center;
        margin-bottom: 1em;
        .action {
            .btn();
            .btn-large();
            display: inline-block;
            position: relative;
            vertical-align: top;
            width: 150px;
            text-align: center;
            overflow: hidden;
            margin: 0.5em;
            padding: 1em;
            border: 1px solid #aaa;
            .action-icon {
                display: inline-block;
                position: relative;
                height: 64px;
                width: 64px;
            }
            .action-text {
                position: relative;
                top: 0.4em;
                font-size: 14px;
            }
        }
    }
}

#page-grade-grading-form-rubric-edit {
    .gradingform_rubric_editform .status {
        font-size: 70%;
    }
}

.gradingform_rubric.editor {
    .addlevel, .addcriterion {
        input {
            // Fallback for IE8: we use Bootstrap 2's button styles normally, but
            // IE8 ignores background-image: linear-gradient rules.
            background: #fff none no-repeat top left;
        }
    }
}

.dir-rtl {
    #rubric-rubric.gradingform_rubric {
        #rubric-criteria .criterion {
            .level {
                .score {
                    text-align: right;
                    float: right;
                    margin-left: 28px;
                    margin-right: 0px;
                }
                .delete {
                    float: left;
                    input {
                        left: 0;
                        right: auto;
                    }
                }
            }
        }
        .addcriterion {
            margin-right: 5px;
            margin-left: 0px;

            input {
                padding-right: 26px;
                padding-left: 10px;
                background-position: right 8px top 8px;
            }
        }
        .options {
            .option {
                .value {
                    margin-left: 0px;
                    margin-right: 5px;
                }
                input {
                    // margins flipped for RTL.
                    margin-left: 12px;
                    margin-right: 5px;
                }
            }
        }
    }
}

#rubric-rubric {
    &.gradingform_rubric {
        #rubric-criteria {
            margin-bottom: 1em;
            @rubricPadding: 6px;
            .criterion {
                .description {
                    vertical-align: top;
                    padding: @rubricPadding;
                    textarea {
                        margin-bottom: 0px;
                        height: 115px;
                    }
                }
                .definition {
                    textarea {
                        width: 80%;
                        margin-bottom: 0px;
                    }
                }
                .score {
                    position: relative;
                    float: left;
                    margin-right: 28px;
                    input {
                        margin-bottom: 0px;
                    }
                }
                .level {
                    vertical-align: top;
                    padding: @rubricPadding;
                    .delete {
                        position: relative;
                        width: 32px;
                        height: 32px;
                        margin-top: -32px;
                        clear: both;
                        float: right;
                        input {
                            display: block;
                            position: absolute;
                            right: 0;
                            bottom: 0;
                            height: 24px;
                            width: 24px;
                            margin: 0px;
                            &:hover {
                                background-color: #ddd;
                            }
                        }
                    }
                }
                .scorevalue {
                    input {
                        // Should handle at least three chars with room to spare.
                        float: none;
                        width: 2em;
                        &.hiddenelement,&.pseudotablink {
                            // Zero out the width if it's still in the block flow for some reason
                            // when hidden
                            width: 0;
                        }
                    }
                }
                .addlevel {
                    vertical-align: middle;
                    input {
                        .btn();
                        background-position: 0px 0px;
                        height: 30px;
                        margin-right: 5px;
                    }
                }
            }
        }
        .addcriterion {
            margin-left: 5px;
            .btn();
            padding: 0;
            input {
                margin: 0;
                color: inherit;
                text-shadow: inherit;
                border: 0px none;
                line-height: inherit;
                background: transparent url([[pix:t/add]]) no-repeat 7px 8px;
                padding-left: 26px;
            }
            margin-bottom:1em;
        }
        .options {
            clear: both;
            .option {
                label {
                    margin: 0;
                    padding: 0;
                    font-size: inherit;
                    font-weight: normal;
                    line-height: 2em;
                    color: inherit;
                    text-shadow: none;
                    background-color: transparent;
                }
                input {
                    margin-left: 5px;
                    margin-right: 12px;
                }
            }
        }
    }
}

// Set up grades layout.
.path-grade-edit-tree .setup-grades {
    h4 {
        margin: 0;
    }
    .column-rowspan {
        padding: 0;
        width: 24px;
        min-width: 24px;
        max-width: 24px;
    }
    .category td.column-name {
        padding-left: 0;
    }
    td.column-name {
        padding-left: 24px;
    }
    .column-name h4 img.icon {
        padding-left: 0;
    }
    .category input[type="text"],
    .category .column-range,
    .categoryitem,
    .courseitem {
        font-weight: bold;
    }
    .emptyrow {
        display: none;
    }
    .gradeitemdescription {
        font-weight: normal;
        padding-left: 24px;
    }
    .column-weight {
        white-space: nowrap;
        &.level3 {
            padding-left: 37px;
        }
        &.level4 {
            padding-left: 66px;
        }
        &.level5 {
            padding-left: 95px;
        }
        &.level6 {
            padding-left: 124px;
        }
        &.level7 {
            padding-left: 153px;
        }
        &.level8 {
            padding-left: 182px;
        }
        &.level9 {
            padding-left: 211px;
        }
        &.level10 {
            padding-left: 240px;
        }
    }
    .column-range {
        &.level2 {
            padding-left: 37px;
        }
        &.level3 {
            padding-left: 66px;
        }
        &.level4 {
            padding-left: 95px;
        }
        &.level5 {
            padding-left: 124px;
        }
        &.level6 {
            padding-left: 153px;
        }
        &.level7 {
            padding-left: 182px;
        }
        &.level8 {
            padding-left: 211px;
        }
        &.level9 {
            padding-left: 240px;
        }
        &.level10 {
            padding-left: 269px;
        }
    }
    &.generaltable {
        .levelodd {
            background-color: @tableBackgroundAccent;
        }
        .leveleven {
            background-color: @tableBackground;
        }
    }
}

.dir-rtl {
    &.path-grade-edit-tree .setup-grades {
        .category td.column-name {
            padding-right: 0;
        }
        td.column-name {
            padding-right: 24px;
        }
        .column-name h4 img.icon {
            padding-left: 4px;
        }
        .gradeitemdescription {
            padding-left: 0;
            padding-right: 24px;
        }
        .column-weight {
            &.level3 {
                padding-left: 0;
                padding-right: 37px;
            }
            &.level4 {
                padding-left: 0;
                padding-right: 66px;
            }
            &.level5 {
                padding-left: 0;
                padding-right: 95px;
            }
            &.level6 {
                padding-left: 0;
                padding-right: 124px;
            }
            &.level7 {
                padding-left: 0;
                padding-right: 153px;
            }
            &.level8 {
                padding-left: 0;
                padding-right: 182px;
            }
            &.level9 {
                padding-left: 0;
                padding-right: 211px;
            }
            &.level10 {
                padding-left: 0;
                padding-right: 240px;
            }
        }
        .column-range {
            &.level2 {
                padding-left: 0;
                padding-right: 37px;
            }
            &.level3 {
                padding-left: 0;
                padding-right: 66px;
            }
            &.level4 {
                padding-left: 0;
                padding-right: 95px;
            }
            &.level5 {
                padding-left: 0;
                padding-right: 124px;
            }
            &.level6 {
                padding-left: 0;
                padding-right: 153px;
            }
            &.level7 {
                padding-left: 0;
                padding-right: 182px;
            }
            &.level8 {
                padding-left: 0;
                padding-right: 211px;
            }
            &.level9 {
                padding-left: 0;
                padding-right: 240px;
            }
            &.level10 {
                padding-left: 0;
                padding-right: 269px;
            }
        }
    }
}

/**
 * Grader report.
 */
.path-grade-report {
    .gradeparent {
        table {
            .border-radius(@baseBorderRadius);
        }
        tr .cell {
            background-color: @paginationBackground;
        }
        table,
        .cell {
            border-color: @tableBorder;
        }
        tr:nth-of-type(even) .cell,
        .floater .cell,
        .avg {
            background-color: @tableBackgroundAccent;
        }
        table .clickable {
            cursor: pointer;
        }
    }
 }

/**
 * User report.
 */
.path-grade-report-user .user-grade {
    border: none;
    &.generaltable {
        .levelodd {
            background-color: @tableBackgroundAccent;
        }
        .leveleven {
            background-color: @tableBackground;
        }
    }
}

.has_dock.path-grade-report-grader {
    .gradeparent .sideonly.floating > .cell,
    .gradeparent .sideonly.floating > .cell,
    .gradeparent .sideonly.floating > .cell {
        padding-left: 5 + (@dockWidth + (@dockTitleMargin * 2));
    }

    &.dir-rtl {
        .gradeparent .sideonly.floating > .cell,
        .gradeparent .sideonly.floating > .cell,
        .gradeparent .sideonly.floating > .cell {
            padding-left: 5px;
            padding-right: 5 + (@dockWidth + (@dockTitleMargin * 2));
        }
    }
}

.content-only.path-grade-report-grader {
    .gradeparent table {
        margin-left: (@dockWidth + (@dockTitleMargin * 2));
    }

    &.dir-rtl {
        .gradeparent table {
            margin-left: 0;
            margin-right: (@dockWidth + (@dockTitleMargin * 2));
        }
    }
}
