/**=====================
    Form scss
==========================**/
.input-group>.form-control:focus,
.input-group>.form-select:focus,
.input-group>.form-floating:focus-within {
    z-index: 0;
}


.form-control {
    border: 1px solid $border-color;
    background-color: $section-bg;
    font-size: calc(15px + (16 - 15) * ((100vw - 320px) / (1920 - 320)));
    color: $title-color;
    padding: calc(7px + (10 - 7) * ((100vw - 320px) / (1920 - 320))) 16px;
    width: 100%;
    border-radius: 6px;

    body.dark & {
        background-color: #171b27;
        border-color: #454851;
        color: $white;

        &::placeholder {
            color: rgba($white, 0.6);
        }
    }

    &::placeholder {
        color: $light-color;
    }

    &.first-child {
        border-top-left-radius: 30px;
        border-bottom-left-radius: 30px;
    }

    &.last-child {
        border-top-right-radius: 30px;
        border-bottom-right-radius: 30px;
    }

    &:focus,
    &:hover {
        background-color: $section-bg;
        color: $title-color;
        box-shadow: none;
        border: 1px solid $border-color;
    }

    &.form-control-gray {
        background-color: $section-bg;
        color: $title-color;

        &:focus,
        &:hover {
            background-color: $section-bg;
            color: $title-color;
            box-shadow: none;
        }

        ::placeholder {
            color: $border-color;
        }
    }

    &.form-control-white {
        background-color: $white;
        color: $title-color;
        border-radius: 8px;

        body.dark & {
            background-color: #171b27;
            border-color: #454851;
            color: $white;
        }

        &:focus,
        &:hover {
            background-color: $white;
            color: $title-color;
            box-shadow: none;

            body.dark & {
                background-color: #171b27;
                border-color: #454851;
                color: $white;
            }
        }

        ::placeholder {
            color: $border-color;
        }
    }
}

textarea {
    &.form-control {
        min-height: calc(39px + (46 - 39) * ((100vw - 320px) / (1920 - 320)));
    }
}

.comment-section {
    textarea {
        &.form-control {
            min-height: 110px;
        }
    }
}

.form-group {
    margin-bottom: calc(14px + (24 - 14)*((100vw - 320px) /(1920 - 320)));

    &:last-child {
        margin-bottom: 0;
    }

    label {
        font-size: calc(14px + (16 - 14) * ((100vw - 320px) / (1920 - 320)));
        font-weight: 500;
        line-height: 1.3;
        margin-bottom: 6px;
        position: relative;
        color: rgba($title-color, 0.78);

        body.dark & {
            color: $white;
        }
    }
}

.form-check {
    padding: 0;
    min-height: unset;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;

    .form-check-input,
    .form-radio-input {
        cursor: pointer;
        position: relative;
        min-width: calc(18px + (20 - 18) * ((100vw - 320px) / (1920 - 320)));
        height: calc(18px + (20 - 18) * ((100vw - 320px) / (1920 - 320)));
        appearance: none;
        border: none;
        box-shadow: none;
        background-color: transparent;
        display: flex;
        align-items: center;
        filter: none;
        float: unset;
        margin: 0;

        &:focus {
            box-shadow: none;
        }

        &:before {
            transition: transform 0.4s cubic-bezier(0.45, 1.8, 0.5, 0.75);
            transform: rotate(-45deg) scale(0, 0);
            @include pos;
            left: 4px;
            top: 6px;
            z-index: 1;
            @include pseudowh($width: calc(10px + (12 - 10) * ((100vw - 320px) / (1920 - 320))), $height: 5px);
            border: 2px solid $white;
            border-top-style: none;
            border-right-style: none;

            [dir="rtl"] & {
                left: unset;
                right: 4px;
            }
        }

        &:after {
            @include pos;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            @include pseudowh;
            transition: all 0.25s ease-in-out;
            background: $white;
            border: 2px solid $border-color;
            border-radius: 4px;
            cursor: pointer;

            body.dark & {
                background-color: #252934;
                border-color: #454851;
            }
        }

        &:checked {
            &:before {
                transform: rotate(-45deg) scale(1, 1);
            }

            &:after {
                background-color: var(--theme-color);
                border-color: var(--theme-color);

                body.dark & {
                    background-color: var(--theme-color);
                    border-color: var(--theme-color);
                }
            }
        }
    }

    .form-radio-input {
        margin: 0;
        padding: 0;

        &:checked {
            &::before {
                transform: scale(1, 1) translate(-50%, -50%);
            }

            &::after {
                border-color: transparent;
                opacity: 0.12;
            }
        }

        &:after {
            border-radius: 100%;
            opacity: 0.12;
        }

        &:before {
            border: none;
            background-color: var(--theme-color);
            border-radius: 100%;
            @include pseudowh($width: 10px, $height: 10px);
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
        }

        ~label {
            color: $light-color;
        }

        &:checked {
            &:after {
                border: 6px solid var(--theme-color);
            }

            ~label {
                font-weight: 500;
                color: $title-color;
            }
        }

        &.solid {
            &:checked {
                &:after {
                    border: 1px solid var(--theme-color);
                }
            }
        }
    }

    p {
        font-size: 16px;
    }

    label {
        font-size: 14px;
    }
}

