/*
 * SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

@import (reference) '../../customize/src/less2/include/framework.less';
@import (reference) '../../customize/src/less2/include/tools.less';
@import (reference) '../../customize/src/less2/include/avatar.less';
@import (reference) '../../customize/src/less2/include/charts.less';
@import (reference) '../../customize/src/less2/include/markdown.less';

&.cp-app-form {
    @form_input-width: 400px;

    .framework_main(
        @bg-color: @colortheme_apps[form]
    );

    @cp_form_bar_color: fade(@cryptpad_color_link, 75%); // Color for the response chart bars

    display: flex;
    flex-flow: column;
    font: @colortheme_app-font;
    color: @cryptpad_text_col;
    background-color: @cp_app-bg;

    .alert {
        font-size: 1rem;
        &.alert-info {
            color: @cryptpad_text_col !important;
        }
    }

    .flatpickr-calendar.open {
        z-index: 100001 !important; // Alertify is 100000
    }

    @palette0: @cp_kanban-color0; // Default bg color for header
    @form-colors: @cp_form-palette;
    .form-colors(@form-colors; @index) when (@index > 0){
        .form-colors(@form-colors; (@index - 1));
        @color: extract(@form-colors, @index);
        .cp-form-palette-color@{index}{
            &.cp-form-palette {
                background-color: @color !important;
            }
        }
        &.cp-form-palette-color@{index}{
            #cp-app-form-editor {
                background-color: fade(@color, 50%);
            }
        }
    }
    .form-colors(@form-colors; length(@form-colors));

    @form-colors2: @cp_form-palette2;
    .checkmark-colors(@form-colors2; @index) when (@index > 0){
        .checkmark-colors(@form-colors2; (@index - 1));
        @color: extract(@form-colors2, @index);
        &.cp-form-palette-color@{index}{
            .cp-form-block {
                .cp-radio input:checked ~ .cp-radio-mark, .cp-checkmark input:checked ~ .cp-checkmark-mark {
                    background-color: @color !important;
                    border-color: @color !important;
                }
                input, textarea {
                    border-color: @color !important;
                }
            }
            .cp-form-block-question-text, .cp-form-block-question-number {
                color: @color !important;
            }
            .cp-form-type-sort:hover {
                color: @color !important;
                .cp-form-sort-order {
                    border-color: @color !important;
                }
            }
            .cp-form-input-block {
                input { color: @color !important; }
                border-bottom-color: @color !important;
            }
        }
    }
    .checkmark-colors(@form-colors2; length(@form-colors2));

    [data-type="md"] {
        .cp-form-block-content {
            .markdown_cryptpad();
        }
    }

    .cp-form-palette {
        &.cp-form-palette-nocolor {
            background-color: @palette0 !important;
        }
    }
    &.cp-form-palette-nocolor {
        background-color: @cp_app-bg !important;
    }

    div.alert.cp-burn-after-reading {
        margin: 10px !important;
    }

    & > .flatpickr-calendar {
        animation: none !important;
        -webkit-animation: none !important;
    }

    #cp-app-form-editor {
        flex: 1;
        display: flex;
        flex-flow: row;
        height: 100%;
        overflow: hidden;
    }

    &.cp-app-form-results {
        div.cp-form-creator-content, .cp-app-form-button-results {
            display: none !important;
        }
    }
    &:not(.cp-app-form-results) {
        div.cp-form-creator-results, .cp-app-form-button-creator {
            display: none !important;
        }
        .cp-form-iseditor {
            .cp-form-block {
                .tools_unselectable();
            }
        }
    }

    .cp-form-iseditor {
        .cp-form-block header {
            display: flex !important;
        }
    }
    .cp-form-creator-results {
        .cp-form-block-type {
            float: right;
            margin-top: -10px;
            margin-right: -10px;
        }
    }

    &.cp-form-readonly {
        .cp-form-creator-inline-add {
            display: none;
        }
        .cp-form-creator-add-full {
            display: none !important;
        }
        .cp-form-edit-buttons-container button {
            display: none;
        }
        .cp-form-edit-save {
            display: none;
        }
        .cp-form-block {
            cursor: default !important;
            .cp-form-block-drag-handle {
                visibility: hidden;
            }
        }
    }

    #cp-toolbar .cp-toolbar-title-readonly {
        display: none;
    }

    #cp-app-form-container {
        display: flex;
        flex: 1;
        justify-content: center;
        min-width: 300px;
        .cp-markdown-toggle-row {
            margin: 0.5rem 0;
            position: relative;
            .cp-markdown-toggle-button {
                .markdown-toolbar-button-style();
            }
        }

        div.timeline-container {
            width: 100%;
            height: 200px;
        }

        .cp-form-input-block {
            display: flex;
        }

        .cp-form-view-title {
            margin-bottom: 20px;
        }
        div.cp-form-view-footer {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px 20px 150px 20px;
            div.cp-form-view-logo {
                padding: 10px;
                font-size: 40px;
                font-family: "IBM Plex Mono";
                .tools_unselectable();
                color: @cryptpad_color_grey_500;
                cursor: pointer;
                img {
                    max-height: 60px;
                    margin: 0px 20px;
                }
            }
        }

        div.cp-form-creator-container {
            display: flex;
            flex: 1;
            justify-content: center;
            min-width: 300px;
            //flex-wrap: wrap;
            overflow: auto;

            .cp-drag-container {
                display: flex;
                flex-direction: row;

                button.cp-form-view-drag {
                    margin: 0;
                    padding: 1px 4px;
                    width: 30px;
                    height: 30px;
                    border: none;
                    border-radius: @variables_radius 0px 0px @variables_radius;
                    background-color: @cp_form-bg1;
                    color: @cryptpad_text_col;
                    &:focus-visible {
                        outline: @variables_focus_style;
                    }
                    &.cp-toggle-active {
                        color: @cp_form-bg1;
                        background-color: @cryptpad_text_col;
                    }
                }
                #cp-toggle-drag-on {
                    border-radius: 0px @variables_radius @variables_radius 0px !important;
                }
            }

            @media screen and (max-width: 1000px) {
                flex-wrap: wrap;
                justify-content: flex-start;
                .cp-form-creator-control {
                    width: 100% !important;
                    .cp-form-creator-settings {
                        display: flex;
                        justify-content: space-between;
                        flex-wrap: wrap;
                        .cp-form-settings-preview {
                            min-width: 260px;
                            margin-right: 20px;
                        }
                        .cp-form-color-theme-container {
                            max-width: 300px;
                        }
                        & > div {
                            flex: 1;
                            padding-right: 20px;
                        }
                    }
                }
            }
            .cp-form-creator-settings {
                .cp-form-actions {
                    margin-top: 5px;
                }
                & > div:not(:last-child) {
                    margin-bottom: 20px;
                }
                .cp-forms-results-participant {
                    display: flex;
                    flex-flow: column;
                    button {
                        margin-bottom: 20px;
                    }
                }

                div.cp-form-settings-preview {
                    background: @cp_form-bg1;
                    padding: 10px;
                    border-radius: @variables_radius_L;
                    & > *:not(:last-child) {
                        margin-bottom: 10px;
                    }
                    .cp-form-setting-title {
                        color: @cryptpad_color_link;
                    }
                }

                .cp-form-color-container {
                    & > div {
                        display: flex;
                        justify-content: space-between;
                        margin-top: 5px;
                        &:last-child {
                            justify-content: space-evenly;
                        }
                        .cp-form-palette {
                            display: inline-block;
                            border-radius: 50%;
                            height: 30px;
                            width: 30px;
                            text-align: center;
                            line-height: 30px;
                            color: @cp_kanban-fg;
                            border: 1px solid fade(@cp_kanban-fg, 40%);
                            cursor: pointer;
                        }
                    }
                }
            }
            div.cp-form-filler-container {
                width: 300px;
                min-width: 0;
                flex: 0 300 300px;
            }
            div.cp-form-creator-control {
                padding: 10px;
                margin-top: 10px;
                display: flex;
                flex-flow: column;
                width: 300px;
                .cp-form-creator-types {
                    margin-top: 20px;
                    display: flex;
                    flex-flow: column;
                }
            }
            div.cp-form-creator-content {
                position: relative;
                .cp-form-block-type {
                    &.editable {
                        cursor: pointer;
                    }
                    .fa-caret-down {
                        margin-left: 5px;
                    }
                }


                .cp-form-conditional {
                    .cp-form-conditional-hint {
                        margin-bottom: 10px;
                    }
                    .cp-form-condition {
                        display: flex;
                        align-items: center;
                        margin-bottom: 10px;
                        flex-wrap: wrap;
                        & > * {
                            margin-right: 10px;
                        }
                        .cp-dropdown-container button {
                            max-width: 200px;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                        }
                    }
                    .cp-form-condition-rule {
                        padding-bottom: 20px;
                        margin-bottom: 20px;
                        border-bottom: 1px solid @cryptpad_text_col;
                    }
                }

                div.cp-form-section-sortable {
                    min-height: 300px;
                    border: 2px dashed @cryptpad_text_col;
                    padding: 20px;
                    margin-top: 20px;
                    background: @cp_app-bg;
                    .cp-form-creator-add-inline {
                        button[data-type="section"] {
                            display: none;
                        }
                    }
                }
                div.cp-form-response-msg-container {
                    .cp-markdown-toolbar {
                        background-color: transparent;
                        border-radius: @variables_radius @variables_radius 0 0;
                    }
                }
            }
            div.cp-form-creator-results {
                .cp-form-block {
                    .cp-form-block-content {
                        overflow-x: auto;
                    }
                }
                .cp-form-creator-results-timeline {
                    margin-bottom: 20px;
                    table.cp-charts.column {
                        overflow-x: initial;
                        td {
                            background-color: @cp_form_bar_color;
                            border-color: @cp_form_bar_color;
                        }
                    }
                }
            }
            div.cp-form-creator-content, div.cp-form-creator-results {
                max-width: 1000px;
                min-width: 300px;
                margin-top: 10px;
                padding: 10px;
                display: flex;
                flex-flow: column;
                flex: 1 1 1000px;
                &.cp-no-drag {
                    .cp-form-block {
                        .cp-form-block-arrows {
                            padding-left: 5px;
                            border-radius: 0px @variables_radius 0px 0px;
                            display: flex;
                            column-gap: 10px;
                            .cp-form-arrow {
                                display: block;
                                background-color: transparent;
                                border: none;
                                color: @cryptpad_text_col;
                                &:focus-visible {
                                    border-radius: @variables_radius;
                                    outline: @variables_focus_style;
                                }
                            }
                        }
                        .cp-form-block-drag-handle {
                            display: none !important;
                        }
                    }
                }

                .cp-editor-wrapper {
                    .cp-form-edit-options-block {
                        padding: 1px;
                        overflow: hidden;
                        border: 1px solid @cp_forms-border;
                    }
                }

                .cp-form-creator-add-inline {
                    display: flex;
                    flex-flow: row;
                    align-items: center;
                    margin-bottom: 20px;
                    button {
                        width: 50px;
                        i {
                            margin-right: 0;
                        }
                    }
                    .cp-form-creator-inline-add {
                        font-size: 25px;
                        margin-right: 30px;
                        .add-close { display: none; }
                        &.displayed {
                            .add-close { display: inline; }
                            .add-open { display: none; }
                        }
                    }
                    .cp-form-creator-control-inline {
                        display: flex;
                        justify-content: space-around;
                        button:not(:last-child) {
                            margin-right: 5px;
                        }
                        .cp-form-creator-types {
                            .btn-secondary {
                                background: transparent;
                                display: inline-flex;
                                &:hover, &:not(:disabled):active, &:focus {
                                    background-color: @cryptpad_color_brand_fadest;
                                }
                            }
                            button {
                                border: 0px;
                                //padding-bottom: 3px;
                                i {
                                    font-size: 35px;
                                    line-height: 35px;
                                }
                            }
                            &:first-child {
                                margin-right: 50px;
                            }
                        }
                    }
                }
                .cp-form-creator-add-full {
                    display: flex;
                    flex-flow: column;
                    margin: 20px 0px 0px 0px;
                    padding-bottom: 75px;
                    &> div:first-child {
                        display: flex;
                        height: 100%;
                        align-items: center;
                        padding-right: 10px;
                        margin-bottom: 10px;
                        i {
                            color: @cryptpad_text_col;
                            font-size: 30px;
                            width: 50px;
                            text-align: center;
                        }
                    }
                    .cp-form-creator-control-inline {
                        display: flex;
                        flex-flow: column;
                        justify-content: space-around;
                        button:not(:last-child) {
                            margin-right: 5px;
                        }
                        .cp-form-creator-types {
                            .btn-secondary {
                                background: transparent;
                                display: inline-flex;
                                &:hover, &:not(:disabled):active, &:focus {
                                    background-color: @cryptpad_color_brand_fadest;
                                }
                            }
                            button {
                                border: 0px;
                                padding:5px;
                                margin-right: 10px;
                                i {
                                    font-size: 35px;
                                    line-height: 35px;
                                }
                            }
                            &:first-child {
                                margin-bottom: 20px;
                                margin-right: 50px;
                            }
                        }
                    }
                }
                .cp-form-response-msg-container {
                    padding-bottom: 75px;
                    .cp-form-response-msg-hint {
                        color: @cryptpad_color_link;
                    }
                }

                .cp-form-send-container {
                    text-align: center;
                    margin: 50px auto 0px auto;
                    padding-bottom: 100px;
                    button {
                        &:not(:last-child) {
                            margin-right: 10px;
                        }
                    }
                    .cp-form-invalid-warning {
                        color: @cp_form-invalid;
                        ul {
                            list-style-type: disclosure-closed;
                            margin-bottom: 5px;
                        }
                        li {
                            text-align: left;
                            a {
                                color: @cryptpad_color_link;
                            }
                        }
                        .alert-danger {
                            font-size: 1rem;
                            padding: 10px;
                        }
                    }
                    .cp-form-anon-answer {
                        text-align: center;
                        margin: 20px 0 30px 0;
                        .cp-radio {
                                margin-top: 10px;
                        }
                        .cp-form-required-radio.cp-radio-required {
                            color: @cp_form-invalid;
                        }
                        .cp-form-anon-answer-input {
                            display: flex;
                            white-space: nowrap;
                            align-items: center;
                            input {
                                margin-left: 10px;
                                display: inline-block;
                            }
                        }
                        .cp-form-anon-answer-registered {
                            font-style: italic;
                            margin-left: 10px;
                        }
                    }
                }

                .cp-form-page-container {
                    display: flex;
                    justify-content: center;
                    margin: 10px 0;
                    & > span {
                        margin: 0 20px;
                        width: 100px;
                        display: inline-flex;
                        align-items: center;
                        justify-content: center;
                    }
                    button {
                        display: flex;
                        height: 38px;
                        align-items: center;
                        i {
                            margin-right: 0;
                            font-size: 25px;
                        }
                    }
                }
                .cp-form-block {
                    background: @cp_form-bg1;
                    padding: 10px;
                    box-shadow: 0px 0px 15px @cp_shadow-color;
                    border-radius: @variables_radius;
                    &:not(:last-child) {
                        margin-bottom: 20px;
                    }

                    header {
                        display: none;
                        justify-content: space-between;
                        margin-top: -10px;
                        margin-left: -10px;
                        margin-right: -10px;
                    }

                    .cp-form-disabled {
                        .cp-form-poll-choice, .cp-form-type-sort {
                            cursor: not-allowed !important;
                        }
                    }

                    .cp-form-preview {
                        color: @cp_sidebar-hint;
                        margin-bottom: 10px;
                        padding: 0;
                    }

                    .cp-form-block-drag-handle {
                        display: flex;
                        flex-flow: column;
                        width: 50px;
                        justify-content: center;
                        padding-left: 10px;
                        font-size: 20px;
                        color: @cp_sidebar-hint;
                        i {
                            cursor: grab;
                            &:first-child {
                                height: 3px;
                                margin-bottom: 2px;
                            }
                        }
                    }
                    .cp-form-block-arrows {
                        display: none;
                    }

                    &.sortable-ghost { visibility: hidden; }
                    &.sortable-drag { opacity: 0.9 !important; }

                    .flatpickr-calendar.inline {
                        box-shadow: unset;
                        border: 1px solid @cryptpad_text_col;
                    }

                    .cp-form-block-question {
                        margin-bottom: 5px;
                        display: flex;
                        .cp-form-block-question-number {
                            font-weight: bold;
                            margin-right: 10px;
                        }
                        .cp-form-block-question-text {
                            flex: 1;
                            word-wrap: break-word;
                            overflow: hidden;
                        }
                        .cp-form-required-tag {
                            padding: 5px;
                            margin-top: -10px;
                            margin-right: -10px;
                            &.cp-is-empty {
                                height: fit-content;
                                padding: 3px;
                                border-radius: 0 @variables_radius 0 0;
                                background-color: @cp_alerts-danger-bg;
                                color: @cp_alerts-danger-text;
                            }
                        }
                    }

                    .cp-form-block-content {
                        p {
                            a {
                                color: @cryptpad_color_link;
                            }
                        }
                        .cp-form-required-radio {
                            flex-direction: row;
                            display: flex;
                            margin-bottom: 20px;
                            span {
                                margin-right: 10px;
                                &.cp-radio-mark {
                                    margin-right: 5px;
                                }
                            }
                        }
                        .cp-form-page-break-edit {
                            font-size: 20px;
                            text-align: center;
                            padding: 10px;
                            i {
                                margin-right: 5px;
                            }
                        }
                        .cp-form-edit-buttons-container {
                            margin-top: 20px;
                            display: flex;
                            justify-content: space-between;
                        }
                        .cp-form-copy-button {
                            margin-right: 5px;
                        }
                        .cp-empty-poll-edit-buttons {
                            padding-top: 40px
                        }
                        input:invalid {
                            border: 2px solid @cryptpad_color_red;
                            color: @cp_form-invalid;
                        }
                        media-tag {
                            & > * {
                                max-width: 100%;
                            }
                        }
                    }
                    .cp-form-input-block {
                        //width: @form_input-width;
                        padding-bottom: 10px;
                        border-bottom: 2px solid @cp_sidebar-hint;
                        margin-bottom: 10px;
                        &:not(.editing) {
                            input {
                                background: transparent;
                                border: none;
                                padding: 0 !important;
                                & ~ button:not(:disabled) {
                                    .cp-form-edit { display: inline; }
                                    .cp-form-save { display: none; }
                                }
                            }
                        }
                        input {
                            flex: 1;
                            min-width: 100px;
                            padding: 0 10px !important;
                            height: auto;
                            font-size: 20px;
                        }
                        button {
                            .cp-form-edit {
                                display: none;
                            }
                            .cp-form-save { display: inline; }
                        }
                        .cp-form-block-drag {
                            font-size: 22px;
                            width: 20px;
                            margin-left: 5px;
                            text-align: center;
                            line-height: 31px;
                        }
                    }
                    .cp-form-result-details {
                        margin: 10px 0px;
                        &> * {
                            margin-right: 0.5em;
                        }
                    }
                    &.editable {
                       &:not(.nodrag) { cursor: grab; }
                        .cp-form-edit-save {
                            margin-top: 20px;
                            button {
                                margin-right: 10px;
                            }
                        }
                        .cp-form-edit-type {
                            margin-bottom: 10px;
                            .cp-dropdown-container {
                                margin-left: 10px;
                            }
                        }
                        .cp-form-multiple-picker {
                            margin: 10px 0px 0px 0px;
                            button {
                                margin: 10px 10px 0px 0px;
                            }
                        }
                    }
                }
                .cp-form-edit-max-options {
                    display: flex;
                    align-items: center;
                    margin-bottom: 10px;
                    input {
                        width: 100px;
                        margin-left: 10px;
                    }
                }
                .cp-form-edit-options-block {
                    display: flex;
                    flex-wrap: wrap;
                    align-items: baseline;
                    border-radius: @variables_radius;
                    margin-top: 0.5rem;
                    padding: 1px; 
                    .CodeMirror {
                        cursor: default;
                        flex: 1;
                        margin: auto;
                        min-width: 80%;
                        width: 80%;
                        min-height: 200px;
                        height: 200px;
                        .CodeMirror-placeholder {
                            color: #777;
                        }
                    }
                    .cp-markdown-toolbar {
                        display: block;
                        border-radius: @variables_radius 0;
                        width: 100%;
                        background-color: transparent;
                    }
                }
                .cp-form-edit-block {
                    &.cp-no-sortable {
                        .cp-form-handle {
                            visibility: hidden;
                            cursor: default;
                        }
                    }
                    button.btn-secondary {
                        margin-left: 30px;
                        margin-bottom: 5px;
                    }
                    .cp-form-handle {
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        width: 30px;
                        color: @cp_sidebar-hint;
                        i:first-child {
                            margin-right: 1px;
                        }
                    }
                    .cp-form-edit-block-input {
                        margin-bottom: 5px;
                        &.sortable-ghost { visibility: hidden; }
                        &.sortable-drag { opacity: 0.9 !important; }
                        display: flex;
                        width: 400px;
                        @media (max-width:460px) {
                            width: 100%
                        }
                        input {
                            flex: 1;
                            min-width: 100px;
                            border-color: @cryptpad_text_col;
                            border-right: 0px;
                        }
                        button {
                            i { margin: 0 !important; }
                        }

                    }
                }
            }
        }
        div.cp-form-creator-answered {
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 1;
            flex-flow: column;
            div.cp-form-submit-table {
                display: grid;
                grid-gap: 10px;
                margin: 10px 0;
            }
            .cp-form-submit-actions {
                span:not(:last-child) {
                    margin-right: 10px;
                }
            }
            .cp-form-view-logo {
                margin-top: 100px;
                padding-bottom: 20px;
            }
            .cp-form-submit-success {
                margin: 20px;
                div.cp-form-submit-success-actions {
                    button:not(:last-child) {
                        margin-right: 10px;
                    }
                }
            }
        }
        div.cp-form-creator-results {
            display: flex;
            flex-flow: column;
            position: relative;

            #cp-form-response-msg {
                background: @cp_form-bg1;
                margin-bottom: 20px;
                padding: 10px;
                p:last-child {
                    margin-bottom: 0;
                }
                * {
                    max-width: 100%;
                }
            }

            .cp-form-creator-results-controls {
                margin-bottom: 20px;
                //background: @cp_form-bg1;
                //padding: 10px;
                button {
                    margin-right: 10px;
                }
            }

            .cp-form-creator-results-content {
                padding-bottom: 100px;
                .cp-form-block {
                    background: @cp_form-bg1;
                    padding: 10px;
                }
            }
            .cp-form-block-question {
                margin-bottom: 5px;
            }
            .cp-form-results-type-text {
                max-height: 300px;
                overflow: auto;
                .cp-form-results-type-text-data {
                    padding: 5px 10px;
                    background: @cp_form-bg2;
                    &:not(:last-child) { margin-bottom: 1px; }
                }
            }
            .cp-form-results-type-textarea-data {
                white-space: pre-wrap;
                padding: 5px 10px;
                background: @cp_form-bg2;
                &:not(:last-child) { margin-bottom: 1px; }
            }

            .cp-form-results-cell() {
                border: 1px solid @cp_form-border;
                display: table-cell;
                padding: 5px 10px;
                background: @cp_form-bg2;
            }

            .cp-form-results-delete {
                vertical-align: top;
            }

            .cp-form-results-type-multiradio-data {
                .cp-mr-q {
                    font-weight: bold;
                    padding: 5px 10px;
                    .cp-form-results-cell();
                    background: transparent;
                }
                &:not(:first-child) {
                    .cp-mr-q {
                        margin-top: 15px;
                    }
                }
            }

            .cp-charts {
                .cp-charts-row {
                    .cp-grid-sub-question {
                        background: transparent;
                    }
                    .cp-value {
                        min-width: 200px;
                        max-width: 200px;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }
                    .cp-bar-container {
                        .cp-bar {
                            background-color: @cp_form_bar_color;
                        }
                    }
                }
                &.cp-text-table {
                    .cp-charts-row {
                        .cp-value {
                            white-space: normal;
                        }
                    }
                }
            }

            .cp-form-results-contained {
                max-height: 350px; // enough for 10 table entries
                overflow: auto;
            }
            .cp-form-individual {
                background: @cp_form-bg1;
                padding: 10px;
                margin-bottom: 20px;
                border-radius: @variables_radius;
                & > *:not(:last-child) {
                    margin-right: 10px;
                }
                .cp-form-warning {
                    color: @cp-limit-bar-warning;
                }
                .cp-form-friend {
                    color: @cp_profile-hint;
                    .fa {
                        margin-right: 5px;
                    }
                }
                a, a:visited {
                    color: @cryptpad_color_link;
                }
            }
        }
        .cp-form-block-type {
            //float: right;
            padding: 5px;
            //margin-top: -10px;
            //margin-right: -10px;
            border-radius: 0px @variables_radius 0px 0px;
            i { margin-right: 5px; }
            background: fade(@cryptpad_text_col, 10%);
        }
    }

    .cp-form-type-radio, .cp-form-type-checkbox {
        display: flex;
        flex-flow: column;
        align-items: baseline;
        .cp-radio, .cp-checkmark {
            display: inline-flex;
            max-width: 100%;
            padding: 0.313rem 0;
        }
        .cp-checkmark-label {
            word-break: break-word;
        }
    }
    .cp-form-multiradio-container {
        overflow: auto;
    }
    .cp-form-type-multiradio {
        .cp-form-multiradio-header {
            white-space: nowrap;
            span {
                text-align: center;
                max-width: 30ch;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
        display: table;
        & > * {
            display: table-row;
            & > * {
                display: table-cell;
                padding: 5px 20px;
                vertical-align: middle;
                &:first-child {
                    //overflow: auto;
                    max-width: 300px;
                    min-width: 300px;
                    width: 300px;
                    position: absolute;
                    word-break: break-word;
                    background: @cp_form-bg1;
                    z-index: 2;
                }
                &:nth-child(2) {
                    visibility: hidden;
                    //overflow: auto;
                    max-width: 300px;
                    min-width: 300px;
                    width: 300px;
                    word-break: break-word;
                }
                .cp-radio-mark, .cp-checkmark-mark {
                    margin: auto;
                }
            }
        }
    }
    .cp-form-sort-hint, .cp-poll-hint {
        margin-bottom: 10px;
    }
    .cp-form-type-sort {
        cursor: grab;
        padding: 5px;
        display: flex;
        align-items: center;
        word-break: break-word;
        .cp-form-handle {
            min-width: 12px;
        }
        .cp-form-sort-order {
            border: 1px solid @cryptpad_text_col;
            padding: 0 0.313rem;
            margin-right: 5px;
        }
        &:hover {
            background-color: @cp_app-bg;
            color: @cryptpad_color_link;
            .cp-form-sort-order {
                border-color: @cryptpad_color_link;
            }
        }
    }

    .cp-form-type-poll-container {
        overflow: auto;
        .cp-form-poll-hint {
            position: absolute;
        }
    }
    .cp-form-type-poll {
        margin-top: 32px; // cp-form-poll-hint is "absolute"
        display: inline-flex;
        flex-flow: column;
        width: 100%;
        & > div {
            display: flex;
        }
        .cp-poll-total {
            display: flex;
            width: 100%;
        }
        .cp-form-poll-body {
            flex-flow: column;
            // max-height: 225px;

            & > div {
                display: flex;
            }
        }
        .cp-poll-cell {
            width: 100px;
            height: 40px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-top:5px;
            margin-left:5px;
            flex-shrink: 0;
            flex-grow: 1;
            word-break: break-word;
            button {
                width: 100%;
                border-top: 0px;
                border-left: 0px;
                background-color: @cp_form-bg1;
                .fa{
                    margin-left:10px;
                    transform: rotate(-45deg);
                }
            }
            .cp-form-total-yes {
                margin-right: 5px;
            }
            &.cp-poll-best {
                font-weight: bold;
            }
        }
        .cp-poll-answer-name {
            padding: 0 5px;
            display: flex;
            :last-child {
                flex: 1;
                min-width: 0;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
            }
            .cp-avatar {
                .avatar_main(30px);
                margin-right: 10px;
            }
            &.cp-clickable {
                cursor: pointer;
                &:hover {
                    color: @cryptpad_color_link;
                    &::after {
                        font-family: FontAwesome;
                        content: "\00a0\f06e";
                    }
                }
            }
        }
        .cp-poll-time-day {
            flex-basis: 100px;
            border-bottom: 1px solid @cryptpad_text_col;
            &:first-child {
                border-color: @cp_form-bg1 !important;
            }
        }
        .cp-form-poll-option, .cp-poll-time-day {
            span {
                text-overflow: ellipsis;
                max-width: 100%;
                overflow: hidden;
                line-height: 1.2;
                hyphens: auto;
                text-align: center;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
            }
        }
        .cp-poll-switch {
            button.btn {
                border-radius: 0px;
            }
        }
        &:not(.cp-form-poll-switch) {
            & > div {
                &:last-child {
                    margin-bottom: 5px;
                }
            }

            .cp-poll-cell {
                &:first-child {
                    min-width: 200px;
                    background: #424242;
                    position: absolute;
                    margin-left: 0;
                    background: @cp_form-bg1;
                }
                &:nth-child(2) {
                    margin-left: 205px;
                }
            }

            .cp-form-poll-option, .cp-poll-time-day, .cp-form-poll-choice {
                flex-grow: 1;
                flex-shrink: 0;
            }

            .cp-form-poll-option, .cp-poll-time-day {
                flex-flow: column;
                text-align: center;
                .cp-form-weekday-separator {
                    display: none;
                }
            }
            .cp-poll-time-day {
                height: 50px;
            }
        }
        &.cp-form-poll-switch {
            display: flex;
            flex-flow: row;
            .cp-avatar {
                .avatar_main(20px);
            }
            & > div {
                flex-flow: column;
                &.cp-form-poll-body {
                    flex-flow: row;
                    max-height: unset;
                    & > div {
                        flex-flow: column;
                    }
                    flex: 1;
                    min-width: 0;
                    overflow: auto;
                }
            }

            .cp-poll-total {
                flex-flow: column;
            }
            .cp-poll-cell:not(.cp-poll-switch) {
                &:first-child {
                    width: 100px;
                }
            }
            .cp-form-poll-option, .cp-poll-switch {
                span {
                    max-height: 100%;
                }
                width: 200px;
                .cp-form-weekday-separator {
                    margin-right: 5px;
                    margin-left: 5px;
                }
            }
            div.cp-poll-time-day-container {
                width: auto !important;
            }
            .cp-poll-time-day {
                flex-basis: 40px !important;
                flex-grow: 0;
                border-right: none;
                border-right: 1px solid @cryptpad_text_col;
                border-bottom: 0px;
                flex-flow: column;
                text-align: center;
                .cp-form-weekday-separator {
                    display: none;
                }
            }
        }
        .cp-form-poll-choice, .cp-form-poll-answer {
            .fa, .cptools {
                display: none;
            }
            color: @cp_form-poll-color;
            font-size: 25px;
            &[data-value="0"] {
                background: @cp_form-poll-no;
                .cp-no { display: inline; }
            }
            &[data-value="1"] {
                background: @cp_form-poll-yes;
                .cp-yes { display: inline; }
            }
            &[data-value="2"] {
                background: @cp_form-poll-maybe;
                .cp-maybe { display: inline; }
            }
        }
        div.cp-form-poll-choice {
            cursor: pointer;
            padding: 5px;
            //margin: 10px 0px 0px 10px;
            //border: 1px solid @cryptpad_text_col;
            color: @cryptpad_text_col;
        }
        div.cp-form-poll-answer {
            color: @cp_form-poll-yes-color;
        }
    }
    .cp-form-response-modal {
        .cp-form-markdown-editor-wrapper {
            border: 1px solid @cp_forms-border;
            border-radius: @variables_radius; 
        }
        .CodeMirror {
            border-radius: 0 0 @variables_radius @variables_radius; 
        }
    }

    #cp-form-settings {
        .cp-modal {
            text-align: left;
            width: 500px;
            padding: 24px;
            h2 {
                font-size: 20px;
                line-height: 40px;
                margin-top: -12px;
                i {
                    margin-right: 5px;
                }
            }
            & > *:not(h2) {
                color: @cryptpad_text_col;
            }
            & > div:not(:last-child) {
                margin-bottom: 10px;
            }
            .cp-form-setting-title {
                color: @cryptpad_color_link;
            }
            .cp-form-status-container {
                .cp-form-input-block {
                    display: flex;
                    .flatpickr-input { // expiration date picker
                        margin: 0 10px 0 0;
                    }
                    & > * {
                        margin-right: 10px;
                    }
                }
            }
            .cp-radio {
                margin: 0.2rem 0;
            }
            .cp-form-status {
                margin-bottom: 0.2rem;
            }
            .cp-form-mute-radio {
                margin-top: 0.2rem;
            }
            .cp-form-privacy-container {
                margin-top: 0.8rem
            }
            .cp-form-results-type {
                display: inline-block;
                margin: 0.2rem 0 0.2rem 0;
            }
        }
    }
    & > .flatpickr-calendar {
        z-index: 100001;
    }

    .charts_main();
}

