/*
 * HRIS login — "screen" card.
 *
 * Layout adapted from the CodePen login design the team picked: a card whose
 * white content panel is an arrow pointing right, with the tinted backdrop
 * showing through the notches; underlined fields with a leading icon; a pill
 * submit that overhangs the panel edge; provider buttons underneath.
 *
 * Recoloured to the HRIS palette rather than the original purple —
 *   navy #1d243d · accent blue #79a6fe · legacy gold #ffc312 bottom rule
 * so the screen still reads as Informatics. The wordmark stays.
 *
 * No webfont and no icon-font request: the type stack is the OS's Source Sans
 * with Filament's Inter as the fallback, and the provider marks are inline SVG.
 *
 * Loaded only on the login route (render hook scoped to the Login page) and
 * namespaced under .fi-simple-layout / .hris-login-screen, so none of it can
 * leak into the authenticated panel.
 */

:root {
    --hris-navy: #1d243d;
    --hris-navy-soft: #33406b;
    --hris-accent: #79a6fe;   /* legacy top rule + button */
    --hris-gold: #ffc312;     /* legacy bottom rule */

    --hris-ink: #1d243d;
    --hris-muted: #7b86a3;
    --hris-line: #dfe4f0;
}

/* ── Backdrop ───────────────────────────────────────────────────────────── */

.fi-simple-layout {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    /* Light-to-deep sweep, mirroring the source design's left-to-right ramp. */
    background: linear-gradient(90deg, #c7d6f7 0%, #7c8fc4 55%, #38466f 100%);
    font-family: 'Source Sans Pro', 'Source Sans 3', Inter, ui-sans-serif, system-ui, sans-serif;
}

/* Filament paints a sheet on the simple layout — clear it so the card is the
   only surface on screen. */
.fi-simple-layout .fi-simple-main,
.fi-simple-layout .fi-simple-main-ctn {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    max-width: 28rem;
    width: 100%;
}

/* Stock Filament header (brand + "Sign in" heading) — replaced by our own. */
.fi-simple-layout .fi-simple-header {
    display: none !important;
}

/* ── Particle field ─────────────────────────────────────────────────────── */

/* Fixed rather than absolute so it always covers the viewport and never adds
   a scrollbar, whatever the card's height. */
#hris-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#hris-particles canvas {
    display: block;
}

/* The layout is not a stacking context by default, so the card wrapper needs
   an explicit one to sit above the field. */
.fi-simple-layout .fi-simple-main-ctn {
    position: relative;
    z-index: 1;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.hris-login-screen {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--hris-navy-soft), var(--hris-navy));
    box-shadow: 0 24px 48px -12px rgba(14, 20, 40, 0.55);
    animation: hris-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes hris-card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

/* Second, shallower arrow in a lighter tint — this is what gives the notch its
   two-tone depth instead of a flat cut. Sits below the white panel. */
.hris-login-screen__wedge {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(121, 166, 254, 0.16);
    clip-path: polygon(0 0, 88% 0, 100% 38%, 88% 100%, 0 100%);
    pointer-events: none;
}

/* The white surface the form sits on: an arrow whose tip reaches the card's
   right edge at the vertical midpoint. */
.hris-login-screen__panel {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #ffffff;
    clip-path: polygon(0 0, 80% 0, 100% 50%, 80% 100%, 0 100%);
    pointer-events: none;
}

.hris-login-screen__rule {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    background: var(--hris-gold);
}

/* Content sits on its own layer above the panel. The right padding keeps every
   control clear of the arrow's leading edge — see the note on .fi-btn. */
