/* modules.less */

// The home for small tweaks to modules that don't require
// changes drastic enough to pull in the full module css
// and replace it completely
// Plus some misc. odds and ends

select {
    width: auto;
}

// Assign
.path-mod-assign #page-content [data-region="grade-panel"] .mform:not(.unresponsive) #id_attemptsettings .fitem {
    .fitemtitle,
    .felement {
        display: table-cell;
        float: none;
        border-top: 1px solid #ddd;
        padding: 8px 0;
    }
}

// Feedback module
.path-mod-feedback .mform.feedback_form .fitem .fitemtitle {
    display: block;
    margin-top: 4px;
    margin-bottom: 4px;
    text-align: left;
    width: 100%;
}

.path-mod-feedback .mform.feedback_form .fitem .felement {
    margin-left: 0;
    width: 100%;
    float: left;
    padding-left: 0;
    padding-right: 0;
}

.path-mod-feedback .mform.feedback_form .fitem .fstatic:empty {
    display: none;
}

.path-mod-feedback .mform.feedback_form .fitem .fcheckbox > span,
.path-mod-feedback .mform.feedback_form .fitem .fradio > span,
.path-mod-feedback .mform.feedback_form .fitem .fgroup > span {
    margin-top: 4px;
}

body.path-mod-feedback #region-main .mform.feedback_form .femptylabel .fitemtitle {
    display: inline-block;
    width: auto;
    margin-right: 0;
}

.path-mod-feedback .mform.feedback_form .femptylabel .felement {
    display: inline-block;
    margin-top: 4px;
    padding-top: 5px;
    width: auto;
}

body.path-mod-feedback #region-main .mform.feedback_form .feedback-item-pagebreak .felement {
    width: 100%;
}

.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .fitemtitle,
.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement {
    display: inline-block;
    width: auto;
}

.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement {
    padding: 6px;
}

.path-mod-feedback .mform.feedback_form#feedback_viewresponse_form .fitem.feedback_hasvalue:not(.feedback-item-captcha) .felement {
    background: #fbfbf1;
    min-height: 1em;
    box-sizing: border-box;
    padding: 3px;
    border: 1px solid #ddd;
}

.path-mod-feedback .mform.feedback_form .fitem.feedback_hasvalue .fstatic:empty {
    display: inherit;
}

.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem:hover {
    background: #f5f5f5;
}

.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle label {
    width: 100%;
}

.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle {
    position: relative;
    width: 100%;
}

.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemdd,
.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemname {
    float: left;
}

.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemactions {
    float: right;
}

// Forum module

.path-mod-forum .forumsearch {
    input,
    .helptooltip {
        margin: 0 3px;
    }
}

.path-mod-forum .forumheaderlist,
.path-mod-forum .forumheaderlist td {
    border: none;
}

.path-mod-forum {
    .forumheaderlist {
        thead .header,
        tbody .discussion td {
            white-space: normal;
            vertical-align: top;
            padding-left: 0.5em;
            padding-right: 0.5em;
        }

        thead .header {
            white-space: normal;
            vertical-align: top;
        }

        thead .header.replies {
            text-align: center;
        }
        thead .header.lastpost {
            text-align: right;
        }
        thead .header th,
        tbody .discussion td {
            &.discussionsubscription {
                width: 16px;
                padding-left: 0.5em;
                padding-right: 0.5em;
            }
        }
        .discussion {
            .author,
            .replies,
            .lastpost {
                white-space: normal;
            }
            .discussionsubscription,
            .replies {
                text-align: center;
            }
            .topic,
            .discussionsubscription,
            .topic.starter,
            .picture,
            .author,
            .replies,
            .lastpost {
                vertical-align: top;
            }
        }
    }
}

.forumpost {
    .well;
    padding: 6px;
    .header {
        margin-bottom: 3px;
    }
    .picture img {
        margin: 3px;
        &.userpicture {
            margin-left: 3px;
            margin-right: 10px;
        }
    }
    .content {
        .posting.fullpost {
            margin-top: 8px;
        }
    }
    .row {
        .topic,
        .content-mask,
        .options {
            margin-left: 48px;
        }
        &.side {
            clear: both;
        }
    }
}

