@use "../variable" as *;
@use "../mixin" as *;
@use "sass:map";

$input-sizes: (
    xs: (
        height: 32px,
        font-size: 12px,
        padding: 0 10px,
    ),
    sm: (
        height: 36px,
        font-size: 14px,
        padding: 0 12px,
    ),
    md: (
        height: 40px,
        font-size: 15px,
        padding: 0 14px,
    ),
    lg: (
        height: 44px,
        font-size: 18px,
        padding: 0 16px,
    ),
    xl: (
        height: 48px,
        font-size: 20px,
        padding: 0 20px,
    ),
);

.rbfb-top-level-wrapper {
    .rbfb-input {
        display: flex;
        flex-direction: column;
        gap: 0.375rem;

        &__group {
            position: relative;
            display: flex;
            align-items: center;
            transition:
                border-color 0.2s ease,
                box-shadow 0.2s ease;

            @each $key, $map in $input-sizes {
                &--#{$key} {
                    height: map.get($map, height);
                    font-size: map.get($map, font-size);

                    input {
                        padding: map.get($map, padding);
                        &::placeholder {
                            font-size: map.get($map, font-size);
                            opacity: 1;
                        }
                    }
                }
            }

            .rbfb-input__group-prefix-icon,
            .rbfb-input__group-suffix-icon {
                display: flex;
                align-items: center;
                padding-left: 0.75rem;
                padding-right: 0.5rem;
            }

            &--search-icon input {
                padding-left: 0;
            }
            &--prefix input {
                padding-left: 0;
            }
            &--suffix input {
                padding-right: 0;
            }

            input {
                flex: 1;
                width: 100%;
                height: 100%;
                border: none !important;
                outline: none !important;
                background: transparent;
                font-size: inherit;
                line-height: 1;

                @include no-focus-style;
            }
        }

        &__helper-text {
            font-size: 12px;
            color: $gray-800;

            &.rbfb-input-error {
                color: $error;
            }
        }

        &__required {
            color: $error;
            margin-left: 0.25rem;
        }

        &--disabled {
            cursor: not-allowed;
            opacity: 0.6;

            input {
                cursor: not-allowed;
            }
        }
    }
}