.hris-login-screen__content {
    position: relative;
    z-index: 2;
    padding: 2.25rem 5rem 2.5rem 2.25rem;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.hris-login-header {
    margin-bottom: 1.75rem;
}

.hris-login-logo {
    display: block;
    width: 68%;
    max-width: 190px;
    height: auto;
}

.hris-login-subtitle {
    margin: 0.9rem 0 0;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 1.5px;
    color: var(--hris-muted);
}

/* ── Form fields ────────────────────────────────────────────────────────── */

/* No field labels — the placeholder carries the meaning. That is done in PHP
   via ->hiddenLabel() on each TextInput (which keeps the label for screen
   readers), NOT with a blanket CSS rule: the "Remember me" label wraps its own
   checkbox, so hiding every .fi-fo-field-wrp-label would clip the checkbox out
   of the page too. */

.hris-login-screen .fi-input-wrp {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid var(--hris-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.hris-login-screen .fi-input-wrp:focus-within {
    border-bottom-color: var(--hris-accent) !important;
    /* Second hairline instead of a ring — a ring would outline a border-bottom
       only element as a full box and break the underline look. */
    box-shadow: 0 1px 0 0 var(--hris-accent) !important;
}

.hris-login-screen .fi-input {
    background: transparent !important;
    color: var(--hris-ink) !important;
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
    font-size: 0.95rem;
}

.hris-login-screen .fi-input::placeholder {
    color: var(--hris-muted) !important;
}

/* Kill Chrome's yellow autofill wash — the panel is white, the fill is not. */
.hris-login-screen .fi-input:-webkit-autofill,
.hris-login-screen .fi-input:-webkit-autofill:hover,
.hris-login-screen .fi-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--hris-ink) !important;
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    caret-color: var(--hris-ink);
    transition: background-color 9999s ease-out 0s;
}

/* Prefix (envelope / lock) + suffix (password reveal) icons. */
.hris-login-screen .fi-input-wrp-icon,
.hris-login-screen .fi-icon-btn-icon {
    color: var(--hris-accent) !important;
}

.hris-login-screen .fi-input-wrp-suffix .fi-icon-btn:hover .fi-icon-btn-icon {
    color: var(--hris-navy) !important;
}

/* Remember me — the label element wraps the checkbox itself. */
.hris-login-screen .fi-fo-field-wrp-label:has(input[type='checkbox']),
.hris-login-screen .fi-fo-field-wrp-label:has(input[type='checkbox']) span {
    color: var(--hris-muted) !important;
    font-size: 13px;
    font-weight: 400;
}

.hris-login-screen input[type='checkbox'] {
    background-color: #ffffff;
    border: 2px solid var(--hris-line);
    border-radius: 3px;
}

.hris-login-screen input[type='checkbox']:checked {
    background-color: var(--hris-accent);
    border-color: var(--hris-accent);
}

/* ── Submit pill ────────────────────────────────────────────────────────── */

.hris-login-screen .fi-btn {
    background: var(--hris-accent) !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 100px !important;
    min-height: 52px;
    /* The source design lets its pill overhang the panel edge onto the
       backdrop. That works there because its pill is white with a drop shadow,
       so the overlap reads as depth. Ours is accent-on-navy — too little
       contrast for that, and the overlap just looks like a collision. The pill
       stays inside the white arrow instead; the content's right padding is
       what guarantees the clearance. */
    margin-right: 0;
    padding: 0.85rem 1.4rem !important;
    justify-content: space-between !important;
    gap: 1rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hris-navy) !important;
    box-shadow: 0 14px 26px -12px rgba(20, 27, 48, 0.75) !important;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.15s ease;
}

.hris-login-screen .fi-btn-label {
    color: inherit !important;
}

.hris-login-screen .fi-btn:hover:not(:disabled) {
    background: var(--hris-navy) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.hris-login-screen .fi-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* ── Provider row ───────────────────────────────────────────────────────── */

.hris-login-sso {
    margin-top: 1.75rem;
}

.hris-login-sso__title {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hris-muted);
}

.hris-login-sso__row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.hris-login-sso__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    border: 1px solid var(--hris-line);
    background: #ffffff;
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.hris-login-sso__btn:hover:not([aria-disabled='true']) {
    border-color: var(--hris-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -8px rgba(29, 36, 61, 0.5);
}

/* Provider configured but not wired up yet — visibly unavailable, not broken. */
.hris-login-sso__btn[aria-disabled='true'] {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* ── Validation + session errors ────────────────────────────────────────── */

.hris-login-screen .fi-fo-field-wrp-error-message {
    display: block;
    margin-top: 0.4rem;
    padding: 3px 8px;
    border-radius: 5px;
    background: #ff3333;
    color: #fff !important;
    font-size: 12.5px;
    text-align: center;
}

.hris-login-screen .fi-input-wrp.fi-invalid {
    border-bottom-color: #ff3333 !important;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

/* Below this width the arrow notch eats too much of the form, so the panel
   squares off and the pill stops overhanging. */
@media (max-width: 30rem) {
    .hris-login-screen__panel {
        clip-path: none;
    }

    .hris-login-screen__wedge {
        display: none;
    }

    .hris-login-screen__content {
        padding: 2rem 1.5rem 2.25rem;
    }

    .hris-login-screen .fi-btn {
        margin-right: 0;
    }

    .hris-login-logo {
        width: 60%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hris-login-screen { animation: none; }
    /* The script also bails out on this query; hiding the container covers the
       case where it initialised before the preference changed. */
    #hris-particles { display: none; }
    .hris-login-screen .fi-btn:hover:not(:disabled) { transform: none; }
    .hris-login-sso__btn:hover:not([aria-disabled='true']) { transform: none; }
}
