/// Form editor styles

/// Vuejs transitions:
.appear-transition {
    transition: opacity .2s ease;
    opacity: 1;
}

// .appear-enter defines the starting state for entering
// .appear-leave defines the ending state for leaving
.appear-enter, .appear-leave {
    opacity: 0;
}

.toggle-row-transition {
    transition: max-height .1s ease;
    max-height: 50px;
}

.toggle-row-enter, .toggle-row-leave {
    max-height: 0;
}

.field-definition {
    .hidden-definition-field {
        height: 0;
        overflow: hidden;
    }

    .vLargeTextField {
        max-width: 100%;
    }
}

.form-editor, .properties-pane {
    &, *, *::before, *::after {
        box-sizing: border-box;
    }
}

.icon-button {
    border: 0 !important;
    width: 1.5em !important;
    height: 1.5em;
    overflow: hidden;
    padding: 0 !important;
    background: none !important;
    white-space: nowrap;
    cursor: pointer;

    &::before {
        display: inline-block;
        width: 100%;
        height: 100%;
        content: '';
    }

    &.add-button::before {
        background: url('../img/plus.svg') no-repeat center center;
    }
    &.edit-button::before {
        background: url('../img/pencil.svg') no-repeat center center;
    }
    &.delete-button::before {
        background: url('../img/trash.svg') no-repeat center center;
        background-size: 100%;
    }
}

.form-editor {
    .form-page {
        margin-bottom: 2em;
        min-height: 50px;
    }

    .page-title {
        padding: 0;

        &::before {
            display: inline-block;
            margin-right: 0.5em;
            width: 1.2em;
            height: 1.2em;
            background: url('../img/file-empty.svg') no-repeat center left;
            content: '';
        }
    }

    .sortable-items {
        &::after {
            display: table;
            clear: both;
            content: '';
        }
        &:empty::after {
            padding: 2px 10px;
            content: attr(data-empty-text);
        }
    }

    .form-fieldset {
        min-height: 80px;
    }
    .fieldset-header {
        .legend {
            float: left;
            margin-right: 20px !important;
        }
    }

    .form-row {
        position: relative;
        margin-bottom: 10px;
        box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.08);
        border-radius: 3px;
        min-height: 50px;
        background-color: #FAFAFA;
    }

    .drag-handle {
        display: block;
        overflow: hidden;
        white-space: nowrap;
        cursor: move;
    }
    .row-drag-handle {
        cursor: ns-resize;

        &::before {
            display: inline-block;
            width: 100%;
            height: 1em;
            background: url('../img/menu2.svg') no-repeat center left;
            content: '';
        }
    }

    .form-field {
        border: 1px dotted transparent;
        border-radius: 3px;
        padding: 5px 10px;
        cursor: pointer;

        &:hover {
            border-color: #AAA;
        }

        .edit-button, .delete-button {
            float: right;
            margin-left: 10px;
        }

        label {
            width: auto;
        }

        .form-input {
            width: 100%;
        }
    }

    .multiple-choice-choices-list {
        margin: 0;
        clear: left;
        padding: 0;
    }

    .sortable-chosen {
        cursor: -webkit-grabbing;
    }
}

.properties-pane {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    box-shadow: -2px 5px 5px 0 rgba(0, 0, 0, 0.5);
    max-height: 95vh;
    width: 300px;
    overflow: auto;
    border-radius: 0 0 3px 3px;
    padding: 10px 20px;
    background-color: #EFEFEF;

    .title {
        padding: 0;
    }

    .close-button {
        float: right;
    }

    .form-row & p {
        margin: 0 0 1em;
        padding: 0;

        &::after {
            display: table;
            clear: both;
            content: '';
        }
    }
    .form-row & ul {
        margin-left: 0;
        padding-right: 0;
    }
    label {
        width: 100%;
    }
    input, select {
        display: block;
        max-width: 100%;
    }

    .field-column {
        display: block;
        float: left;
        width: 50%;
        &:first-child {
            padding-right: 10px;
        }

        input {
            display: inline;
        }
    }
    #new-choice-value {
        max-width: 70%;
    }
}

@media screen and (min-width: 768px) {
    .form-editor {
        .form-row {
            padding: 8px 70px 8px 40px;

            .row-drag-handle {
                position: absolute;
                top: 1em;
                left: 10px;
                width: 30px;
                height: 30px;
            }
            .row-delete-button {
                position: absolute;
                top: 1em;
                right: 10px;
            }
            .add-field-button {
                position: absolute;
                top: 1em;
                right: 40px;
            }
        }

        .form-field {
            float: left;
            width: 230px;
        }
    }
}
