/*
 * Stile delle pagine utente, ispirato a Material Design / MUI (stessi font e misure della console di
 * amministrazione). I colori del tenant arrivano dal layout come variabili --brand-* (vedi _Layout.cshtml).
 */

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/roboto/roboto-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/roboto/roboto-latin-500-normal.woff2") format("woff2");
}

:root {
    /* Valori predefiniti (colori del logo di IdentityPlatform), sovrascritti dal branding del tenant. */
    --brand-primary: #0e7478;
    --brand-primary-contrast: #ffffff;

    --text-primary: rgba(0, 0, 0, 0.87);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --divider: rgba(0, 0, 0, 0.23);
    --background: #f4f7f7;
    --paper: #ffffff;
    --error: #d32f2f;
    --error-background: #fdeded;
    --error-text: #5f2120;
    --radius: 4px;
    --shadow-1: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
    --shadow-2: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
    --shadow-4: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text-primary);
    font-family: "Roboto", "Helvetica", "Arial", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: 0.00938em;
    -webkit-font-smoothing: antialiased;
}

/* Layout: scheda centrata (Paper). */

.page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.card {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px 32px;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-icon {
    width: 40px;
    height: 40px;
}

.brand-platform-logo {
    width: 72px;
    height: 72px;
}

.brand-logo {
    max-width: 200px;
    max-height: 64px;
}

.brand-name {
    color: var(--brand-primary);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.0075em;
}

.title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.334;
    text-align: center;
}

.subtitle {
    margin: 8px 0 24px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

.body-text {
    margin: 0;
    font-size: 0.875rem;
    text-align: center;
}

/* Alert (MUI Alert, variante standard). */

.alert {
    margin-bottom: 24px;
    padding: 6px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    line-height: 1.43;
}

.alert-error {
    background: var(--error-background);
    color: var(--error-text);
}

/* Campo di testo outlined con etichetta flottante (MUI TextField). */

.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.text-field {
    position: relative;
}

.text-field input {
    width: 100%;
    height: 56px;
    padding: 16.5px 14px;
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    background: transparent;
    color: inherit;
    font: inherit;
    outline: none;
}

.text-field input:hover {
    border-color: var(--text-primary);
}

.text-field input:focus {
    border-color: var(--brand-primary);
    box-shadow: inset 0 0 0 1px var(--brand-primary);
}

.text-field label {
    position: absolute;
    top: 16px;
    left: 10px;
    padding: 0 4px;
    background: var(--paper);
    color: var(--text-secondary);
    line-height: 1.4375em;
    pointer-events: none;
    transform-origin: top left;
    transition: transform 200ms cubic-bezier(0, 0, 0.2, 1), color 200ms cubic-bezier(0, 0, 0.2, 1);
}

.text-field input:focus + label,
.text-field input:not(:placeholder-shown) + label,
.text-field input:autofill + label {
    transform: translate(0, -25px) scale(0.75);
}

.text-field input:focus + label {
    color: var(--brand-primary);
}

.text-field input.input-validation-error {
    border-color: var(--error);
}

.text-field input.input-validation-error + label {
    color: var(--error);
}

.field-error {
    display: block;
    margin: 3px 14px 0;
    color: var(--error);
    font-size: 0.75rem;
    line-height: 1.66;
}

.field-error:empty {
    display: none;
}

/* Checkbox. */

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

/* Pulsante (MUI Button, variante contained). */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    padding: 8px 22px;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand-primary);
    color: var(--brand-primary-contrast);
    box-shadow: var(--shadow-2);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.02857em;
    line-height: 1.75;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.button:hover {
    background: color-mix(in srgb, var(--brand-primary) 85%, black);
    box-shadow: var(--shadow-4);
}

.button:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.button:active {
    box-shadow: var(--shadow-1);
}

/* Pulsante secondario (MUI Button, variante text): stesso ingombro, senza sfondo. */

.button-text {
    background: transparent;
    color: var(--brand-primary);
    box-shadow: none;
}

.button-text:hover {
    background: color-mix(in srgb, var(--brand-primary) 8%, transparent);
    box-shadow: none;
}

.button-text:active {
    box-shadow: none;
}
