@import 'variables';
@import 'framework';

/* Fancy placeholder labels, see https://jonathan-harrell.com/advanced-css-form-styling/ */
label.fancy-label {
    position: absolute;
    bottom: -14px;
    left: 7px;
    font-size: 0.75em;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.2s ease-out;

    @media screen and (prefers-reduced-motion: reduce) {
        transition: none;
    }
}
.form-group.fancy-fg {
    padding-bottom: 4px;
}

input:placeholder-shown + label.fancy-label,
textarea:placeholder-shown + label.fancy-label {
    opacity: 0;
    transform: translateY(-1rem);
}

/* Generator header */

#generator-header {
    margin-bottom: 15px;

    #generator-controls {
        float: right;

        @include mobile {
            float: none;
        }

        .button {
            margin-right: 10px;

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

            @include mobile {
                margin-top: 10px;
            }
        }
    }

    #generator-heading {
        display: inline-block;
        margin: 9px 0;
    }
}

/* Inputs */
.dynamic-input-controls {
    display: flex;
    justify-content: end;
    align-items: center;
    column-gap: 10px;

    .button-unstyled {
        &:hover,
        &:focus {
            background: none;
            color: $primary-color !important;
        }
    }

    .dropup-container {
        .dropup {
            width: 400px;
            bottom: 31px;
            padding: 15px;
            right: 0;
            max-height: 140px;
            overflow-y: scroll;

            @include mobile {
                width: 80vw;
                right: 0;
                left: unset;
            }

            .fill-field {
                display: table-row;

                .fill-field-value {
                    color: color('gray', 700);
                }

                .button {
                    float: none;
                    position: relative;
                }
            }

            .field-add-group {
                display: flex;
                flex-direction: row;
                justify-content: stretch;
                margin-top: 5px;
                margin-bottom: 5px;

                label {
                    flex-grow: 1;
                }

                button {
                    flex-grow: 0;
                }
            }
        }
    }
}

.dynamic-input {
    &.dynamic-input-editable {
        .form-group-label {
            .dynamic-input-label {
                padding-left: 5px;
                text-decoration: underline dotted 2px $text-color;
                cursor: text;

                // Focussing these hides them.
                // stylelint-disable a11y/selector-pseudo-class-focus
                &:hover::after {
                    // To hide the underline, see: https://stackoverflow.com/a/32203598/3211062
                    display: inline-block;
                    font-icon: url('pencil.svg');
                    vertical-align: -5px;
                    padding-left: 5px;
                    line-height: 0;
                }
            }
        }
    }
}

.request-form {
    .col50 {
        @include mobile {
            width: 100%;
        }
    }
}

/* PDF viewer (not exactly accurate anymore, is it? :D) */

.company-info {
    margin-bottom: 20px;
    position: relative;

    .accordion-title {
        padding: 3px 30px 0 0;
        margin: 0 0 0 25px;
        position: relative;
        font-size: 20px;

        .icon {
            font-size: 23px;
            position: absolute;
            right: 0;
            top: 0;
        }
    }

    .company-info-label {
        font-weight: bold;
    }

    .button.company-remove {
        position: absolute;
        top: -4px;
        left: -4px;
    }

    .company-read-more {
        margin-top: 15px;
        float: left;
    }

    .company-comments {
        overflow-wrap: anywhere;
    }
}

#form-container {
    margin-bottom: 20px;
}

// Debugging View
#content-container {
    min-height: 500px;
    position: relative;
    margin-top: 25px;

    #pdf-viewer {
        width: 100%;
        height: 100%;
        min-height: 500px;
    }
}

/* Miscellaneous */

.dynamic-input-primaryButton {
    width: 100%;
    margin-top: 10px;

    @include mobile {
        hyphens: auto;
    }
}

.button.button-secondary.dynamic-input-primaryButton[data-isprimary='true'] {
    background: $primary-color;
    color: $bg-color !important;
}

.address-input-container {
    .form-group:first-child {
        margin-top: 0;
    }
    .form-group:last-child {
        margin-bottom: 0;
    }
}

#tagxplanation {
    font-size: 9pt;
}

h2 {
    margin-top: 10px;
    margin-bottom: 10px;
}

.request-transport-medium-chooser {
    margin-top: 17px;
}

.request-type-chooser-vertical {
    display: flex;
    flex-direction: column;
    row-gap: 10px;

    .request-type-button-group {
        display: flex;
        flex-direction: row;
        column-gap: 10px;

        button {
            flex-grow: 1;
            text-align: left;
        }

        .request-type-help-button {
            flex-grow: 0;
        }
    }
}