.login-main {
    .login-card {
        .login-detail {
            .phone-detail {
                position: relative;
                overflow: unset;

                body.dark & {
                    background-color: transparent;
                }

                label {
                    &.error {
                        position: absolute;
                        bottom: -30px;
                        left: 0;
                    }
                }
            }

            &.phone-detail {
                position: relative;

                label {
                    .form-group {
                        &.error {
                            position: absolute !important;
                            bottom: -30px;
                            left: 0;
                        }
                    }
                }
            }
        }
    }
}

.form-select {
    background-color: $section-bg;
    border: none;
    color: $title-color;
    font-size: 16px;
    padding: 8px 70px 8px 12px;
    border-radius: 6px;

    body.dark & {
        background-image: url(../images/svg/white-arrow.svg);
    }

    &:focus {
        box-shadow: none;
    }

    &.form-select-white {
        background-color: $white;
        color: $light-color;
        border-radius: 8px;
        padding: 10px 46px;

        &:focus,
        &:hover {
            background-color: $white;
            color: $light-color;
            box-shadow: none;
        }
    }
}

.input-group {
    .form-control {
        padding: 10px calc(12px + (16 - 12) * ((100vw - 320px) / (1920 - 320))) 10px calc(38px + (46 - 38) * ((100vw - 320px) / (1920 - 320)));

        [dir="rtl"] & {
            padding: 10px calc(38px + (46 - 38) * ((100vw - 320px) / (1920 - 320))) 10px calc(12px + (16 - 12) * ((100vw - 320px) / (1920 - 320)));
        }
    }

    &.phone-field {
        gap: 10px;

        .form-control {
            padding: 10px 16px;
        }

        .contact-btn {
            border-radius: 8px;
        }
    }

    &>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
        &.phone-detail {
            margin-left: unset;
        }
    }

    &.phone-detail {
        .input-group> :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
            margin-left: unset;
        }

        .form-control {
            padding: 10px 16px;
            border: none;
        }
    }
}

.search-form {
    margin-top: 30px;
    width: 30%;
    margin-inline: auto;
    padding: 10px;
    border-radius: 40px !important;
    border: 1px solid rgba($white, 0.20);

    .form-control {
        border-radius: 40px;
        color: $white;
    }

    ::placeholder {
        color: $white;
    }

    i {
        --Iconsax-Size: calc(16px + (20 - 16) * ((100vw - 320px) / (1920 - 320)));
        --Iconsax-Color: #808B97;
        position: absolute;
        right: 16px;
        @include center(vertical);
    }

    @media (max-width: 1460px) {
        width: 40%;
    }

    @media (max-width: 991.98px) {
        width: 70%;
        padding: 4px;
    }

    @media (max-width: 575.98px) {
        width: 90%;
        margin-top: 16px;
    }
}

.avatar-group {
    @include flex_common;
    margin-bottom: 20px;

    .avatar {
        @include pseudowh($width: 40px, $height: 40px);

        img {
            border-radius: 100%;
            @include pseudowh;
        }

        &:first-child {
            margin-right: -20px;

            [dir="rtl"] & {
                margin-right: unset;
                margin-left: -20px;
            }
        }

        &:nth-child(2) {
            @include pseudowh($width: 45px, $height: 45px);
            position: relative;
            z-index: 1;
        }

        &:last-child {
            margin-left: -20px;

            [dir="rtl"] & {
                margin-left: unset;
                margin-right: -20px;
            }
        }
    }
}