/*
 * SalesIQ login — glass card over a Vanta TOPOLOGY backdrop.
 *
 * Design ported from the HRIS sign-in page:
 *   navy #1d243d backdrop · translucent card · 10px blue top and bottom rules ·
 *   dark slate inputs · light-blue pill button that turns purple on hover.
 *
 * Loaded only on the login route (render hook scoped to the Login page), and
 * everything is namespaced under .fi-simple-layout / .sq-login-card so it
 * cannot leak into the authenticated panel.
 */

:root {
    --sq-navy: #1d243d;
    --sq-accent: #79a6fe;   /* top + bottom rules, button */
    --sq-hover: #5d33e6;    /* button hover */

    /* NO backdrop-filter anywhere on this page. Blur of any radius smears the
       thin topology lines into a flat wash — plain alpha compositing is what
       keeps the animated backdrop legible through the card. */
    --sq-glass-bg: rgba(41, 39, 39, 0.3);
    --sq-glass-border: rgba(121, 166, 254, 0.18);

    --sq-field-bg: rgba(38, 46, 73, 0.42);
    --sq-field-bg-focus: rgba(38, 46, 73, 0.6);
    --sq-field-border: rgba(121, 166, 254, 0.22);

    --sq-text-muted: #a1a4ad;
    --sq-placeholder: #565f79;
}

/* ── Background ─────────────────────────────────────────────────────────── */

.fi-simple-layout {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--sq-navy);
    font-family: 'Source Sans Pro', 'Source Sans 3', Inter, ui-sans-serif, system-ui, sans-serif;
    overflow: hidden;
}

/* Filament paints a sheet on the simple layout — clear it so the Vanta canvas
   and navy backdrop show through. */
.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: 27rem;
    width: 100%;
}

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

#sq-vanta {
    position: fixed;
    inset: 0;
    z-index: 0;
}

#sq-vanta canvas {
    display: block;
}

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

.sq-login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 1.75rem 1.75rem 2rem;
    border-radius: 9px;
    background: var(--sq-glass-bg);
    /* no backdrop-filter — see the note on --sq-glass-bg */

    border: 1px solid var(--sq-glass-border);
    border-top: 10px solid var(--sq-accent);
    border-bottom: 10px solid var(--sq-accent);

    box-shadow: 0 5px 30px #000;
    text-shadow: 0 1px 3px rgba(6, 10, 26, 0.7);
    animation: sq-login-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.sq-login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.sq-login-logo {
    display: block;
    width: 78%;
    max-width: 250px;
    height: auto;
    margin: 0.5rem auto 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

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

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

/* Field labels are hidden in PHP via ->hiddenLabel() (which keeps them 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. */

.sq-login-card .fi-input-wrp {
    background: var(--sq-field-bg) !important;
    border: 1px solid var(--sq-field-border) !important;
    border-radius: 5px !important;
    box-shadow: none !important;
    transition: background-color 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.sq-login-card .fi-input-wrp:focus-within {
    background: var(--sq-field-bg-focus) !important;
    border-color: var(--sq-accent) !important;
    box-shadow: 0 0 0 3px rgba(121, 166, 254, 0.2) !important;
}

.sq-login-card .fi-input {
    background: transparent !important;
    color: #d6d6d6 !important;
    padding-top: 0.8rem !important;
    padding-bottom: 0.8rem !important;
    font-size: 0.95rem;
}

.sq-login-card .fi-input::placeholder {
    color: var(--sq-placeholder) !important;
}

/* Kill Chrome's yellow autofill wash — it destroys the glass effect. */
.sq-login-card .fi-input:-webkit-autofill,
.sq-login-card .fi-input:-webkit-autofill:hover,
.sq-login-card .fi-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #d6d6d6 !important;
    -webkit-box-shadow: 0 0 0 1000px #262e49 inset !important;
    caret-color: #d6d6d6;
    transition: background-color 9999s ease-out 0s;
}

.sq-login-card .fi-input-wrp-icon,
.sq-login-card .fi-icon-btn-icon {
    color: #5b6a8f !important;
}

.sq-login-card .fi-input-wrp-suffix .fi-icon-btn:hover .fi-icon-btn-icon {
    color: var(--sq-accent) !important;
}

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

.sq-login-card input[type='checkbox'] {
    background-color: rgba(38, 46, 73, 0.7);
    border: 2px solid #464d64;
    border-radius: 2px;
}

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

/* ── Submit button (pill) ───────────────────────────────────────────────── */

.sq-login-card .fi-btn {
    background: var(--sq-accent) !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 100px !important;
    min-height: 49px;
    padding-top: 0.8rem !important;
    padding-bottom: 0.8rem !important;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50 !important;
    box-shadow: 0 6px 18px -6px rgba(121, 166, 254, 0.55) !important;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.15s ease;
}

.sq-login-card .fi-btn-label {
    color: #2c3e50 !important;
    transition: color 0.3s ease;
}

.sq-login-card .fi-btn:hover:not(:disabled) {
    background: var(--sq-hover) !important;
    transform: translateY(-1px);
}

.sq-login-card .fi-btn:hover:not(:disabled),
.sq-login-card .fi-btn:hover:not(:disabled) .fi-btn-label {
    color: #fff !important;
}

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

/* ── SSO buttons (filament/auth/sso-buttons.blade.php) ──────────────────── */
/* That partial is styled for a light panel with dark: variants. The login page
   may render in light mode, which would put opaque white pills on the navy
   card — restyle them for the glass regardless of the active theme. */

/* "or continue with" divider */
.sq-login-card .relative > .absolute .border-t,
.sq-login-card .relative .w-full.border-t {
    border-color: rgba(255, 255, 255, 0.14) !important;
}

.sq-login-card .relative span.bg-white,
.sq-login-card .relative .flex.justify-center span {
    background: transparent !important;
    color: var(--sq-text-muted) !important;
    text-transform: none;
}

/* provider buttons */
.sq-login-card a[href*='sso'] {
    background: rgba(38, 46, 73, 0.42) !important;
    border: 1px solid var(--sq-field-border) !important;
    border-radius: 5px !important;
    color: #dfdeee !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sq-login-card a[href*='sso']:hover {
    background: rgba(38, 46, 73, 0.68) !important;
    border-color: var(--sq-accent) !important;
}

/* SSO error flash */
.sq-login-card .bg-rose-50 {
    background: rgba(255, 51, 51, 0.16) !important;
    border-color: rgba(255, 51, 51, 0.5) !important;
    color: #ffd9d9 !important;
}

/* ── Validation errors (red bar) ────────────────────────────────────────── */

.sq-login-card .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;
    text-shadow: none;
}

.sq-login-card .fi-input-wrp.fi-invalid {
    border-color: #ff3333 !important;
}

/* ── Accessibility / responsive ─────────────────────────────────────────── */

@media (max-width: 480px) {
    .sq-login-card { padding: 1.5rem 1.15rem 1.75rem; }
    .sq-login-logo { width: 85%; }
    .sq-login-subtitle { font-size: 12px; letter-spacing: 1px; }
    .sq-login-card .fi-btn { font-size: 14px; }
}

/* Vanta animates continuously on the GPU; honour the OS setting and fall back
   to the flat navy backdrop. login-vanta.js checks the same query. */
@media (prefers-reduced-motion: reduce) {
    .sq-login-card { animation: none; }
    #sq-vanta { display: none; }
}
