form {
    display: flex;
    align-items: stretch;
    flex-direction: column;

    p {
        margin: 5px 0;
        width: 100%;
    }

    button {
        margin: 10px 0;
    }

    .errorlist {
        list-style-type: none;
        margin: 5px 0 0 0;
        padding: 0;
        font-size: 0.7em;

        li {
            @include error_box;
            border-bottom: none;
            border-radius: 0;
        }

        :first-child {
            border-radius: 10px 10px 0 0;
        }

        &.nonfield {
            margin: 0 0 10px;
            
            :last-child {
                border-bottom-left-radius: 10px;
                border-bottom-right-radius: 10px;
                border-bottom: 1px solid $error_box_border_color;
            }
        }
    }

    .errorfield {
        padding: 10px;
        border: solid 1px $error_box_border_color;
        border-radius: 0 0 10px 10px;
        margin-top: 0;
    }
}

.helptext {
    display: block;
    font-size: 0.7em;
    color: $help_text_color;
}

.requiredfield label::after {
    content: " *";
    color: $header_border_color;
    vertical-align: text-top;
    font-size: 0.7em;
}

input, select, textarea {
    display: block;
    width: 100%;
    font: inherit;
    font-size: 0.9em;
    color: black;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
select[multiple],
textarea {
    background-color: white;
    border: solid 1px $help_text_color;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: none;

    &:optional {
        border-color: fade-out($help_text_color, .25);
    }
    &:focus {
        border-color: $header_bg_color;
        box-shadow: 0 0 1.5px 1px $header_bg_color;
    }
    &:-moz-ui-invalid {
        border-color: $error_box_border_color;
        box-shadow: 0 0 1.5px 1px $error_box_border_color;
    }
}

textarea {
    font-family: $font_family;
    font-size: 1em;
    resize: vertical;
    min-height: 120px;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin: 5px 10px;
}

input[type="submit"] {
    @include button;
}

select {
    -webkit-appearance: none;
    appearance: none;

    &:not([multiple]) {
        @include button;
        margin: 0;
        padding: 5px 25px 5px 10px;
        border-radius: 5px;
        text-align: left;

        background-image: url('/static/img/select_arrow.svg');
        background-repeat: no-repeat;
        background-position: right .7em top 50%, 0 0;
        background-size: .65em auto, 100%;
    }

    &[multiple] {
        padding: 0;

        option {
            color: black;
            background-color: lighten($header_border_color, 50%);
            padding: 2px 10px;

            &:hover {
                background-color: lighten($header_border_color, 30%);
            }
        }
    }
}

form.search {
    flex-direction: row;

    input[type="search"] {
        border-radius: 5px 0 0 5px;
        border-right: 0;
    }
    button {
        margin: 0;
        border-radius: 0 10px 10px 0;
    }
}

form.comment {
    padding: 0;
    border: none;

    textarea {
        border-radius: 10px 10px 0 0;
        border-bottom: none;
        margin: 0;
    }
    button {
        border-radius: 0 0 10px 10px;
        margin: 0;
    }

}

form#edited_comment {
    .meta {
        padding: 10px;
        padding-bottom: 5px;
        border-radius: 10px 10px 0 0;
        border: 1px solid $indexbar_bg_color_1;
        border-bottom: none;
    }

    textarea {
        border-radius: 0;
    }
}
