/*
 * The sign-in page (resources/views/filament/pages/auth/login.blade.php): the form half and the branded panel half.
 * Plain CSS, light and dark (the .dark class on <html>), logical properties: the page follows the language's direction, so in a
 * right-to-left language the form is on the right and the branded panel on the left.
 * Ported from NeroPOSCashier's login.css, for Filament 3 (its accent variables are "R, G, B" triples).
 */

/*
 * Colours: nothing is hard-coded here. The page follows the ACTIVE COLOUR THEME (the same one the panel and the public site use:
 * the default theme for a visitor, their own pick once known). The theme puts --primary-50..950 and --ynex-* on <html>
 * (see ThemeStyles / nero-sidebar.css); the aliases below just give them short local names, with fallbacks to the built-in violet.
 */
.nero-login {
    --nl-card: var(--ynex-card, #ffffff);
    --nl-page: var(--ynex-body, #f3f4f9);
    --nl-ink: var(--ynex-heading, #1b2440);
    --nl-muted: var(--ynex-muted, #6b7695);
    --nl-line: var(--ynex-line, #e4e8f3);
    --nl-navy: var(--nf-theme-navy, var(--ynex-navy, #111c43));
    --nl-brand-text: rgb(var(--primary-600));
    --nl-focus: rgb(var(--primary-500));

    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr);
    /* Both halves run the full height of the window: the one row is at least as tall as the screen (dvh = the visible part on a phone). */
    grid-template-rows: minmax(100vh, auto);
    grid-template-rows: minmax(100dvh, auto);
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--nl-card);
    color: var(--nl-ink);
}

html.fi.dark .nero-login {
    --nl-brand-text: rgb(var(--primary-300));
    --nl-card: var(--ynex-body, #0b1120);
}

/* ------------------------------------------------------------------ the form half */
.nero-login-form {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5rem 1.5rem 3rem;
}

.nero-login-tools {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 5;
}

.nero-login-lang {
    position: relative;
}

.nero-login-lang summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 1rem;
    border: 1px solid var(--nl-line);
    background: var(--nl-page);
    font-size: 0.85rem;
    color: var(--nl-muted);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, color 0.15s;
}

.nero-login-lang summary:hover {
    border-color: rgb(var(--primary-400));
    color: var(--nl-brand-text);
}

.nero-login-lang summary::-webkit-details-marker {
    display: none;
}

.nero-login-lang summary::after {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.6;
    margin-inline-start: 0.15rem;
}

.nero-login-lang ul {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 11rem;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    background: var(--nl-card);
    border: 1px solid var(--nl-line);
    border-radius: 1rem;
    box-shadow: 0 14px 34px rgb(15 23 42 / 0.16);
}

/* The buttons (language, light / dark, sign out) sit at the END of the top row: the right corner, and the left one in a right-to-left
   language (the bar itself is always left to right), and there the row runs the other way too (language first on the right, the light / dark
   button at the edge). The language list opens inwards, away from the edge. */
.nero-login[dir='rtl'] .nero-login-tools { right: auto; left: 1rem; flex-direction: row-reverse; }
.nero-login[dir='rtl'] .nero-login-lang ul { right: auto; left: 0; }

/* Many languages: it scrolls when taller than the window, and from nine languages on it is two columns (one on a phone). */
/* The language list: one column, scrolls with a thin scrollbar when there are more languages than fit. */
.nero-login-lang ul {
    max-height: min(26rem, calc(100vh - 6rem));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgb(128 138 160 / 0.35) transparent;
}

.nero-login-lang ul::-webkit-scrollbar { width: 4px; }
.nero-login-lang ul::-webkit-scrollbar-track { background: transparent; }
.nero-login-lang ul::-webkit-scrollbar-thumb { background: rgb(128 138 160 / 0.35); border-radius: 999px; }

.nero-login-lang a {
    display: flex;
    white-space: nowrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.75rem;
    color: inherit;
    text-decoration: none;
    font-size: 0.88rem;
}

.nero-login-lang a:hover {
    background: rgba(var(--primary-500), 0.1);
}

.nero-login-lang a.on {
    font-weight: 700;
    color: var(--nl-brand-text);
}

/* A language's round badge: its short code (the stand-in for a flag). */
.nero-login-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: rgba(var(--primary-500), 0.14);
    color: var(--nl-brand-text);
    font-size: 0.5rem;
    font-weight: 700;
    line-height: 1;
}

.nero-login-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 1rem;
    border: 1px solid var(--nl-line);
    background: var(--nl-page);
    color: var(--nl-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.nero-login-theme:hover {
    border-color: rgb(var(--primary-400));
    color: var(--nl-brand-text);
}

.nero-login-theme svg {
    width: 1.15rem;
    height: 1.15rem;
}

.nero-login-sun,
html.fi.dark .nero-login-moon {
    display: none;
}

html.fi.dark .nero-login-sun {
    display: block;
}

.nero-login-card {
    width: 100%;
    max-width: 23.75rem;
    margin-inline: auto;
}

.nero-login-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--nl-ink);
    text-align: start;
}

.nero-login-sub {
    margin: 0.6rem 0 2rem;
    font-size: 0.9rem;
    color: var(--nl-muted);
    text-align: start;
}

.nero-login-mobile-brand {
    display: none;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 800;
}

.nero-login-brand-head {
    color: var(--nl-brand-text);
}

.nero-login-mobile-brand .nero-login-brand-tail {
    color: var(--nf-tail, #1fc47c); /* "Spend" green, readable on the light and the dark sign-in page */
}

/* Filament's own form, in this design: taller fields, the checkbox line, one big button. */
html.fi .nero-login-fields .fi-input-wrp {
    border-radius: 0.7rem;
    background: var(--nl-page);
}

html.fi .nero-login-fields .fi-input-wrp:focus-within {
    background: var(--nl-card);
}

html.fi .nero-login-fields .fi-input {
    padding-block: 0.95rem;
    font-size: 0.95rem;
}

.nero-login-fields .fi-fo-field-wrp-label span,
.nero-login-fields .fi-fo-checkbox span {
    font-size: 0.85rem;
}

.nero-login-fields .fi-form-actions {
    margin-top: 1.25rem;
}

html.fi .nero-login-fields .nero-login-submit {
    width: 100%;
    min-height: 3.1rem;
    justify-content: center;
    border-radius: 0.7rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    box-shadow: none;
    transition: box-shadow 0.2s, transform 0.15s;
}

html.fi .nero-login-fields .nero-login-submit:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

html.fi .nero-login-fields .nero-login-submit span {
    color: #fff;
}

/* "Remember me": the tick box is filled with the theme colour when ticked; its hover edge and focus ring follow it too. */
html.fi .nero-login-fields .fi-checkbox-input {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 0.3rem;
    border: 1.5px solid var(--nl-line);
    background-color: var(--nl-page);
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
}

html.fi .nero-login-fields .fi-checkbox-input:hover {
    border-color: var(--nl-focus);
}

html.fi .nero-login-fields .fi-checkbox-input:checked,
html.fi .nero-login-fields .fi-checkbox-input:indeterminate {
    background-color: rgb(var(--primary-600));
    border-color: rgb(var(--primary-600));
}

html.fi .nero-login-fields .fi-checkbox-input:focus-visible {
    outline: 2px solid var(--nl-focus);
    outline-offset: 2px;
    box-shadow: none;
}

.nero-login-fields label {
    cursor: pointer;
}

/* Sign-up / forgotten password lines under the button. */
.nero-login-foot {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--nl-muted);
}

.nero-login-foot a,
.nero-login-foot .fi-link {
    font-weight: 600;
    color: var(--nl-brand-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ the branded panel */
.nero-login-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 3rem 2.75rem 2.25rem;
    color: #fff;
    /* The same look as the public site's call-to-action: the theme's navy, one flat fill. */
    background: var(--nl-navy);
}

/* A faint dotted texture that fades out towards the bottom. */
.nero-login-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    background-image: radial-gradient(#fff 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 75%);
    mask-image: linear-gradient(180deg, #000, transparent 75%);
}

/* The big soft arcs that sweep across the corner. */
.nero-login-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgb(255 255 255 / 0.16);
    pointer-events: none;
}

.nero-login-ring-1 {
    width: 150%;
    aspect-ratio: 1;
    right: -40%;
    bottom: -95%;
}

.nero-login-ring-2 {
    width: 125%;
    aspect-ratio: 1;
    right: -30%;
    bottom: -85%;
}

.nero-login-ring-3 {
    width: 100%;
    aspect-ratio: 1;
    right: -20%;
    bottom: -75%;
}

.nero-login-brand {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.nero-login-brand .nero-login-brand-head {
    color: var(--nf-head-dark, rgb(var(--primary-300)));
}

.nero-login-brand .nero-login-brand-tail {
    color: var(--nf-tail-dark, #2ee59d); /* "Spend" green, as in the NeroSpend logo */
}

.nero-login-mark {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.7rem;
    color: #fff;
    background: rgb(var(--primary-500));
    box-shadow: 0 6px 16px rgba(var(--primary-600), 0.45);
}

.nero-login-mark svg {
    width: 1.3rem;
    height: 1.3rem;
}

.nero-login-greeting {
    position: relative;
    margin: auto 0;
    padding-block: 4rem 2rem;
    text-align: start;
}

.nero-login-greeting h2 {
    margin: 0 0 0.9rem;
    font-size: 2.15rem;
    font-weight: 800;
    line-height: 1.35;
}

.nero-login-greeting p {
    margin: 0;
    max-width: 30rem;
    font-size: 0.95rem;
    line-height: 1.85;
    color: rgb(255 255 255 / 0.85);
}

.nero-login-copy {
    position: relative;
    margin: 0;
    font-size: 0.78rem;
    color: rgb(255 255 255 / 0.7);
    text-align: start;
}

/* The arcs sweep across the outer bottom corner of the panel: the left one in a right-to-left language (the panel is on the left). */
.nero-login[dir='rtl'] .nero-login-ring-1 { right: auto; left: -40%; }
.nero-login[dir='rtl'] .nero-login-ring-2 { right: auto; left: -30%; }
.nero-login[dir='rtl'] .nero-login-ring-3 { right: auto; left: -20%; }

/* ------------------------------------------------------------------ small screens: the form alone, the brand above it */
@media (max-width: 1023px) {
    .nero-login {
        grid-template-columns: 1fr;
    }

    .nero-login-panel {
        display: none;
    }

    .nero-login-mobile-brand {
        display: block;
    }
}

/* Right-to-left pages: the phone field is left-to-right for its digits; its text and placeholder still sit on the right like the other fields. */
[dir='rtl'] .nero-login .fi-input-wrp input[dir='ltr'],
.nero-login[dir='rtl'] .fi-input-wrp input[dir='ltr'] { text-align: right; }
