/*----------------------------
    ACCESS PAGES (layouts/app_login.blade.php, docs/windows.md «Pagine di accesso»)
    The pattern background and the banner of every page of the layout (login, registration, verification, password,
    public pages), then the premium surface of the access forms (<x-templates.auth_surface>): light border, 1rem
    corners, soft shadow, the icon tile and the title on one line, no bands or lines.
-----------------------------*/
.app-login-pattern-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.app-login-body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.app-login-main {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.app-login-main-content {
    min-height: 100%;
}

.app-login-pattern-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(var(--mangofit-color-rgb), 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--mangofit-color-rgb), 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: radial-gradient(circle at center, black 42%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at center, black 42%, transparent 100%);
}

.app-login-pattern-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(80px);
    background: rgba(var(--mangofit-color-rgb), 0.45);
    opacity: 0.14;
}

.app-login-pattern-orb-top {
    width: 340px;
    height: 340px;
    top: -170px;
    right: -140px;
}

.app-login-pattern-orb-bottom {
    width: 400px;
    height: 400px;
    bottom: -220px;
    left: -180px;
}

/* Banner: the brand and the action on the background itself, without a band or a line under it */
.app-login-top-banner {
    flex-shrink: 0;
    gap: 1rem;
    background: transparent;
}

.app-login-top-banner .app-login-brand {
    min-width: 0;
}

.app-login-top-banner .app-login-banner-action {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 0.25rem;
}

.app-login-theme-toggle.btn {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 0.75rem;
    color: var(--contrast-theme-color);
    background: transparent;
    transition: background-color 0.15s ease;
}

.app-login-theme-toggle.btn:hover,
.app-login-theme-toggle.btn:focus-visible {
    color: var(--contrast-theme-color);
    background: rgba(var(--contrast-theme-color-rgb), 0.07);
}

/* Access form: a premium surface centred on the background */
.mf-auth-page {
    padding-block: 0.5rem;
}

.mf-auth-surface {
    --mf-auth-line: rgba(var(--contrast-theme-color-rgb), 0.12);
    --mf-auth-soft: rgba(var(--contrast-theme-color-rgb), 0.045);
    --mf-auth-tile: 2.75rem;
    position: relative;
    width: 100%;
    max-width: 28rem;
    padding: 2rem;
    color: var(--bs-body-color);
    border: 1px solid var(--mf-auth-line);
    border-radius: 1rem;
    background: var(--bs-body-bg);
    box-shadow: 0 1px 2px rgba(var(--contrast-theme-color-rgb), 0.06), 0 14px 36px rgba(var(--contrast-theme-color-rgb), 0.08);
}

/* In the dark theme the contrast colour is white: a black shadow instead, so no light halo surrounds the card */
:root[data-bs-theme="dark"] .mf-auth-surface {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 14px 36px rgba(0, 0, 0, 0.4);
}

.mf-auth-surface.is-md {
    max-width: 36rem;
}

.mf-auth-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 0.85rem;
    margin-bottom: 1.5rem;
}

.mf-auth-icon {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: var(--mf-auth-tile);
    height: var(--mf-auth-tile);
    border-radius: 0.8rem;
    color: color-mix(in srgb, var(--mangofit-color) 78%, var(--bs-body-color));
    background: rgba(var(--mangofit-color-rgb), 0.14);
    font-size: 1.25rem;
}

.mf-auth-title-group {
    flex: 1 1 12rem;
    min-width: 0;
}

/* Two classes: Bootstrap's h1 arrives later through Vite */
.mf-auth-heading .mf-auth-title {
    margin: 0;
    color: var(--bs-heading-color);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: break-word;
}

.mf-auth-subtitle {
    margin: 0.2rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 0.92rem;
    line-height: 1.4;
}

.mf-auth-heading-action {
    flex: 0 0 auto;
    margin-inline-start: auto;
}

.mf-auth-form {
    display: flex;
    flex-direction: column;
}

/* The main action takes the whole width: a long label («Invia link per il reset della password») wraps instead of
   being cut on a narrow phone */
.mf-auth-surface .mg-action-button.w-100 {
    min-height: 2.75rem;
    white-space: normal;
}

.mf-auth-surface .mg-action-button.w-100 .mg-action-button-content > span {
    overflow: visible;
    text-overflow: clip;
}

/* Links under the main action («Password dimenticata?»): underlined, so they read as links as before */
.mf-auth-link.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.25rem 0.75rem;
    border: 0;
    color: var(--bs-body-color);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(var(--mangofit-color-rgb), 0.55);
    text-underline-offset: 0.2em;
}

