﻿.dbqde-elements-container {
    float: left;
    width: calc(100% - #{$document-editor-side-menu-width} - #{$document-editor-tab-bar-width});
    height: 100%;
    position: relative;
    padding-left: 0;
    //background: #fff; /* This background is necessary to prevent a background image coming through whilst dragging a new element in towards the bottom of the element list. */
    background: $document-editor-background-color;
    z-index: $document-editor-layer-bottom-z-index;
}

#dbqde-elements-list {
    height: calc(100% - 56px);
    list-style-type: none;
    padding: 15px; // There used to be no padding on the bottom side, but this made the drop indicator nearly impossible to see when attempting to move an element to the bottom
    overflow-y: auto;
    //color: #000; // This is a quickfix for dark mode. Since the element list always has a white background, we must force the text color to black, otherwise dark mode will change it to white.
    @include scrollbar;
}

.dbqde-elements-sortable-list {
    float: left;
    position: relative;
    min-height: 100px;
    width: 100%;
    margin: 0;
    padding: 15px 0;

    // Reserve space for the drop indicator
    &::after {
        content: "";
        display: block;
        clear: both;
        height: $document-editor-element-drop-indicator-height;
        background-color: transparent;
    }

    &.dbqde-drop-element-after::after {
        background-color: $document-editor-element-drop-indicator-color;
    }
}

.dbqde-elements-list-empty {
    padding: 15px;
}

.dbqde-element-container {
    width: 100%;
    position: relative;
    float: left;
    margin-top: 7.5px;
    margin-bottom: 7.5px;
    min-height: 40px;

    .dbqde-element-type-name {
        position: absolute;
        top: 5px;
        left: 5px;
        border: 1px solid $global-border-color;
        //border-radius: 0 0 3px 0;
        border-radius: calc($global-border-radius / 2);
        padding: 0 4px;
        font-size: $font-size-small;
        font-weight: bold;
        display: none;
        z-index: $document-editor-layer-top-z-index;
        background: $color-layer-3;
        color: $text-color-default;
    }

    .dbqde-element-dirty {
        position: absolute;
        top: 5px;
        right: 5px;
        display: none;
        text-align: center;
        padding: 2px 8px 5px 8px;
        border-radius: 3px;
        font-size: 14px;

        i {
            margin-top: 5px;
        }
    }

    &.dbqde-element-dragging {
        opacity: 0.6;
    }

    // Reserve space for the drop indicator
    &::before {
        content: "";
        display: block;
        height: $document-editor-element-drop-indicator-height;
        background-color: transparent;
        transform: translateY(-7px); // This should be 7.5px, but when changing it to 7.5px the 1px line somehow becomes a 1.5-2px line and changing its color.
    }

    &.dbqde-drop-element-before::before {
        background-color: $document-editor-element-drop-indicator-color;
    }

    &[data-element-is-dirty='true']>.dbqde-element-dirty {
        display: block;
    }

    .dbqde-element-drag-button {
        display: none;
        position: absolute;
        //left: -12px;
        //top: calc(50% - 12px);
        top: -12px;
        left: calc(50% - 12px);
        padding: 2px;
        cursor: move;
        background: $document-editor-element-drag-button-background-color;
        box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1);
        border: none;
        border-radius: 50%;
        z-index: $document-editor-layer-top-z-index + 1;


        svg {
            fill: $document-editor-element-drag-button-icon-color;
            transform: rotate(90deg);
        }
    }

    .dbqde-element-function-buttons-container {
        background: $document-editor-element-function-buttons-container-background-color;
        display: none;
        align-items: center;
        position: absolute;
        top: 5px;
        right: 5px;
        border-radius: 5px;
        z-index: $document-editor-layer-top-z-index;

        .dbqde-element-function-button {
            background: none;
            outline: none;
            width: 30px;
            height: 30px;
            cursor: pointer;
            font-weight: 400;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            border: 1px solid transparent;
            font-size: 1rem;
            line-height: 0.4;
            transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;

            &.disabled {
                display: none;
            }

            svg {
                width: 20px;
                height: 20px;
                fill: $document-editor-element-function-button-icon-color;
            }

            &:hover {
                svg {
                    fill: $document-editor-element-function-button-icon-hover-color;
                }
            }

            &.dbqde-element-delete-button {
                &:hover {
                    svg {
                        fill: $document-editor-element-function-button-delete-icon-hover-color;
                    }
                }
            }
        }
    }

    .dbqde-element-invalid {
        color: $document-editor-error-color;

        svg {
            fill: $document-editor-error-color;
        }
    }
}

