@use '../variables';
@use '../mixins/forms';

nw-email-input {
    .emails-container {
        display: flex;
        flex-flow: row wrap;
        position: relative;
        height: auto;
        min-height: 40px;
        padding: 7px 12px 1px 12px;

        &.show-placeholder {
            &:before {
                content: attr(data-placeholder-text);
                display: flex;
                align-items: center;
                width: 100%;
                height: 100%;
                position: absolute;
                left: 0;
                top: 0;
                padding-left: 13px;
                color: variables.$input-color-placeholder;
            }
        }
        // Make the container appear like a focussed form control when
        // the actual input element within it is focussed
        &:focus-within {
            @include forms.form-control-focus;
        }
    }
    .pill {
        margin-right: 6px;
        margin-bottom: 6px;
    }
    .input-container {
        display: flex;
        flex-direction: column;
    }
    input {
        border: none;
        width: 0;
        min-width: 100%;
        max-width: 100%;
        height: 24px;
        margin-bottom: 6px;
        background-color: variables.$text-color;

        &:focus {
            outline: none;
            box-shadow: none;
            background-color: transparent;
        }
        // When not focussed, we want the input element to take up no space
        // We don't want to hide the element because we want it to still be focussable
        &:not(:focus) {
            min-width: 0;
            height: 0;
            padding: 0;
            margin: 0;
        }
    }
    .pill-hidden {
        visibility: hidden;
        height: 0 !important;
        margin: 0;
        font-size: 16px !important;
    }

    .persistent-placeholder {
        input {
            width: 100%;
            height: 100%;
            background-color: transparent;
            padding-bottom: 6px;
            &:focus {
                margin: 0;
                margin-left: -2px;
            }
            &::placeholder {
                font-size: 16px;
                color: variables.$input-color-placeholder;
            }
        }
    }
}