.forumpost .row .left {
    width: 48px;
}

.forumpost .options .commands {
    margin-left: 0;
}

.forumpost .subject {
    font-weight: bold;
}

// Override hardcoded forum modules styling
.forumsearch input[type=text] {
    margin-bottom: 0 !important; /* stylelint-disable-line declaration-no-important */
}

#page-mod-forum-discuss .discussioncontrols {
    width: auto;
    margin: 0;
}

#page-footer {
    margin-top: 1em;
    padding: 1em 0;
    border-top: 2px solid @tableBorder;
}

.maincalendar .calendarmonth td,
.maincalendar .calendarmonth th {
    border: 1px dotted @tableBorder;
}

.path-grade-report-grader h1 {
    text-align: inherit;
}

#page-mod-chat-gui_basic input#message {
    max-width: 100%;
}

#page-mod-data-view #singleimage {
    width: auto;
}

.path-mod-data form {
    margin-top: 10px;
}

.template_heading {
    margin-top: 10px;
}

.breadcrumb-button {
    float: right;
    margin-top: 4px;
}

.breadcrumb-button .singlebutton {
    float: left;
    margin-left: 4px;
}

.navbar-inverse .logininfo a {
    color: @navbarInverseLinkColor;
}
.navbar-inverse .logininfo a:hover {
    background-color: @navbarInverseLinkBackgroundHover; // "transparent" is default to differentiate :hover/:focus from .active
    color: @navbarInverseLinkColorHover;
}

.navbar-fixed-top,
.navbar-fixed-bottom {
    z-index: 4030;
}

.ie .row-fluid .desktop-first-column {
    margin-left: 0;
}
.langmenu form {
    margin: 0;
}
.container-fluid {
    max-width: 1680px;
    margin: 0 auto;
}
// contributed by Paul Hibbitts, see http://msdn.microsoft.com/en-us/library/ie/jj583807(v=vs.85).aspx
canvas {
    -ms-touch-action: auto;
}

div#dock {
    display: none;
}

// Choice module

.path-mod-choice {
    .media-left {
        float: left;
        padding-right: 1em;
    }
}

// Lesson module

.path-mod-lesson .firstpageoptions {
    margin: auto;
    min-width: 280px;
    width: 60%;
}

.path-mod-lesson .centerpadded {
    padding: 5px;
    text-align: center;
}

/** General styles (scope: all of lesson) **/
.path-mod-lesson .contents,
.path-mod-lesson .standardtable,
.path-mod-lesson .mform .box.contents,
.path-mod-lesson .invisiblefieldset.fieldsetfix tr {
    text-align: left;
}

.path-mod-lesson #layout-table {
    width: 100%;
}

.path-mod-lesson .edit_buttons form,
.path-mod-lesson .edit_buttons input {
    display: inline;
}

.path-mod-lesson .userinfotable .cell,
.path-mod-lesson .userinfotable .userpicture {
    vertical-align: middle;
}

.path-mod-lesson .invisiblefieldset.fieldsetfix {
    display: block;
}

.path-mod-lesson .slideshow {
    overflow: auto;
    padding: 15px;
}

.path-mod-lesson .menu .menuwrapper {
    max-height: 400px;
    overflow: auto;
    vertical-align: top;
    margin-bottom: 10px;
}

.path-mod-lesson .menu ul {
    list-style: none;
    padding: 5px 0 0 5px;
    margin: 0;
}
.path-mod-lesson .menu ul li {
    padding-bottom: 5px;
}
.path-mod-lesson .skip {
    position: absolute;
    top: -1000em;
    width: 20em;
}
.path-mod-lesson .branchbuttoncontainer.horizontal div,
.path-mod-lesson .branchbuttoncontainer.horizontal form {
    display: inline;
}
.path-mod-lesson .firstpageoptions {
    width: 30%;
    margin-left: 35%;
    margin-top: 1em;
}
.path-mod-lesson .progress_bar_table,
.path-mod-lesson .progress_bar_completed,
.path-mod-lesson .progress_bar_todo {
    padding: 0;
    margin: 0;
}
.path-mod-lesson .progress_bar_token {
    height: 20px;
    width: 5px;
    padding: 0;
    margin: 0;
}
.path-mod-lesson .edit_pages_box .addlinks {
    margin: 0;
    margin-bottom: 1em;
}
.path-mod-lesson .progress_bar_completed {
    background-color: green;
    text-align: right;
    vertical-align: middle;
    color: #fff;
}

