/*

Styles for commons fields along the backend

*/

// COMMONS ELEMENTS:

.glossaryTermPopup {
    border-radius: $border-radius-xs;
    background-color: $color-palette-gray-200;
    padding: (calc($field-padding / 2)) $field-padding;
    border: solid 1px $color-palette-gray-400;
    position: absolute;
}

//BINARY FILE

#fileAssetThumbnailSliderWrapper {
    margin-bottom: $spacing-1;
}

.fileAjaxUploader {
    display: flex;
    align-items: center;
    border-radius: $border-radius-xs;
    position: relative;
    height: 36px;

    .fileAjaxUploaderForm {
        border: solid 1px $color-palette-gray-500;
        width: 100%;
    }

    input[type="file"]::-webkit-file-upload-button {
        background-color: $color-palette-primary;
        height: 36px;
        border: 0;
        color: $white;
        cursor: pointer;
        padding: 0 1rem;

        &:hover {
            background-color: $color-palette-primary-400;
        }
    }

    &Actions div {
        display: inline-block;

        &:first-child {
            margin-right: $spacing-1;
        }
    }

    &FileName {
        margin-right: $spacing-1;
    }

    &Status {
        align-items: center;
        display: flex;
        position: absolute;
        right: $spacing-1 * 2;
    }

    &StatusMsg {
        margin-left: $spacing-1;
    }

    .dijitProgressBar {
        width: 150px;
    }
}

// CATEGORY

.catPreview {
    background-color: $white;
    border-radius: $border-radius-xs;
    border: solid 1px $color-palette-gray-500;
    margin-top: $spacing-1;
    max-width: $content-edit-field-max-width;
    min-height: 38px;
    padding: calc($spacing-1 / 2);

    li {
        background: $color-palette-gray-200;
        border-radius: $border-radius-xs;
        border: $field-normal-border;
        display: inline-block;
        font-size: $font-size-xs;
        margin: 2px 5px 2px 0px;
        padding: (calc($spacing-1 / 2)) $spacing-1 (calc($spacing-1 / 2)) (calc($spacing-1 / 2));
        position: relative;
        text-decoration: none;
    }

    a {
        display: inline-block;
        vertical-align: sub;

        &:hover {
            color: #cc0000;
        }
    }
}

// FILES

.fileSelectorControls {
    @extend #inline-form;

    .dijitTextBox {
        width: 300px;
    }
}

// LINE DIVIDER

.lineDividerTitle {
    color: $color-palette-gray-700;
    font-size: $font-size-lg;
    border-bottom: 1px solid $color-palette-gray-400;
    padding-bottom: $spacing-1 * 2;
    margin: $spacing-1 * 6 0 $spacing-1 * 3;
}

// TEXTAREA

#editor-toolbar {
    display: flex;
    justify-content: space-between;
    margin-top: $spacing-1;

    .checkbox,
    .radio {
        margin: 0;
    }
}

.editor-toolbar {
    @extend #editor-toolbar;
    max-width: $content-edit-field-max-width;
    width: 100%;
}

.langVariablesField {
    .glossaryTermPopup {
        right: -8px;
        bottom: 36px;
    }
}

// WYSIWYG Tools

.wysiwyg-tools {
    @extend #editor-toolbar;

    .dijitSelect {
        width: auto;
    }
}

.wysiwyg-wrapper {
    width: 100%;
    max-width: $content-edit-field-max-width;
}

// KEY/VALUE
$key-val-width: 500px;

.key-value-form {
    display: flex;
    margin-bottom: $spacing-1 * 2;
    width: $key-val-width;

    .dijit {
        margin-right: $spacing-1;

        &:last-child {
            margin-right: 0;
        }
    }
}

.key-value-items {
    width: $key-val-width;

    .listingTable {
        th,
        td {
            &:first-child {
                padding-left: $spacing-1;
            }
        }
    }
}

// TAGS

.tagsOptions {
    background: $white;
    border: $field-normal-border;
    min-width: 175px;
    padding-top: 7px;
    position: absolute;
    z-index: 1;

    &:before {
        background-color: $white;
        border-left: $field-normal-border;
        border-top: $field-normal-border;
        content: "";
        height: 10px;
        left: 5px;
        position: absolute;
        top: -6px;
        transform: rotate(45deg);
        width: 10px;
    }

    .personaIcon,
    .tagIcon {
        margin-right: 5px;
        opacity: 0.7;
    }

    h3 {
        background-color: $color-palette-gray-500;
        border-bottom: $field-normal-border;
        margin-bottom: 0;
        padding: 5px 10px;
    }

    a {
        border-bottom: $field-normal-border;
        cursor: pointer;
        display: block;
        padding: 5px 10px;
        text-decoration: none;
        white-space: nowrap;

        &:hover {
            background-color: $color-palette-gray-400;
        }

        &:last-child {
            border-bottom: none;
        }
    }
    .suggestedTagFocus {
        background-color: $color-palette-gray-400;
        box-shadow: none;
        outline: 0;
    }
}

.tagLink {
    height: 1.5rem;
    padding: $spacing-1;
    background: $color-palette-primary-200;
    border-radius: $border-radius-sm;
    color: $color-palette-primary;
    font-size: $font-size-sm;
    line-height: 0.374rem;
    text-align: center;
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: auto;
    max-width: 112px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-left: calc($spacing-1 + $font-size-sm);
    position: relative;

    &.persona {
        &:before {
            @extend #dijit-icon;
            content: $fa-var-user;
            display: flex;
        }
    }

    &:after {
        position: absolute;
        left: $spacing-1;
        color: $color-palette-primary;
        content: "\2715";
        font-size: $font-size-sm;
        text-align: center;
        line-height: 0.374rem;
    }

    &:hover {
        border: 1px solid $color-palette-primary;
    }
}

.tagsWrapper {
    position: relative;

    .dijitTextBox {
        min-height: $field-height-md;
        height: auto; // This fields grows while we add tags, we can't have a fix height.
        padding: $spacing-1;
        display: flex;
        flex-wrap: wrap;
        gap: $spacing-1;
    }

    .dijitInputContainer {
        display: inline-block;
        vertical-align: middle;
    }
}

.field__editable-content {
    display: flex;
    align-items: center;

    a {
        margin-right: $spacing-1 * 2;
    }
}
