//##############################################################################
// CONTENT

html {
    // makes sure that content-related has a height of 100%
    position: relative;
}

// containers
body {
    #container {
        position: static;
        width: auto !important;
        // makes sure that object tools not overlaps title #84
        min-width: 768px !important;
        padding-top: 0 !important;
        .breadcrumbs {
            position: absolute;
            top: 0;
            right: 3%;
            left: 3%;
            color: $gray !important;
            font-size: $font-size-normal;
            margin-top: $toolbar-height + 2;
            padding: $breadcrumb-padding 10px;
            border-top: 0;
            border-bottom: 1px solid $gray-lighter;
            background: transparent !important;
            a {
                color: $color-primary;
                &:first-child {
                    padding-left: 0;
                }
                &:hover {
                    color: $color-primary-dark !important;
                    text-decoration: none;
                }
            }
        }
        .breadcrumbs + .messagelist + #content,
        .breadcrumbs + #content {
            // calculates correct width by removing margin left and right
            margin-left: calc(3% + 10px) !important;
        }
    }
}
ul.messagelist + #content {
    // plus messages list height
    margin-top: $content-margin-top + 27px !important;
}
#content {
    width: auto !important;
    min-width: 0 !important;
    margin: $content-margin-top 3% 0 !important;
    padding: 0 !important;
    &.colMS {
        margin-right: 35% !important;
    }
    .module {
        padding: 0;
    }
}
#sitemap {
    clear: both;
}
#applications-group {
    h2 {
        margin-bottom: 30px;
    }
    .module {
        overflow: visible;
    }
    // reset table styles in applications group #193
    table {
        width: 100% !important;
        margin-left: 0 !important;
        box-shadow: none;
    }
}

// module
.module {
    @include box();
    margin-bottom: 0;
    background: none !important;
    &.collapse {
        display: block;
        margin-bottom: 0;
    }
    h2 {
        color: $gray-darkest;
        font-size: $font-size-large !important;
        font-weight: normal;
        margin-top: 0;
        margin-bottom: 15px;
        padding: 10px;
        border-bottom: 1px solid $gray-lighter;
        background: none;
    }
    caption {
        color: $gray;
        font-size: $font-size-normal !important;
        font-weight: normal;
        line-height: $font-size-normal;
        text-transform: uppercase;
        margin: 0 0 10px 10px;
        padding: 0;
        background: none;
        a.section,
        a.section:link,
        a.section:visited {
            color: $gray;
        }
    }
    table {
        margin: 0;
        padding: 0;
        thead th {
            padding: 20px 10px;
        }
        th {
            line-height: 13px;
            padding: 16px 10px;
        }
        td {
            line-height: 13px;
            padding: 8px 0 8px 40px;
        }
    }
}

