﻿@import "variables.scss";
@import "mixins.scss";
@import "icons-toolboxes.scss";

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

    &.ps {
        // perfect-scrollbar
        padding-right: 15px;
    }
}

.form-group {
    display: block;
    margin-bottom: 20px;
    width: 100%;

    .form-group {
        // Nested form group margin
        margin-bottom: 15px;
    }

    &.form-group-collapsible {
        & > .form-label {
            position: unset;
        }

        .form-group-toggle {
            position: unset;
            padding: 2px;
            text-decoration: none;
            color: $collapse-button-color;

            &:after {
                content: "";
                position: absolute;
                top: 25px;
                bottom: -10px;
                left: 10px;
                border-left: 1px dotted $form-collapsible-section-gutter-color;
            }
            @extend .paperbits-icon;
            @extend .paperbits-circle-delete;

            &.collapsed {
                @extend .paperbits-icon;
                @extend .paperbits-circle-add;

                &:after {
                    border: none;
                }
            }
        }

        .form-group-collapse {
            padding-left: 25px;
            padding-bottom: 10px;

            &.collapsed {
                display: none;
            }
        }
    }
}

.form-control,
input[type="search"],
input[type="text"],
textarea {
    font-family: $font-family-base;
    font-weight: $font-weight-base;
    font-size: $form-control-font-size;
    color: $color-base;
    border: 1px solid $form-control-border;
    background-color: $form-control-bg;
    display: block;
    width: 100%;

    &::placeholder {
        font-style: italic;
    }

    &:focus {
        outline: none;
        border: 1px solid $form-control-border-focused;
    }

    &.is-invalid {
        color: $color-danger;
        border-color: $color-danger;
    }

    &[readonly] {
        background-color: $form-control-bg-readonly;
    }

    &[disabled] {
        background-color: $form-control-bg-disabled;
    }
}

input[type="search"] {
    background-position: 98% center;
    background-repeat: no-repeat;
    background-size: auto 60%;
    background-blend-mode: exclusion;
}

input[type="range"].form-control {
    -webkit-appearance: none;
    padding: 0;
    border: 1px solid $form-control-border;
    border-radius: 20px;
    height: 10px;
    margin: 10px 0;

    &::-webkit-slider-thumb {
        -webkit-appearance: none;
        @include slider-thumb();
    }
}

input[type="radio"] {
    margin: 0 5px;
}

.form-control {
    padding: $form-control-padding;
    width: 100%;
}

a.form-control {
    text-decoration: none;
}

label {
    padding: 5px 0;
    display: block;
    font-weight: 400;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.label-group {
    display: flex;
    align-items: center;

    .form-label {
        flex: 1;
    }
}

.input-group {
    display: flex !important;
    border: 1px solid $form-control-border;

    &:focus-within {
        border: 1px solid $form-control-border-focused;
    }

    .form-control,
    .form-control:active,
    .form-control:focus {
        border: none;
        background: none;
        outline: none;
    }

    .input-group-addon {
        min-width: 1.5em;
        border: none;
        line-height: inherit;
        cursor: pointer;
        display: inline-block;
        line-height: 2em;
        font-size: $form-control-font-size;

        &:active,
        &:focus,
        &:hover {
            outline: none;
            @include selection(10px, -4px);
        }

        &.disabled {
            color: #ccc;
        }
    }

    .input-group-addon {
        font-size: $form-control-font-size;
        padding: $form-control-padding;
        min-width: 1.5em;
        color: $color-base;
        border: none;
        display: block;
    }
}

hr {
    display: block;
    border: none;
    border-bottom: 1px solid $form-control-border;
    height: 1px;
    width: 100%;
    margin: 12px 0;
}

.media-preview-box {
    max-width: 450px;
    max-height: 450px;
    min-width: 150px;
    min-height: 150px;
}
