@mixin _field-height($line-height) {
    .matcha-form-field {

        input,
        input[type="text"],
        input[type="email"],
        input[type="tel"],
        input[type="url"],
        input[type="password"],
        input[type="number"],
        input[type="search"],
        input[type="date"],
        input[type="time"] {
            min-height: px-to-rem(20px);
            /* Mantém a altura dos inputs de texto */
            line-height: px-to-rem($line-height);
            padding: 0;
        }
        textarea {
            min-height: px-to-rem(20px);
            /* Mantém a altura dos inputs de texto */
            line-height: px-to-rem($line-height);
        }
    }
}

@mixin generate-matcha-form-field-size-classes($helper-breakpoints) {
    @each $breakpoint, $materialBreakpoint in $helper-breakpoints {
        @include media-breakpoint($materialBreakpoint) {
            $infix: if($materialBreakpoint ==null, "", "-#{$breakpoint}");

            &[size#{$infix}="tiny"] {
                @include _field-height(16px)
            }

            &[size#{$infix}="small"] {
                @include _field-height(24px)
            }

            &[size#{$infix}="medium"] {
                @include _field-height(32px);
            }

            &[size#{$infix}="large"] {
                @include _field-height(48px)
            }

            &[size#{$infix}="huge"] {
                @include _field-height(56px)
            }
        }
    }
}

@mixin matcha-form-field($theme) {
    $primary: map-get($theme, primary);
    $accent: map-get($theme, accent);
    $background: map-get($theme, background);
    $foreground: map-get($theme, foreground);

    $palettes: getBaseColorsPalettes();
    $grey: map-get($palettes, grey);

    $is-dark: map-get($theme, is-dark);
    $get-shade: if($is-dark, 100, 500); // Define $red-shade com base no valor de $is-dark


    .matcha-form-field {

        input,
        input[type="text"],
        input[type="email"],
        input[type="tel"],
        input[type="url"],
        input[type="password"],
        input[type="number"],
        input[type="search"],
        input[type="date"],
        input[type="time"],
        textarea {
            background-color: unset;
            color: getForeground($theme);
            border: 0px solid #ccc;
        }

        textarea {
            padding: 12px 0;
        }

        input,
        input[type="text"]:focus,
        input[type="email"]:focus,
        input[type="tel"]:focus,
        input[type="url"]:focus,
        input[type="password"]:focus,
        input[type="number"]:focus,
        input[type="search"]:focus,
        input[type="date"]:focus,
        input[type="time"]:focus,
        textarea:focus {
            outline: none;
        }

        // disabled
        input:disabled,
        input[type="text"]:disabled,
        input[type="email"]:disabled,
        input[type="tel"]:disabled,
        input[type="url"]:disabled,
        input[type="password"]:disabled,
        input[type="number"]:disabled,
        input[type="search"]:disabled,
        input[type="date"]:disabled,
        input[type="time"]:disabled,
        textarea:disabled {
            color: getDisabled($theme);
        }

        // Estado disabled do form-field (quando qualquer input filho está disabled)
        &.matcha-form-field-disabled {
            opacity: 0.6;
            pointer-events: none;
            cursor: not-allowed;

            // Aplicar estilo disabled nas bordas
            .matcha-form-field-border-start,
            .matcha-form-field-border-middle,
            .matcha-form-field-border-end {
                opacity: 0.5;
            }

            // Aplicar estilo disabled no label
            matcha-label {
                opacity: 0.6;
            }
        }
    }

    matcha-form-field {
        @include generate-matcha-form-field-size-classes($helper-breakpoints);
    }
}

.matcha-form-field {

    input,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="date"],
    input[type="time"],
    textarea {
        width: 100%;
        background-color: transparent;
        outline: none;
        box-shadow: none;
        font-size: 16px;
        resize: none;
        font-weight: 500;
    }

    input,
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="tel"]:focus,
    input[type="url"]:focus,
    input[type="password"]:focus,
    input[type="number"]:focus,
    input[type="search"]:focus,
    input[type="date"]:focus,
    input[type="time"]:focus,
    textarea:focus {
        outline: none;
    }

    .matcha-suffix {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
    }
}