// inlines
.inline-group {
    margin-top: 10px; // consistency with django 1.8
}
.module h2,
.module caption,
.inline-group h2 {
    color: $gray-darkest;
    font-size: $font-size-normal;
    font-weight: normal;
    line-height: $font-size-normal;
    padding-left: 0;
    letter-spacing: 0;
    background: none;
}
.inline-group h2 {
    text-transform: none;
}
.djangocms-admin-style .inline-group {
    @include box();
    overflow: auto;
    padding: 0;
    border: 0;
    .module {
        padding: 0;
        border: none !important;
        border-radius: 0;
        background: none !important;
        box-shadow: none;
        overflow: auto;
        h2 {
            font-size: $font-size-large !important;
            margin-bottom: 10px;
            padding-top: 0;
        }
        .add-row a {
            color: $color-success;
            border-bottom: none;
            &:before {
                color: $color-success;
            }
            &:hover {
                color: $color-success-dark !important;
            }
        }
        .add-row td {
            padding: 10px 0 !important;
            border-bottom: solid 1px $gray-lighter !important;
            background: none;
        }
        tr.add-row:hover {
            background: none;
        }
        .form-row {
            border-bottom: none !important;
        }
    }
    .add-row {
        border-bottom: 0 !important;
        &,
        td {
            border-bottom: none;
            background: none !important;
        }
        a {
            color: $color-success;
            font-size: $font-size-normal !important;
            padding-left: 0 !important;
            background: none !important;
            &:before {
                color: $color-success;
            }
        }
    }
}
#taggit_taggeditem_items-group {
    width: 80%;
    h2 {
        font-size: $font-size-large;
        font-weight: bold;
    }
    h3 {
        color: $gray-darkest;
        margin-top: 20px;
    }
    .module {
        width: 100%;
        margin: 0;
        padding: 10px 0;
        border-top: solid 1px $gray-lighter !important;
        border-bottom: solid 1px $gray-lighter !important;
    }
    .add-row {
        margin-top: 10px;
    }
    .inline-deletelink {
        color: $gray-darkest !important;
        // make sure that only icon is displayed
        font: 0/0 a;
        text-indent: inherit;
        &:before {
            font-size: $font-size-small;
        }
    }
}
.inline-related {
    margin-bottom: 5px;
    h3 {
        color: $gray;
        font-weight: normal;
        margin-bottom: 0;
        padding: 0;
        border-bottom: none;
        background: none;
        b,
        span {
            font-size: $font-size-normal;
            font-weight: normal;
        }
        span.delete label {
            // float label next to checkbox on tagged items #253
            display: inline-block;
            line-height: 20px;
            margin: 0 !important;
        }
        span.delete input {
            top: -3px;
            min-height: 0px;
        }
    }
    table {
        // calculates the correct width by removing margin left and right
        width: calc(100% - 4px) !important;
        margin: 0 2px !important;
    }
}
.inline-group[data-inline-type="stacked"] .inline-related {
    margin: 25px 5px 10px;
    box-shadow: $base-box-shadow;
    h3 {
        padding: 20px 25px;
        background: $gray-lightest;
        b,
        span {
            font-size: $font-size-large;
        }
        span {
            color: $black;
        }
    }
    fieldset.module {
        padding: 20px 25px !important;
    }
    input.vTextField,
    input.vURLField,
    textarea.vLargeTextField,
    .selector .selector-filter input {
        width: 100% !important;
    }
    .selector .selector-available h2,
    .selector .selector-chosen h2 {
        font-size: $font-size-normal !important;
        padding-top: 10px;
    }
}
.djangocms-admin-style .submit-row {
    margin: 10px -25px 0;
    padding: 20px 25px 0;
    border: 0;
    border-top: 1px solid $gray-lighter;
    border-radius: $border-radius-base;
    background: none;
    box-shadow: none;
    .deletelink-box {
        margin: 0;
    }
    .deletelink {
        @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
        @include icon(trash-o);
        display: block;
        padding: 9px 20px !important;
        height: 36px;
        box-sizing: border-box;
    }
    input[type="submit"] {
        padding: 10px 20px !important;
        height: 36px;
        &.default {
            margin-left: 10px;
            padding: 10px 20px !important;
        }
    }
    input {
        width: auto !important;
        height: 36px;
        margin-left: 10px;
    }
}