.path-mod-lesson .resourcecontent {
    text-align: center;
}

.path-mod-lesson .answeroption .fcheckbox > span {
    position: relative;
    float: left;
}

.path-mod-lesson .answeroptiongroup .fgroup > span {
    position: relative;
    width: 100%;
}

.path-mod-lesson .answeroption .fcheckbox input,
.path-mod-lesson .answeroptiongroup input {
    position: absolute;
    top: 2px;
    margin-top: 0;
    left: 0;
}

.path-mod-lesson .answeroption .fcheckbox label,
.path-mod-lesson .mform .fitem.answeroptiongroup fieldset.fgroup label {
    padding-left: 20px;
    float: left;
}

.path-mod-lesson .answeroption .felement label p:last-child,
.path-mod-lesson .answeroptiongroup .felement label p:last-child {
    margin-bottom: 0;
}

/**
 * Style for view.php
 **/
#page-mod-lesson-view .password-form .submitbutton {
    display: inline;
}
.path-mod-lesson .reviewessay {
    width: 40%;
    border: 1px solid #ddd;
    background-color: #eee;
}

/* Countdown timer. */
#lesson-timer {
    text-align: center;
}

.path-mod-lesson .essayungraded {
    background-color: #efcfcf;
}

.path-mod-lesson .essaygraded {
    background-color: #efefcf;
}

.path-mod-lesson .essaysent {
    background-color: #cfefcf;
}

.path-mod-wiki .wiki_headingtitle,
.path-mod-wiki .midpad,
.path-mod-wiki .wiki_headingtime {
    text-align: inherit;
}

.path-mod-wiki .wiki_contentbox {
    width: 100%;
}

// Dropdown styling.
.dropdown-menu {
    > li > a {
        padding: 3px 20px 3px 8px;
    }
}

// Survey module

.path-mod-survey {
    .surveytable {
        > tbody > tr:nth-of-type(odd) {
            background-color: @tableBackground;
        }
        > tbody > tr:nth-of-type(even) {
            background-color: @tableBackgroundAccent;
        }
        .rblock label {
            text-align: center;
        }
    }
    .resultgraph,
    .reportsummary,
    .studentreport,
    .reportbuttons,
    .centerpara {
        text-align: center;
    }
}

.nav .caret {
    margin-left: 4px;
}

// Dividers
.nav {
    .divider {
        overflow: hidden;
        width: 0;
        height: @navbarHeight;
        border-left: 1px solid @navbarBackground;
        border-right: 1px solid @navbarBackgroundHighlight;
    }
}
.navbar-inverse {
    .nav {
        .divider {
            border-left-color: @navbarInverseBackground;
            border-right-color: lighten(@navbarInverseBackground, 25%);
        }
    }
}
.dropdown-menu {
    .divider {
        width: auto;
        height: 1px;
        border-left: 0 none;
        border-right: 0 none;
    }
}

