/* MORETTO · Login desktop + mobile (single owner)
   Login only: uses the native Filament Form and authentication pipeline.
   Profile, MFA policy and password reset retain their existing behavior. */
:root { --moretto-auth-width: 26.5rem; }

.fi-simple-layout:has(.moretto-auth-intro) {
    --mta-bg: #f5f6f8;
    --mta-card: #fff;
    --mta-text: #151820;
    --mta-muted: #758092;
    --mta-line: #e0e4ea;
    --mta-orange: #f36c21;
    --mta-orange-hover: #e75e13;
    display: flex !important;
    align-items: stretch !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    padding: 0 !important;
    background: var(--mta-bg) !important;
    color: var(--mta-text);
    font-family: 'Poppins', sans-serif;
    isolation: isolate;
}

/* Hero/photo treatment uses Moretto's existing background asset, softly veiled
   so the marketing text stays readable regardless of image brightness. */
.fi-simple-layout:has(.moretto-auth-intro)::before {
    content: '';
    display: none;
    flex: 1 1 auto;
    min-width: 0;
    background:
        linear-gradient(105deg, rgb(255 255 255 / 95%) 0%, rgb(255 252 249 / 96%) 48%, rgb(255 245 235 / 83%) 74%, rgb(247 248 250 / 70%) 100%),
        url('/images/moretto_login_bg.jpg') center / cover no-repeat;
}

.fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main-ctn {
    display: flex !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(1.5rem, 4vh, 3.5rem) 1.2rem !important;
}

.fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main {
    width: min(100%, var(--moretto-auth-width)) !important;
    max-width: var(--moretto-auth-width) !important;
    margin: 0 auto !important;
    padding: clamp(1.25rem, 3.2vw, 2.15rem) !important;
    border: 1px solid var(--mta-line) !important;
    border-radius: 1.1rem !important;
    background: var(--mta-card) !important;
    box-shadow: 0 14px 38px rgb(22 30 45 / 0.045) !important;
    overflow: visible !important;
}
.fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main::before { display: none !important; }
.fi-simple-layout:has(.moretto-auth-intro) .fi-simple-header { display: none !important; }
.fi-simple-layout:has(.moretto-auth-intro) .fi-simple-page,
.fi-simple-layout:has(.moretto-auth-intro) .fi-simple-page-content { min-width: 0; }

.moretto-auth-showcase { display: none; }
.moretto-auth-logo { display: inline-flex; align-items: center; gap: .45rem; color: var(--mta-text); font-weight: 700; letter-spacing: -.05em; }
.moretto-auth-logo small { font-weight: 500; font-size: .69em; letter-spacing: -.01em; }
.moretto-auth-symbol { display: block; width: 2.65rem; height: 2.5rem; color: var(--mta-orange); }
.moretto-auth-heading { text-align: center; }
.moretto-auth-logo--form { display: flex; flex-direction: column; gap: .05rem; justify-content: center; font-size: 1.12rem; }
.moretto-auth-logo--form .moretto-auth-symbol { width: 3.1rem; height: 2.7rem; }
.moretto-auth-heading h1 { margin: 1.15rem 0 .2rem; color: var(--mta-text); font-size: 1.16rem; font-weight: 650; line-height: 1.3; letter-spacing: -.03em; }
.moretto-auth-heading p { margin: 0; color: var(--mta-muted); font-size: .75rem; line-height: 1.55; }
.moretto-auth-intro { margin-bottom: 1.35rem; }