.mf-auth-link.btn:hover,
.mf-auth-link.btn:focus-visible {
    color: var(--mangofit-color);
    text-decoration-color: currentColor;
}

/* Small print under the main action (registration reserved to the PTs, resend the code) */
.mf-auth-footnote {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: 0.86rem;
    line-height: 1.45;
    text-align: center;
}

/* A message after an action (link sent, wrong code): a soft tinted note with its icon instead of an alert */
.mf-auth-note {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.85rem;
    font-size: 0.92rem;
    line-height: 1.4;
}

.mf-auth-note > i {
    flex: 0 0 auto;
    margin-top: 0.05rem;
}

.mf-auth-note.is-success {
    color: var(--bs-success-text-emphasis);
    background: rgba(var(--bs-success-rgb), 0.12);
}

.mf-auth-note.is-danger {
    color: var(--bs-danger-text-emphasis);
    background: rgba(var(--bs-danger-rgb), 0.1);
}

/* Terms and privacy: two calm rows */
.mf-auth-consents {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mf-auth-consents .form-check {
    min-height: 2.25rem;
    margin: 0;
}

/* Reference PT of the client registration (.mf-coach-banner of utils.css) */
.mf-auth-surface .mf-coach-banner__verified {
    color: rgb(var(--mangofit-color-rgb));
    font-size: 0.875rem;
}

/* Verification code: four equal boxes and the illustration above the text */
.mf-auth-illustration {
    display: block;
    width: 7rem;
    height: 7rem;
    margin: 0 auto 1.25rem;
    padding: 0.25rem;
    object-fit: cover;
    border-radius: 50%;
    background: var(--mf-auth-soft);
}

.mf-auth-message {
    margin-bottom: 1.5rem;
    color: var(--bs-secondary-color);
    text-align: center;
}

#otp-form.mf-otp-form {
    width: 100%;
    max-width: 26rem;
    margin-inline: auto;
}

.mf-otp-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#otp-form .otp-code-input {
    min-width: 0;
    min-height: 3.75rem;
    padding: 0.5rem;
    color: var(--bs-body-color);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    border-color: var(--mf-auth-line);
    border-radius: 0.85rem;
    background: var(--mf-auth-soft);
    appearance: textfield;
    -moz-appearance: textfield;
}

#otp-form .otp-code-input:focus {
    background: var(--bs-body-bg);
}

#otp-form .otp-code-input::-webkit-outer-spin-button,
#otp-form .otp-code-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mf-auth-help {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.25rem;
}

/* Links inside a sentence (resend, change email, terms, privacy): the text colour with a brand underline, as the
   «Scopri di più» link of the PT home; the terms links still turn green when ticked (.text-success of the page JS) */
.mf-auth-help a,
.mf-auth-consents a {
    color: var(--bs-body-color);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(var(--mangofit-color-rgb), 0.55);
    text-underline-offset: 0.2em;
}

.mf-auth-help a:hover,
.mf-auth-help a:focus-visible,
.mf-auth-consents a:hover,
.mf-auth-consents a:focus-visible {
    color: var(--mangofit-color);
    text-decoration-color: currentColor;
}

@media (max-width: 575.98px) {
    .mf-auth-surface {
        padding: 1.4rem 1.1rem;
    }

    .mf-auth-heading {
        margin-bottom: 1.25rem;
    }

    .mf-auth-heading .mf-auth-title {
        font-size: 1.3rem;
    }

    /* The action of the heading («Disconnetti» on the verification) stays in the top right corner, as before: the title
       wraps beside it instead of the action falling into the flow of the page like a step to take */
    .mf-auth-heading:has(> .mf-auth-heading-action) {
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .mf-auth-heading:has(> .mf-auth-heading-action) .mf-auth-title-group {
        flex: 1 1 0;
    }

    .mf-otp-grid {
        gap: 0.5rem;
    }
}

/* reCAPTCHA is 304 px wide: on narrow phones it shrinks with the surface instead of being cut */
@media (max-width: 379.98px) {
    /* A heading with an action leaves the room to the title and the action: the tile steps aside */
    .mf-auth-heading:has(> .mf-auth-heading-action) .mf-auth-icon {
        display: none;
    }

    .mf-auth-surface .g-recaptcha {
        width: calc(304px * 0.85);
        height: calc(78px * 0.85);
        transform: scale(0.85);
        transform-origin: 0 0;
    }
}