.dbqde-element-container-hover {
    /*background-color: #f8f8f8 !important;*/
    box-shadow: 0 0 10px 0.2rem rgba(255, 193, 7, .25);
    cursor: pointer;

    >.dbqde-element-function-buttons-container {
        display: flex;
    }

    >.dbqde-element-drag-button {
        display: block;
    }

    >.dbqde-element-type-name {
        display: block !important;
    }

    &[data-element-is-dirty='true'] {
        >.dbqde-element-function-buttons-container {
            right: 42px;
        }
    }
}

.dbqde-element-selected>.dbqde-element-spacer,
.dbqde-element-container-hover>.dbqde-element-spacer {
    border: 2px dashed $document-editor-element-block-border;
}

.dbqde-element-container-placeholder {
    float: left;
    width: 100%;
    /*border: 1px dashed red !important;*/
    border: 2px dashed #545454 !important;
    border-radius: 5px;
    margin-bottom: 15px;
    min-height: 45px;
}

.dbqde-element-container-collapsed {
    max-height: 50px;
    // overflow: hidden;
    border: 2px dashed $document-editor-element-block-border !important;

    .dbqde-element {
        position: absolute;
        overflow: hidden;
        height: 100%;
        opacity: 0.5;
    }

    .dbqde-element-column,
    .dbqde-element-block {
        border: 0 !important;
    }
}

.dbqde-element-selected {
    box-shadow: 0 0 10px 0.2rem rgba(0, 123, 255, .25);
}

.dbqde-element {
    width: 100%;

    &:not(.dbqde-element-columns):not(.dbqde-element-block) {
        pointer-events: none;
    }

    .dbqde-file-upload {
        width: 100%;
    }
}

.dbqde-element-header {}

.dbqde-element-header-level-1 {
    font-size: 40px;
    line-height: 40px;
}

.dbqde-element-header-level-2 {
    /*font-size: 36px;*/
    font-size: 30px;
    line-height: 40px;
}

.dbqde-element-header-level-3 {
    /*font-size: 32px;*/
    font-size: 26px;
    line-height: 36px;
}

.dbqde-element-header-level-4 {
    /*font-size: 28px;*/
    font-size: 22px;
    line-height: 32px;
}

.dbqde-element-header-level-5 {
    /*font-size: 24px;*/
    font-size: 18px;
    line-height: 28px;
}

.dbqde-element-text {
    float: left;
    font-size: 14px;
    line-height: 24px;
}

.dbqde-element-line {
    hr {
        border-top: 1px solid $text-color-default;
        margin-top: 22.5px;
    }
}

.dbqde-element-button {
    width: auto;
}

.dbqde-element-spacer {
    height: 15px;
    border: 0px dashed $document-editor-element-block-border;
}

.dbqde-element-binary-empty-container {
    margin-bottom: 0;
}

.dbqde-element-image {
    img {
        max-width: 100%;

        &.image-stretched {
            width: 100%;
        }

        &.image-left {
            float: left;
        }

        &.image-center {
            margin-left: auto;
            margin-right: auto;
            display: block;
        }

        &.image-right {
            float: right;
        }
    }
}

.dbqde-element-block {
    float: left;
    min-height: 50px;
    border: 2px dashed $document-editor-element-block-border;
    padding: 0 15px;
}

.dbqde-element-columns {
    float: left;
    display: flex;

    >.dbqde-element-column {
        border-width: 2px 2px 2px 0;
        border-style: dashed;
        border-color: $document-editor-element-block-border;
        overflow: hidden;

        &:first-of-type {
            border-left: 2px dashed $document-editor-element-block-border;
        }
    }
}

.dbqde-element-column {
    float: left;
    min-height: 120px;
    padding: 0 15px;
    width: 50%;
    display: block;

    >.dbqde-elements-sortable-list {
        min-height: 100% !important;
    }
}

.dbqde-element-video {}

.dbqde-element-map {}

.button-image {
    height: 20px;
    width: 20px;

    &.left,
    &.center {
        margin-right: 5px;
    }

    &.right {
        margin-left: 5px;
    }
}


// Element preview styling
.dbqde-element-preview {
    .dbqde-element-label-name {
        font-size: 20px;
        font-weight: bold;
    }

    .dbqde-element-background {
        padding: 15px;
        width: 100%;
        background: $color-layer-2;
        text-align: center;

        .dbqde-element-icon {
            font-size: 100px;
            color: $text-color-default;
        }
    }
}

.dbqde-element-graph-preview {
    .dbqde-element-graph-name {
        font-size: 20px;
        font-weight: bold;
    }

    .dbqde-element-graph-background {
        padding: 15px;
        width: 100%;
        background: $color-layer-2;
        text-align: center;

        .dbqde-element-graph-icon {
            font-size: 200px;
            color: $text-color-default;
        }
    }
}

.dbqde-element-map-preview {
    .dbqde-element-map-background {
        padding: 15px;
        width: 100%;
        background: $color-layer-2;
        text-align: center;

        .dbqde-element-map-icon {
            font-size: 200px;
            color: $text-color-default;
        }
    }
}