$buttonActiveTextColor: #fff !default;

/** START: LEGACY: Remove this for Mapbender 5 */

.mb-element-data-manager .mapbender-element-result-table {
    > .dataTables_wrapper {
        > .row:first-child {
            .col-md-6:first-child {
                width: 0;
            }

            .col-md-6:last-child {
                width: 100%;

                .dataTables_filter {
                    text-align: left;

                    label {
                        width: 100%;
                        padding-left: 2px;

                        input {
                            display: block;
                            width: 100%;
                            margin-left: 0;
                        }
                    }
                }
            }
        }

        > .row:last-child {
            text-align: center;

            .col-sm-12 {
                width: 100%;
                margin-bottom: 7px;
            }

            .col-sm-12:last-child .pagination {
                justify-content: center;
            }
        }
    }
}
/** END: LEGACY **/



.mb-element-data-manager {
    padding-right: 7px;

    .data-container {
        margin-top: 1.5ex;
    }

    .loading-indicator {
        text-align: right;
        // move spinning icon content slightly left to prevent horizontal overflow and flickering scrollbar
        padding-right: 0.25em;
        opacity: 0; // hidden without affecting layout size
        // Do not take up vertical layout space (we have margins to fall into)
        height: 0;
        overflow-y: visible;
    }

    color: #555;
    font-size: 0.85rem;

    table thead th {
        white-space: nowrap;
    }

    .mapbender-element-result-table {
        .dt-search {
            &, .label, input {
                width: 100%;
                text-align: left;
                margin-left: 0;
                margin-right: 0;
            }
        }

        .dt-info {
            margin-top: 10px;
        }

        .btn-group {
            white-space: nowrap;

            > .btn {
                // Bootstrap default float: left on .btn-group > .btn forces computed display: block, allowing horizontal
                // collapse of the column and spreading the buttons over mulitple lines
                // @see https://stackoverflow.com/questions/28482145/browsers-seem-to-be-ignoring-displayinline-block-and-rendering-as-block
                // => disable float
                float: none;
                font-size: inherit;
                padding: 0.28em; // ~3px on 11px font-size
            }
        }
        td:last-child {
            padding: 0.2rem 0.5rem;
        }
    }

    // Right-align buttons even if columns have no (configured!) CSS width
    td.interface {
        text-align: right;
    }

    td:not(.no-clip) {
        overflow-x: hidden;
        text-overflow: ellipsis;
        // Ellipsis requires a width property; see https://stackoverflow.com/a/11877033
        max-width: 0;
    }

    // Enable tooltips on disabled buttons
    .btn[disabled][title] {
        pointer-events: auto;
        cursor: not-allowed;

        &:hover {
            // Prevent any hover effects on disabled buttons while keeping tooltips
            background-color: inherit !important;
            border-color: inherit !important;
            color: inherit !important;
        }
    }
}

.ui-dialog.data-manager-dialog {

    textarea.form-control {
        min-height: 0;
    }

    label input[type=radio] {
        margin-right: 10px;
    }

    .text {
        white-space: pre-line;
    }


    &:focus {
        outline: none;
    }

    background: #fff;

    .ui-dialog-content, .ui-dialog-bottonpane {
        background: transparent;
    }

    display: flex;
    flex-direction: column;

    .ui-dialog-content {
        flex: 1 1 auto;
        height: initial !important; // Overrule inline style
    }

    .ui-dialog-titlebar, .ui-dialog-buttonpane {
        flex: 0 1 auto;
    }

    max-height: 100vh;
    border: 1px solid #b3b3b3;

    .ui-dialog-button-pane {
        border-bottom: 5px solid #b3b3b3;
    }

    .ui-dialog-titlebar {
        line-height: 2;
        padding: 0 0 0 15px;
        background-color: $buttonFirstActiveColor;
        color: $buttonActiveTextColor;

        .ui-widget-header, .ui-button {
            color: inherit;
        }

        font-size: 16px;

        > .ui-button, > .ui-dialog-titlebar-buttonpane {
            font-size: inherit;
            float: right;
            border: none;
            text-indent: 0;
            outline: none;
            background: transparent;
        }

        .ui-dialog-titlebar-close {
            &:before {
                content: "\f00d"; // =.fa-times
                font-family: "FontAwesome", "Font Awesome 5 Free", "Font Awesome 5 Pro";
            }

            .ui-button-icon {
                display: none;
            }
        }
    }

    .ui-dialog-title {
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    }

    .ui-dialog-content {
        min-width: 100%;
    }

    a.ui-button {
        // jquerydialogextendjs uses anchors instead of buttons
        text-decoration: none;
    }

    .ui-dialog-buttonpane {
        padding: 15px;
        text-align: right;

        .btn + .btn {
            margin-left: 5px;
        }
    }
}

// Pop-up dialogs
.ui-dialog-content.data-manager-edit-data {
    overflow-y: auto;
    color: #707070;
    font-size: 11px;

    textarea:required,
    select:required ,
    input:required,
    .select2-required .select2-selection {
        border: 2px solid #D5A99F;
        border-radius: 4px;
        transition: border-color 0.3s ease
    }

    > .ui-tabs .ui-tabs-panel, &.content-padding {
        padding: 15px;
    }

    .ui-tabs {
        > .ui-tabs-nav {
            line-height: 2.5;

            .ui-tabs-tab {
                list-style: none;
                float: left;
                cursor: pointer;

                &.ui-state-active {
                    background-color: $buttonFirstActiveColor;
                }

                a {
                    padding: 0 1em;

                    &, &:hover {
                        text-decoration: none;
                    }
                }

                &:focus, a:focus {
                    outline: none;
                }
            }
        }
    }

    .input-group .colorpicker.dropdown-menu {
        // .dropdown-menu: position: absolute; left: 0
        left: initial;
        right: 1%; // =width of .input-group-addon
    }

    .ui-tabs-nav {
        padding: 0;
    }

    label, .form-control {
        font-size: inherit;
    }

    .form-control {
        border-radius: 0;
    }

    .file-group {
        display: flex;
        flex-direction: row;

        > i, > a {
            flex: 0 0 auto;
        }

        .fileinput-button {
            flex: 0 1 auto;
        }

        > a {
            margin: 0 0.5em;
        }

        > i.fa-spin {
            // Keep icon centered by forcing line-height pixels equal to height pixels
            line-height: 2;
            height: 2em;
        }

        .fa-external-link-alt {
            // Work around bad vertical glyph kerning (obvious mismatch vs trash can icon)
            padding-top: 0.1em;
        }
    }

    .fileinput-button {
        position: relative;

        input {
            opacity: 0;
            // Stretch to cover entire button (including padding)
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            width: 100%;
        }

        max-width: 100%;
        overflow-x: hidden;
        text-overflow: ellipsis;
    }

    .row.reduce-gutters {
        > :nth-child(1n+2) {
            padding-left: 0;
        }
    }

    hr {
        border: none;
        background: #ccc;
        height: 1px;
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .upload-button-text {
        margin-left: 0.5em;
    }

    label + div.radio, label + div.checkbox {
        margin-top: 0;
    }

}

.data-manager-datepicker {
    padding: 10px;
    width: 14em;

    .ui-datepicker-title {
        margin-left: 0.5em;
        margin-right: 0.5em;
    }
}