// Usermenu
.usermenu {
    .login {
        color: @navbarText;
        line-height: 40px;
        a {
            color: @linkColor;
            &:hover,
            &:focus {
                color: @linkColorHover;
                text-decoration: underline;
            }
        }
    }
    .moodle-actionmenu {

        .toggle-display {
            display: block;
            opacity: 1;
            color: @navbarLinkColor;
            line-height: 40px;
            height: 40px;
            &:hover {
                color: @navbarLinkColorHover;
            }

            .userbutton {
                height: 40px;
                line-height: 40px;
                .avatars {
                    display: inline-block;
                    height: 36px;
                    width: 36px;
                    vertical-align: middle;
                    margin-right: 6px;
                    margin-left: 6px;

                    .avatar,
                    img {
                        display: block;
                    }
                }
                .usertext {
                    display: inline-block;
                    vertical-align: middle;
                    line-height: 1em;
                    color: inherit;
                    .meta,
                    .role {
                        display: block;
                        font-size: 12px;
                        .value {
                            font-weight: bold;
                        }
                    }
                    .role {
                        font-weight: bold;
                    }
                }
            }

            // Hide caret when JS is disabled.
            .caret {
                display: none;
            }
        }


        // A little bit of visual feedback for the action menu when Javascript is disabled.
        .menu {
            .menu-action.icon {
                img {
                    border-radius: 0;
                    background: transparent;
                    box-shadow: none;
                }
                &:hover img {
                    background: #fff;
                    border-radius: 4px;
                    box-shadow: 0 0 16px rgba(0, 0, 0, 0.125);
                }
            }
        }
        &[data-enhanced] .menu {
            .menu-action.icon,
            .menu-action.icon:hover {
                img {
                    border-radius: 0;
                    background: transparent;
                    box-shadow: none;
                }
            }
        }

    }
}
.navbar-inverse {
    .usermenu {
        .login {
            color: @navbarInverseText;
            a {
                color: @navbarInverseLinkColor;
                &:hover {
                    color: @navbarInverseLinkColorHover;
                }
            }
        }
        .moodle-actionmenu {
            .toggle-display {
                color: @navbarInverseLinkColor;
            }
            .userbutton {
                .usertext {
                    color: @navbarInverseLinkColor;
                    .meta {
                        color: @navbarInverseText;
                        .value {
                            color: @navbarInverseLinkColor;
                        }
                    }
                }
            }
            &:hover {
                .usertext {
                    color: @navbarInverseLinkColorHover;
                    .meta {
                        color: @navbarInverseText;
                        .value {
                            color: @navbarInverseLinkColorHover;
                        }
                    }
                }
            }
            &[data-enhanced] .toggle-display.textmenu {
                .caret {
                    border-top-color: @navbarInverseLinkColorHover;
                }
            }

            // A little bit of visual feedback for the action menu when Javascript is disabled.
            .menu {
                .menu-action.icon {
                    img {
                        border-radius: 0;
                        background: transparent;
                        box-shadow: none;
                    }
                    &:hover img {
                        background: #333;
                        border-radius: 4px;
                        box-shadow: 0 0 16px rgba(255, 255, 255, 1);
                    }
                }
            }
            &[data-enhanced] .menu {
                .menu-action.icon,
                .menu-action.icon:hover {
                    img {
                        border-radius: 0;
                        background: transparent;
                        box-shadow: none;
                    }
                }
            }
        }
    }
}

.jsenabled {
    .usermenu {
        .moodle-actionmenu {
            .toggle-display {
                display: block;

                &.textmenu {
                    padding-left: 8px;
                    padding-right: 8px;
                }

                // Show caret when JS is enabled.
                .caret {
                    display: inline-block;
                    position: relative;
                    top: 9px;
                }
            }

            > .menubar {
                display: block;
                margin: 0;
            }
            > .menu {
                min-width: 160px;
                .filler {
                    display: block;
                    .nav-divider();
                }
            }

            &.show {
                background-color: @navbarLinkBackgroundActive;
                .menu {
                    padding: 5px 0;
                    margin: 2px 0 0;
                    background-clip: padding-box;
                    &:before {
                        content: '';
                        display: inline-block;
                        border-left: 7px solid transparent;
                        border-right: 7px solid transparent;
                        border-bottom: 7px solid #ccc;
                        border-bottom-color: @dropdownBorder;
                        position: absolute;
                        top: -7px;
                    }
                    &:after {
                        content: '';
                        display: inline-block;
                        border-left: 6px solid transparent;
                        border-right: 6px solid transparent;
                        border-bottom: 6px solid @dropdownBackground;
                        position: absolute;
                        top: -6px;
                    }

                    a {
                        border-radius: 0;

                        &:focus {
                            text-decoration: none;
                        }
                        &:hover {
                            text-decoration: none;
                            #gradient > .vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%));
                        }
                    }
                    &.align-tr-br {
                        margin-top: 2px;
                    }
                    .box-shadow (0 5px 10px rgba(0, 0, 0, 0.2));
                }
            }
        }
    }
    .navbar-inverse {
        .usermenu {
            .moodle-actionmenu {

                &.show {
                    background-color: @navbarInverseLinkBackgroundActive;
                }
            }
        }
    }
}