// filter horizontal m2m
.sortedm2m-container {
    width: 100% !important;
    // make sure that list items don't have a fixed width to not break mobile view #282
    ul.sortedm2m,
    ul.sortedm2m li {
        width: 100%;
    }
    .sortedm2m {
        min-height: initial !important;
        // shows full list content without vertical scrollbar #284
        max-height: initial !important;
        padding: 10px 0 !important;
        border: 0 !important;
        li {
            white-space: initial;
            padding: 0 !important;
            border: 0 !important;
        }
        // make sure that if label breaks to new line that it is aligned #283
        label {
            // make sure that link after label doesn't break to new line #287
            display: inline-block;
            position: relative;
            line-height: 20px;
            padding-left: 20px !important;
            input {
                position: relative;
                top: auto;
                margin-left: -20px;
            }
        }
    }
    input[type="checkbox"],
    label {
        vertical-align: middle !important;
        span {
            // sets correct font size for labels #204
            font-size: 16px !important;
        }
    }
    .selector-filter {
        position: relative;
        width: 100% !important;
        input {
            width: calc(100% - 50px) !important;
            margin: 0px 50px 5px 0 !important;
        }
        img {
            position: absolute;
            right: 0;
            margin: 0;

            order: 2;
        }
    }
}
.selector {
    width: 100%;
    .selector-available,
    .selector-chosen {
        box-sizing: border-box;
        width: calc(47.5% - 5px);
        padding: 0 10px 5px;
        border: 1px solid $gray-lighter;
        border-radius: $border-radius-base;
        background-color: $white;
        h2 {
            color: $gray !important;
            font-size: $font-size-normal !important;
            font-weight: normal;
            line-height: $line-height-normal;
            text-transform: uppercase;
            margin-bottom: 5px;
            border: none;
            background: none !important;
        }
        input {
            width: 252px;
            margin: -5px 0 2px;
        }
        select[multiple] {
            height: 17.2em !important;
            background: $white !important;
        }
        .help-icon,
        img {
            width: 15px !important;
            height: 15px !important;
        }
    }
    .selector-chosen {
        select[multiple] {
            height: 248px !important;
        }
    }
    .selector-add,
    .selector-remove {
        font-size: 0;
        text-indent: 0;
        width: 22px;
        height: 22px;
        background: none;
        opacity: 0.5;
        &:before {
            font-size: 22px;
            margin: 0;
        }
        &.active {
            opacity: 1;
        }
    }
    a.selector-chooseall,
    a.selector-clearall {
        display: inline-block;
        height: 16px;
        color: $color-primary;
        font-weight: normal;
        background-image: none;
        padding: 3px 0 3px 18px;
        margin: 0;
        opacity: 0.5;
        overflow: visible;
        &:before {
            color: $gray-light;
        }
        &.active {
            opacity: 1;
            font-weight: normal;
            background-image: none;
            &:before {
                color: $color-primary;
            }
        }
    }
    .selector-filter {
        padding-right: 0;
        padding-left: 0;
        border: none;
        padding: 3px 0;
        label {
            display: none;
        }
        input {
            width: 100% !important;
            margin-bottom: 5px;
        }
    }
    select[multiple] {
        overflow-y: auto;
        width: 100% !important;
        margin-bottom: 5px;
        padding: 0;
        border: 1px solid $gray-lighter !important;
        // hides dropdown icon which is generally added to select fields #216
        background: none !important;
        option {
            font-size: $font-size-normal;
            line-height: $line-height-normal;
            white-space: normal;
            width: 100%;
            padding: 10px;
            border-bottom: solid 1px $gray-lighter;
        }
    }
    a {
        font-size: $font-size-normal;
        &:hover {
            color: $color-primary !important;
        }
    }
    ul.selector-chooser {
        width: 5% !important;
        margin: 10em 5px 0 5px !important;
        border: 0;
        // hides background image because of icon font replacement #216
        background: none;
        background-color: transparent;
        li {
            text-align: center;
            padding: 3px;
            border: 0;
        }
        a {
            display: inline-block;
            vertical-align: middle;
            margin-right: 0;
            margin-bottom: 0;
        }
    }
}

a.addlink {
    &,
    &:link,
    &:visited {
        color: $color-success;
    }
    &:hover,
    &:focus,
    &:active {
        color: $color-success-dark !important;
    }
}

#content-main .object-tools {
    .addlink {
        @include button-variant($btn-action-color, $btn-action-bgcolor, $btn-action-border, true);
        font-weight: normal;
        height: auto !important;
        padding: 6px 20px !important;
    }
    .recoverlink {
        color: $color-primary !important;
        font-weight: normal;
        text-decoration: underline;
        padding: 9px 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background-color: transparent !important;
        &:hover,
        &:active,
        &:focus {
            color: $color-primary-dark !important;
            text-decoration: underline !important;
            background-color: transparent !important;
            box-shadow: none !important;
        }
    }
    a:before {
        margin-left: -5px;
    }
}

// object tools
.object-tools {
    float: right;
    text-align: right;
    // make sure that buttons are aligned with title
    margin-top: -54px;
    margin-left: 0;
    background: $gray-lightest;
    white-space: nowrap;
    &:before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        left: -20px;
        background: linear-gradient(to right, rgba($gray-lightest, 0), $gray-lightest);
    }
    li {
        display: inline-block;
        float: none;
        height: auto;
        margin-left: 10px;
        list-style: none;
        background: none;
        &:hover {
            background: none;
        }
        > a {
            @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
            line-height: inherit !important;
            height: auto !important;
            margin-right: 0 !important;
        }
    }
    .addlink {
        @include button-variant($btn-action-color, $btn-action-bgcolor, $btn-action-border, true);
        color: $white !important;
    }
    .publishlink {
        @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
    }
    .previewdraftlink {
        @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
    }
    .revertlink {
        @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
    }
    .historylink {
        @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
    }
    .viewsitelink {
        @include button-variant($btn-action-color, $btn-action-bgcolor, $btn-action-border, true);
    }
}