/* Form details are scoped to login; no global overrides. */
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-sc-form { gap: .95rem !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-fo-field-label-content { font-size: .73rem !important; font-weight: 550 !important; color: var(--mta-text) !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-fo-field-wrp-hint { font-size: .67rem !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-fo-field-wrp-hint a { color: var(--mta-orange) !important; text-decoration: none !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-fo-field-wrp-hint a:hover { text-decoration: underline !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-input-wrp {
    min-height: 2.8rem !important;
    background: var(--mta-card) !important;
    border: 1px solid var(--mta-line) !important;
    border-radius: .73rem !important;
    box-shadow: none !important;
}
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-input-wrp:focus-within {
    border-color: color-mix(in srgb, var(--mta-orange) 65%, var(--mta-line)) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mta-orange) 11%, transparent) !important;
}
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-input-wrp .fi-input:focus,
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-input-wrp .fi-input:focus-visible { outline: none !important; border: 0 !important; box-shadow: none !important; --tw-ring-shadow: 0 0 #0000 !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) :is(.fi-input, input) { font-size: .83rem !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-fo-field-wrp-error-message { font-size: .69rem !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-checkbox-input { accent-color: var(--mta-orange); }
html body .fi-simple-layout:has(.moretto-auth-intro) .fi-sc-actions:has([data-moretto-auth-submit]) { margin-top: .32rem; }
html body .fi-simple-layout:has(.moretto-auth-intro) [data-moretto-auth-submit] {
    position: relative !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 2.94rem !important;
    padding: .65rem 1rem !important;
    border: 1px solid var(--mta-orange) !important;
    border-radius: .68rem !important;
    background: var(--mta-orange) !important;
    color: #fff !important;
    font-size: .82rem !important;
    font-weight: 650 !important;
    transform: none !important;
    box-shadow: none !important;
    transition: background .18s ease, opacity .18s ease !important;
}
html body .fi-simple-layout:has(.moretto-auth-intro) [data-moretto-auth-submit]:not(:disabled):hover { background: var(--mta-orange-hover) !important; }
html body .fi-simple-layout:has(.moretto-auth-intro) [data-moretto-auth-submit]:disabled { cursor: wait !important; opacity: .85 !important; transform: none !important; }

@media (min-width: 1024px) {
    /* Filament's real simple-layout can reverse the flex order. Use explicit
       desktop grid placement so the promotional panel and login card NEVER
       occupy the same half, regardless of the inherited flex direction. */
    .fi-simple-layout:has(.moretto-auth-intro) {
        display: grid !important;
        grid-template-columns: minmax(0, 54fr) minmax(0, 46fr) !important;
        grid-template-rows: minmax(100dvh, auto) !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: none !important;
        position: relative !important;
    }
    .fi-simple-layout:has(.moretto-auth-intro)::before {
        display: block !important;
        grid-column: 1 !important;
        grid-row: 1 !important;
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 100% !important;
        position: relative !important;
        z-index: 0;
    }
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main-ctn {
        display: flex !important;
        grid-column: 2 !important;
        grid-row: 1 !important;
        flex: none !important;
        order: initial !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 100dvh !important;
        margin: 0 !important;
        position: relative !important;
        z-index: 2;
        padding: 2.3rem clamp(1.25rem, 3vw, 3rem) !important;
        background: color-mix(in srgb, var(--mta-bg) 50%, var(--mta-card)) !important;
        border-left: 1px solid var(--mta-line);
    }
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main {
        width: min(100%, 26rem) !important;
        max-width: 26rem !important;
        position: relative !important;
        z-index: 3;
    }
    /* The hook is within the right panel; render the decorative hero only on desktop. */
    .moretto-auth-showcase {
        position: fixed;
        display: block;
        top: 0;
        left: 0;
        bottom: 0;
        width: 54%;
        z-index: 1;
        pointer-events: none;
        padding: clamp(2rem, 7vh, 5rem) clamp(2rem, 5vw, 5.8rem);
        overflow: hidden;
    }
    .moretto-auth-showcase-content { max-width: 32rem; }
    .moretto-auth-logo--showcase { font-size: 1.55rem; }
    .moretto-auth-logo--showcase .moretto-auth-symbol { height: 2.8rem; }
    .moretto-auth-accent { display: block; width: 2.5rem; height: .17rem; background: var(--mta-orange); margin: clamp(2rem, 5vh, 3.7rem) 0 1.2rem; border-radius: 2rem; }
    .moretto-auth-showcase h2 { margin: 0; max-width: 28rem; font-size: clamp(1.6rem, 2.65vw, 2.45rem); font-weight: 700; letter-spacing: -.052em; line-height: 1.16; color: var(--mta-text); }
    .moretto-auth-showcase-lead { margin: .82rem 0 2.1rem; max-width: 25rem; color: #515b67; font-size: .87rem; line-height: 1.65; }
    .moretto-auth-benefits { display: grid; gap: 1.3rem; }
    .moretto-auth-benefit { display: flex; gap: .8rem; align-items: center; }
    .moretto-auth-benefit-icon { display: inline-flex; flex: 0 0 2.6rem; height: 2.6rem; align-items: center; justify-content: center; color: var(--mta-orange); background: #fffaf6; border: 1px solid #ffe9db; border-radius: .8rem; }
    .moretto-auth-benefit-icon svg { width: 1.3rem; height: 1.3rem; }
    .moretto-auth-benefit strong { display: block; font-size: .79rem; font-weight: 650; }
    .moretto-auth-benefit small { display: block; margin-top: .16rem; font-size: .67rem; color: #657082; line-height: 1.5; }
}
@media (min-width: 1024px) and (max-height: 680px) {
    .moretto-auth-showcase { padding-top: 1.4rem; padding-bottom: 1.4rem; }
    .moretto-auth-accent { margin: 1.2rem 0 .8rem; }
    .moretto-auth-showcase-lead { margin-bottom: 1rem; }
    .moretto-auth-benefits { gap: .7rem; }
}
@media (max-width: 1023px) {
    .fi-simple-layout:has(.moretto-auth-intro) {
        background: radial-gradient(ellipse 75% 36% at 90% 0%, #ffeadc 0%, transparent 72%), #f8f9fb !important;
    }
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main-ctn { padding: 1.7rem .9rem !important; }
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main { padding: clamp(1.3rem, 4vw, 2rem) !important; }
}
@media (max-width: 480px) {
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main-ctn {
        align-items: flex-start !important;
        padding: max(5.2rem, env(safe-area-inset-top)) .7rem max(1rem, env(safe-area-inset-bottom)) !important;
    }
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main {
        width: min(100%, 25.5rem) !important;
        padding: 1.4rem 1.15rem !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .moretto-auth-heading h1 { margin-top: .95rem; font-size: 1.05rem; }
    .moretto-auth-intro { margin-bottom: 1.15rem; }
    html body .fi-simple-layout:has(.moretto-auth-intro) [data-moretto-auth-submit] { min-height: 3rem !important; }
}
@media (max-height: 600px) and (max-width: 1023px) {
    .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main-ctn { align-items: flex-start !important; }
}
html.dark .fi-simple-layout:has(.moretto-auth-intro) {
    --mta-bg: #10141d;
    --mta-card: #191f2a;
    --mta-text: #f1f3f7;
    --mta-muted: #a8b0c0;
    --mta-line: #344052;
    background: var(--mta-bg) !important;
}
html.dark .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main,
html.dark .fi-simple-layout:has(.moretto-auth-intro) .fi-input-wrp { background: var(--mta-card) !important; }
html.dark .fi-simple-layout:has(.moretto-auth-intro) .moretto-auth-benefit strong,
html.dark .fi-simple-layout:has(.moretto-auth-intro) .moretto-auth-showcase h2 { color: #19202b; }
html.dark .fi-simple-layout:has(.moretto-auth-intro) .moretto-auth-benefit small { color: #515f73; }
html.dark .fi-simple-layout:has(.moretto-auth-intro) .moretto-auth-showcase .moretto-auth-logo { color: #161b25; }

/* MFA required guidance --------------------------------------------------- */
.moretto-mfa-required {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    gap: .8rem;
    align-items: start;
    margin-bottom: .9rem;
    padding: .9rem 1rem;
    border: 1px solid color-mix(in srgb, var(--moretto-ui-primary) 32%, var(--moretto-ui-border));
    border-radius: .85rem;
    background: color-mix(in srgb, var(--moretto-ui-primary) 5%, var(--moretto-ui-surface));
}

.moretto-mfa-required-icon {
    display: inline-flex;
    width: 2.6rem;
    height: 2.6rem;
    align-items: center;
    justify-content: center;
    border-radius: .72rem;
    background: color-mix(in srgb, var(--moretto-ui-primary) 11%, var(--moretto-ui-surface));
    color: var(--moretto-ui-primary);
}

.moretto-mfa-required-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.moretto-mfa-required-kicker {
    display: block;
    margin-bottom: .12rem;
    color: var(--moretto-ui-primary);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.moretto-mfa-required strong {
    display: block;
    color: var(--moretto-ui-text);
    font-size: .92rem;
    line-height: 1.3;
    font-weight: 700;
}

.moretto-mfa-required p {
    max-width: 68rem;
    margin: .28rem 0 0;
    color: var(--moretto-ui-muted);
    font-size: .78rem;
    line-height: 1.45;
}

/* Profile page: keep it operational and compact -------------------------- */
.fi-page:has(.moretto-mfa-required) .fi-header {
    margin-bottom: .8rem !important;
}

.fi-page:has(.moretto-mfa-required) .fi-section {
    box-shadow: none !important;
}

.fi-page:has(.moretto-mfa-required) .fi-section-header {
    padding-block: .78rem !important;
}

.fi-page:has(.moretto-mfa-required) .fi-section-content-ctn {
    padding-block: .9rem !important;
}


@media (max-width: 480px) {
    html.dark .fi-simple-layout:has(.moretto-auth-intro) .fi-simple-main { background: transparent !important; }
}