.usermenu {
    float: right;
    > .moodle-actionmenu {
        > .menu {
            &:before {
                right: 9px;
            }
            &:after {
                right: 10px;
            }
        }
        > .menubar li a {
            text-align: right;
        }
    }
}
&.userloggedinas .usermenu .userbutton .avatars {
    .avatar {
        &.current {
            left: 16px;
        }
    }
}

.userloggedinas .usermenu .userbutton .avatars {
    .avatar {
        &.current {
            position: relative;
            top: 4px;
            left: 4px;
            width: 20px;
            height: 20px;
            margin-top: 11px;
            margin-bottom: -34px;
            border: 1px solid #fff;
            border-radius: 50%;
            box-shadow: -2px -2px 16px rgba(0, 0, 0, 0.25);
        }
        img {
            width: inherit;
            height: inherit;
        }
        overflow: hidden;
    }
}

// Quiz module

// Question navigation block.
.path-mod-quiz #mod_quiz_navblock {
    .qnbutton {
        text-decoration: none;
        font-size: 14px;
        line-height: 20px;
        font-weight: normal;
        background-color: @white;
        background-image: none;
        height: 40px;
        width: 30px;
        border-radius: 3px;
        border: 0;
        overflow: visible;
        margin: 0 6px 6px 0;
    }
    span.qnbutton {
        cursor: default;
        background-color: @inputDisabledBackground;
        color: @gray;
    }
    a.qnbutton:hover,
    a.qnbutton:active,
    a.qnbutton:focus {
        text-decoration: underline;
    }

    .qnbutton .thispageholder {
        border: 1px solid;
        border-radius: 3px;
        z-index: 1;
    }
    .qnbutton.thispage .thispageholder {
        border-width: 3px;
    }
    .allquestionsononepage .qnbutton.thispage .thispageholder {
        border-width: 1px;
    }

    .qnbutton.flagged .thispageholder {
        background: transparent url([[pix:theme|mod/quiz/flag-on]]) 15px 0 no-repeat;
    }

    .qnbutton .trafficlight {
        border: 0;
        background: @white none center/10px no-repeat scroll;
        height: 20px;
        margin-top: 20px;
        border-radius: 0 0 3px 3px;
    }

    .qnbutton.notyetanswered .trafficlight,
    .qnbutton.invalidanswer .trafficlight {
        background-color: @white;
    }
    .qnbutton.invalidanswer .trafficlight {
        background-image: url([[pix:theme|mod/quiz/warningtriangle]]);
    }
    .qnbutton.correct .trafficlight {
        background-image: url([[pix:theme|mod/quiz/checkmark]]);
        background-color: @successText;
    }
    .qnbutton.blocked .trafficlight {
        background-image: url([[pix:core|t/locked]]);
        background-color: @inputDisabledBackground;
    }
    .qnbutton.notanswered .trafficlight,
    .qnbutton.incorrect .trafficlight {
        background-color: @errorText;
    }
    .qnbutton.partiallycorrect .trafficlight {
        background-image: url([[pix:theme|mod/quiz/whitecircle]]);
        background-color: @orange;
    }
    .qnbutton.complete .trafficlight,
    .qnbutton.answersaved .trafficlight,
    .qnbutton.requiresgrading .trafficlight {
        background-color: @grayLight;
    }
}

// Scorm.
.path-mod-scorm .scorm-center {
    text-align: center;
}

.path-mod-scorm.forcejavascript .scorm-center {
    display: none;
}

.path-mod-scorm.jsenabled .scorm-center {
    display: block;
}

