/* ==========================================================
   GX_FORM_GUARD_CSS_V1
   GAMMA XG - proteccion visual comun de formularios

   Objetivos:
   - preservar el diseño propio de cada formulario
   - evitar autofill claro de Chrome/Edge
   - respetar radios de contenedores visibles
   - evitar halos visualmente rectangulares
   - no modificar validacion ni comportamiento
   ========================================================== */


/* ----------------------------------------------------------
   1. AUTOFILL GENERICO
   No fuerza un color de fondo.
   Conserva el color definido por cada formulario.
   ---------------------------------------------------------- */

form input:-webkit-autofill,
form input:-webkit-autofill:hover,
form input:-webkit-autofill:focus,
form input:-webkit-autofill:active,
form textarea:-webkit-autofill,
form textarea:-webkit-autofill:hover,
form textarea:-webkit-autofill:focus,
form textarea:-webkit-autofill:active,
form select:-webkit-autofill,
form select:-webkit-autofill:hover,
form select:-webkit-autofill:focus,
form select:-webkit-autofill:active {

    -webkit-text-fill-color:
        currentColor !important;

    caret-color:
        currentColor !important;

    /*
     * Impide el cambio brusco al color claro
     * impuesto por Chromium.
     */
    transition:
        background-color 99999s ease-out 0s,
        color 99999s ease-out 0s !important;
}


/* ----------------------------------------------------------
   2. AUTOFILL DENTRO DE CONTENEDORES VISUALES

   Cuando el fondo pertenece al wrapper, el input debe
   permanecer transparente y seguir la geometria del wrapper.
   ---------------------------------------------------------- */

:is(
    .input-group,
    .form-group,
    .field-group,
    .input-wrapper,
    .select-wrapper,
    .auth-field
) > input:-webkit-autofill,

:is(
    .input-group,
    .form-group,
    .field-group,
    .input-wrapper,
    .select-wrapper,
    .auth-field
) > textarea:-webkit-autofill {

    border-radius:
        inherit !important;

    -webkit-background-clip:
        text !important;

    background-clip:
        text !important;
}


/* ----------------------------------------------------------
   3. VALIDACION GAMMA

   Si gamma-toast marca tanto wrapper como campo interno,
   el campo debe respetar la misma geometria redondeada.
   No se eliminan validaciones ni clases.
   ---------------------------------------------------------- */

:is(
    .input-group,
    .form-group,
    .field-group,
    .input-wrapper,
    .select-wrapper,
    .auth-field
).gx-validation-invalid-wrap
>
:is(
    input,
    select,
    textarea
).gx-validation-invalid-visual {

    border-radius:
        inherit !important;
}


/* Pulso temporal de error: misma geometria. */

:is(
    .input-group,
    .form-group,
    .field-group,
    .input-wrapper,
    .select-wrapper,
    .auth-field
).gx-validation-invalid-wrap
>
:is(
    input,
    select,
    textarea
).gx-validation-invalid-pulse {

    border-radius:
        inherit !important;
}


/* ----------------------------------------------------------
   4. ARIA INVALID

   No cambia color, borde ni estilo.
   Solo evita que un navegador dibuje una geometria distinta
   cuando el input esta dentro de un wrapper redondeado.
   ---------------------------------------------------------- */

:is(
    .input-group,
    .form-group,
    .field-group,
    .input-wrapper,
    .select-wrapper,
    .auth-field
)
>
:is(
    input,
    select,
    textarea
)[aria-invalid="true"] {

    border-radius:
        inherit !important;
}


/* ----------------------------------------------------------
   5. FIREFOX AUTOFILL

   No impone fondo ni colores de tema.
   ---------------------------------------------------------- */

form input:-moz-autofill,
form textarea:-moz-autofill {

    caret-color:
        currentColor !important;
}


/* ============================================================
   GX_AUTH_AUTOFILL_MATCH_LOGIN_V7

   Replica en las pantallas Auth oscuras el comportamiento
   probado del login principal.

   Alcance:
   - body.auth-page
   - form.auth-form

   No afecta formularios claros ni cambia autocomplete.
   ============================================================ */


/* ------------------------------------------------------------
   CHROME / EDGE AUTOFILL
   ------------------------------------------------------------ */

body.auth-page
form.auth-form
input:-webkit-autofill,

body.auth-page
form.auth-form
input:-webkit-autofill:hover,

body.auth-page
form.auth-form
input:-webkit-autofill:focus,

body.auth-page
form.auth-form
input:-webkit-autofill:active {

    -webkit-text-fill-color:
        rgba(255,255,255,.92) !important;

    caret-color:
        #ffffff !important;

    color:
        #ffffff !important;

    border-radius:
        inherit !important;

    background-image:
        none !important;

    /*
     * Importante:
     * el guard generico usa background-clip:text.
     * Para Auth necesitamos cubrir completamente
     * el fondo claro interno de Chromium.
     */
    -webkit-background-clip:
        border-box !important;

    background-clip:
        border-box !important;

    /*
     * Mismo principio probado en el login principal:
     * cubrir el autofill claro con el fondo oscuro GAMMA.
     */
    -webkit-box-shadow:
        0 0 0 1000px
        #10213d
        inset !important;

    box-shadow:
        0 0 0 1000px
        #10213d
        inset !important;

    transition:
        background-color 99999s ease-out 0s,
        color 99999s ease-out 0s
        !important;
}


/* ------------------------------------------------------------
   AUTOFILL + CAMPO INVALIDO

   Mantiene simultaneamente:
   - fondo oscuro;
   - halo rojo;
   - geometria redondeada.
   ------------------------------------------------------------ */

body.auth-page
form.auth-form
input.gx-validation-invalid-visual:-webkit-autofill,

body.auth-page
form.auth-form
input[aria-invalid="true"]:-webkit-autofill {

    -webkit-text-fill-color:
        rgba(255,255,255,.92) !important;

    caret-color:
        #ffffff !important;

    border-color:
        rgba(251,113,133,.92) !important;

    border-radius:
        inherit !important;

    -webkit-background-clip:
        border-box !important;

    background-clip:
        border-box !important;

    -webkit-box-shadow:
        0 0 0 1000px
            #10213d inset,
        0 0 0 1px
            rgba(251,113,133,.42),
        0 0 0 6px
            rgba(251,113,133,.14),
        0 0 28px
            rgba(251,113,133,.17)
        !important;

    box-shadow:
        0 0 0 1000px
            #10213d inset,
        0 0 0 1px
            rgba(251,113,133,.42),
        0 0 0 6px
            rgba(251,113,133,.14),
        0 0 28px
            rgba(251,113,133,.17)
        !important;
}


/* ------------------------------------------------------------
   FIREFOX
   ------------------------------------------------------------ */

body.auth-page
form.auth-form
input:-moz-autofill {

    background-color:
        #10213d !important;

    color:
        rgba(255,255,255,.92) !important;

    caret-color:
        #ffffff !important;

    border-radius:
        inherit !important;
}