// tools need to be visible on an apphook page #202
.cms-admin-modal .object-tools {
    margin-top: -7px;
}
.cms-admin-modal .hide-in-modal {
    display: none;
}

// delete page
.delete-confirmation .colM {
    @include box();
    margin: 15px !important;
    padding: 25px !important;
    background-color: $white;
    box-shadow: $base-box-shadow;
    &#content {
        padding: 25px !important;
    }
    ul {
        margin-top: 10px;
    }
    // adds trash icon before p if it follows after h1 #184
    h1 + p {
        @include icon(trash);
        margin-top: -5px;
        margin-bottom: 0;
        &:before {
            font-size: 40px;
        }
    }
    h1 {
        // hides h1 because of doubled content #184
        display: none;
    }
    input[type="submit"] {
        @include button-variant($btn-action-color, $btn-action-bgcolor, $btn-action-border, true);
        float: right;
        line-height: 22px;
    }
    form {
        padding: 0 !important;
        background: none;
        box-shadow: none;
    }
}

// cms pagelist
#sitemap li a.addlink,
#sitemap li a.deletelink {
    width: 11px;
    height: 11px;
}
.tree {
    .col1 .changelink {
        float: left;
        line-height: $font-size-large !important;
        margin: 6px 0 0 15px !important;
    }
}

// cms language buttons
.djangocms-admin-style {
    #page_form_lang_tabs,
    .parler-language-tabs {
        margin-bottom: 30px;
        border-bottom: solid 1px $gray-lighter;
    }
}
#page_form_lang_tabs input,
.parler-language-tabs span {
    color: $gray-darkest !important;
    font-size: $font-size-normal !important;
    font-weight: normal !important;
    text-transform: uppercase !important;
    margin: 0;
    padding: 10px 20px !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    &:hover,
    a:hover,
    &:focus,
    a:focus {
        color: $black !important;
        background-color: transparent !important;
    }
    &.selected,
    &.current {
        color: $color-primary !important;
        border-bottom: solid 3px $color-primary !important;
        background: transparent !important;
    }
    &.notfilled {
        color: $gray !important;
        background: transparent !important;
        &:hover,
        &:focus {
            color: $black !important;
            border-bottom: solid 3px $white !important;
            background-color: $white !important;
        }
    }
    a {
        color: $gray-darkest !important;
    }
}
.parler-language-tabs span {
    padding: 0 !important;
}
.parler-language-tabs .current,
.parler-language-tabs a {
    display: inline-block;
    padding: 10px 20px !important;
}

#lang_tab_content h2.header {
    position: relative;
    margin-bottom: -3px !important;
    border-top-right-radius: $border-radius-base;
    background: $color-primary !important;
}

// nani/hvad language buttons
.nani-language-tabs {
    position: relative;
    margin-bottom: -3px;
    border-bottom: 5px solid $color-primary;
    > span {
        display: inline-block;
        top: 0 !important;
        color: $gray-darkest !important;
        font-weight: normal !important;
        vertical-align: top;
        margin: 0 !important;
        padding: 8px 10px !important;
        border: none !important;
        background: $white;

        border-top-radius: $border-radius-base;
        a {
            color: $gray-darkest !important;
            padding: 5px 10px;
            &:hover,
            &:focus {
                color: $black !important;
                text-decoration: none;
            }
        }
        .deletelink {
            display: inline;
            right: -3px !important;
            bottom: 0 !important;
            margin: 0;
            padding: 0 0 0 12px !important;

            border-top-radius: 0;
        }
    }
    > .empty {
        color: $gray;
        opacity: 1 !important;
        background: $gray-lighter;
    }
    > .current {
        color: $white !important;
        text-shadow: 0 1px 1px rgba($black-fallback, 0.2);
        padding-right: 20px !important;
        padding-left: 20px !important;
        background: $color-primary;
    }
    > .current .deletelink {
        right: -12px !important;
    }
}
.inline-group .nani-language-tabs {
    margin-bottom: 0;
    > span {
        padding: 4px 10px !important;
    }
    > .current {
        padding-right: 20px !important;
        padding-left: 20px !important;
    }
    > .available {
        background: $gray-lighter;
    }
}

// CKEditor max-size fix #310
.cke_maximized {
    z-index: z(ckmaximized);
}

// attributes field
.attributes-pair .field-box {
    margin-bottom: 10px;
}
.attributes-pair .field-box:first-child {
    padding-right: 15px;
}
