/* Sign-in page (resources/views/auth/login.blade.php). Computers: a blue brand panel beside the form. Tablets and
   phones: an app-style screen, the brand on top and the form on a sheet below it. */
:root {
    --brand-1: #0b2f7a;
    --brand-2: #1e5fd0;
    --brand-3: #4361ee;
    --ink: #0e1726;
    --muted: #64748b;
    --line: #dbe2ea;
    --field: #f6f8fb;
    --surface: #fff;
    --page: #f1f4f9;
    --danger: #e7515a;
    /* Text fields: border, border on hover, fill and border when focused, focus glow, icon, top sheen. */
    --field-line: #dbe2ea;
    --field-line-hover: #dbe2ea;
    --field-focus: #fff;
    --field-focus-line: #4361ee;
    --field-glow: rgba(67, 97, 238, .15);
    --field-icon: #64748b;
    --field-sheen: 0 0 #0000;
    /* The error box: text, fill, border. */
    --alert-ink: #c0263a;
    --alert-bg: rgba(231, 81, 90, .08);
    --alert-line: rgba(231, 81, 90, .35);
    color-scheme: light;
}

/* Dark: the theme picked inside the app (data-theme, set in the page head), or the device setting when nothing is
   saved. The same colours are given for both cases. */
:root[data-theme="dark"] {
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --line: #26344f;
    --field: #182843;
    --surface: #0b1424;
    --page: #060d19;
    --field-line: #364c76;
    --field-line-hover: #4a6197;
    --field-focus: #1b2d4c;
    --field-focus-line: #4f7bff;
    --field-glow: rgba(79, 123, 255, .22);
    --field-icon: #8b9bbb;
    --field-sheen: inset 0 1px 0 rgba(255, 255, 255, .05);
    --alert-ink: #fca5a5;
    --alert-bg: rgba(248, 113, 113, .13);
    --alert-line: rgba(248, 113, 113, .45);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #e2e8f0;
        --muted: #94a3b8;
        --line: #26344f;
        --field: #182843;
        --surface: #0b1424;
        --page: #060d19;
        --field-line: #364c76;
        --field-line-hover: #4a6197;
        --field-focus: #1b2d4c;
        --field-focus-line: #4f7bff;
        --field-glow: rgba(79, 123, 255, .22);
        --field-icon: #8b9bbb;
        --field-sheen: inset 0 1px 0 rgba(255, 255, 255, .05);
        --alert-ink: #fca5a5;
        --alert-bg: rgba(248, 113, 113, .13);
        --alert-line: rgba(248, 113, 113, .45);
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: "Nunito", "Hind Siliguri", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.auth {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- Brand panel ---------- */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    overflow: hidden;
    padding: 40px 56px;
    background: linear-gradient(150deg, var(--brand-1) 0%, var(--brand-2) 55%, var(--brand-3) 100%);
    color: #fff;
}

.auth-brand::before,
.auth-brand::after {
    position: absolute;
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.auth-brand::before {
    top: -120px;
    right: -120px;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 65%);
}

.auth-brand::after {
    bottom: -160px;
    left: -100px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(110, 198, 240, .28), transparent 65%);
}

.brand-top {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: grid;
    width: 48px;
    height: 48px;
    flex: none;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 6px 18px rgba(3, 18, 56, .25);
}

.brand-logo img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.brand-top b {
    display: block;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .01em;
}

.brand-top small {
    opacity: .8;
    font-size: 12px;
    letter-spacing: .04em;
}

.brand-hero {
    position: relative;
    max-width: 400px;
}

/* Heavy headline with a white to blue to lavender gradient. */
.brand-headline {
    margin: 0 0 12px;
    background: linear-gradient(120deg, #fff 10%, #a5b8ff 55%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: clamp(30px, 3.2vw, 44px);
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.brand-tagline {
    margin: 0 0 26px;
    opacity: .88;
    font-family: "Hind Siliguri", "Nunito", sans-serif;
    font-size: 17px;
}

.brand-features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    font-size: 14px;
    font-weight: 600;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.brand-features svg {
    width: 20px;
    height: 20px;
    flex: none;
    opacity: .95;
}

/* A drawn receipt, so the panel shows what the app does without a stock photo. */
.brand-receipt {
    position: absolute;
    top: 50%;
    right: 44px;
    width: 200px;
    margin-top: -90px;
    padding: 16px 16px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 24px 50px rgba(3, 18, 56, .35);
    color: #0e1726;
    transform: rotate(4deg);
}

.brand-receipt header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand-receipt header span {
    color: #0e9f6e;
}

.brand-receipt i {
    display: block;
    height: 7px;
    margin: 0 0 7px;
    border-radius: 4px;
    background: #e6ebf2;
}

.brand-receipt i:nth-of-type(2) {
    width: 75%;
}

.brand-receipt i:nth-of-type(3) {
    width: 55%;
}

.brand-receipt .total {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.brand-receipt svg {
    display: block;
    width: 100%;
    height: 34px;
}

.brand-foot {
    position: relative;
    margin: 0;
    opacity: .7;
    font-size: 12px;
}

/* Small laptops: no room for the receipt beside the text. */
@media (max-width: 1199.98px) {
    .brand-receipt {
        display: none;
    }
}

/* ---------- Form ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--surface);
}

.auth-form {
    width: 100%;
    max-width: 400px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(67, 97, 238, .1);
    color: var(--brand-3);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.eyebrow svg {
    width: 13px;
    height: 13px;
}

.eyebrow svg[hidden] {
    display: none;
}

/* Heavy title with a gradient, like the brand headline: navy to blue to violet on the white form (the Sign in
   button's colours), white to lavender in dark mode. Inline-block, so the gradient spans the words only. */
.auth-title {
    display: inline-block;
    margin: 0 0 8px;
    background: linear-gradient(120deg, #0b2f7a 0%, #3b5bdb 45%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.12;
}

:root[data-theme="dark"] .auth-title {
    background-image: linear-gradient(120deg, #fff 10%, #a5b8ff 55%, #c4b5fd 100%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .auth-title {
        background-image: linear-gradient(120deg, #fff 10%, #a5b8ff 55%, #c4b5fd 100%);
    }
}

.auth-sub {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 15px;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 18px;
    padding: 11px 14px;
    border: 1px solid var(--alert-line);
    border-radius: 12px;
    background: var(--alert-bg);
    color: var(--alert-ink);
    font-size: 14px;
    font-weight: 600;
}

.auth-alert svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.control {
    position: relative;
}

.control > svg {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--field-icon);
    transform: translateY(-50%);
    pointer-events: none;
}

.control input {
    width: 100%;
    height: 50px;
    padding: 0 46px 0 44px;
    border: 1.5px solid var(--field-line);
    border-radius: 12px;
    background: var(--field);
    box-shadow: var(--field-sheen);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.control input:hover {
    border-color: var(--field-line-hover);
}

.control input:focus {
    border-color: var(--field-focus-line);
    background: var(--field-focus);
    outline: none;
    box-shadow: 0 0 0 4px var(--field-glow);
}

.control:focus-within > svg {
    color: var(--brand-3);
}

.field.is-invalid input {
    border-color: var(--danger);
}

/* A saved name or password picked from the browser's suggestions keeps the field's own colours: Chrome tints such
   fields (light blue, or grey-blue in dark mode), so the field colour is painted back over it from the inside. */
.control input:-webkit-autofill,
.control input:-webkit-autofill:hover {
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
    box-shadow: 0 0 0 1000px var(--field) inset;
}

.control input:-webkit-autofill:focus {
    box-shadow: 0 0 0 1000px var(--field-focus) inset, 0 0 0 4px var(--field-glow);
}

/* Firefox tints them with a filter instead. Kept apart: a browser that doesn't know :autofill would drop the whole
   rule. */
.control input:autofill {
    filter: none;
}

.eye {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.eye:hover {
    background: rgba(100, 116, 139, .12);
}

.eye svg {
    width: 20px;
    height: 20px;
}

/* The eye shows the state: closed (crossed out) while the password is hidden, open while it shows. */
.eye .eye-open,
.eye[aria-pressed="true"] .eye-closed {
    display: none;
}

.eye[aria-pressed="true"] .eye-open {
    display: block;
}

.eye[aria-pressed="true"] {
    color: var(--brand-3);
}

.caps {
    margin: 6px 0 0;
    color: #b26b00;
    font-size: 12px;
    font-weight: 700;
}

.caps[hidden] {
    display: none;
}

.remember-row {
    margin: 4px 0 24px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.switch span {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background .2s;
}

.switch span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    content: "";
    transition: transform .2s;
}

.switch input:checked + span {
    background: var(--brand-3);
}

.switch input:checked + span::after {
    transform: translateX(18px);
}

.switch input:focus-visible + span {
    box-shadow: 0 0 0 4px rgba(67, 97, 238, .2);
}

/* Blue to violet, with a neon glow behind it. The colour is drawn by ::after and the glow by ::before beneath it, so
   the glow shows only round the button. */
.btn-signin {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .02em;
    transition: transform .1s, filter .2s;
}

/* The button's colour, with a thin light line and a close glow round the edge, like a neon tube. */
.btn-signin::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, #4f7bff, #8b5cf6);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 0 8px rgba(111, 108, 250, .55);
    content: "";
    pointer-events: none;
}

/* The glow: a blurred copy of the same gradient, so it is blue on the left and violet on the right. It breathes
   slowly (brighter, then softer); it spreads a little more on hover. */
.btn-signin::before {
    position: absolute;
    z-index: -2;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, #4f7bff, #8b5cf6);
    filter: blur(16px);
    opacity: .7;
    content: "";
    pointer-events: none;
    transition: inset .25s;
    animation: signin-glow 3.5s ease-in-out infinite;
}

@keyframes signin-glow {
    50% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-signin::before {
        animation: none;
    }
}

.btn-signin:hover {
    filter: brightness(1.1);
}

.btn-signin:hover::before {
    inset: -4px;
}

/* A press shrinks the button a touch, then it springs back. */
.btn-signin:active {
    transform: scale(.98);
}

/* The arrow steps forward on hover. */
.btn-signin .arrow {
    transition: transform .2s ease;
}

.btn-signin:hover .arrow {
    transform: translateX(4px);
}

.btn-signin:focus-visible {
    outline: 3px solid rgba(139, 92, 246, .45);
    outline-offset: 2px;
}

.btn-signin svg {
    width: 18px;
    height: 18px;
}

.btn-signin[disabled] {
    cursor: progress;
    filter: saturate(.8);
}

.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}

.btn-signin.is-loading .spinner {
    display: inline-block;
}

.btn-signin.is-loading .arrow {
    display: none;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Ripples and the loading line sit in their own layer (.btn-effects), clipped to the button's rounded shape; the
   glow behind the button stays unclipped. The label and icons stay above the layer. */
.btn-effects {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

.btn-signin > :not(.btn-effects) {
    position: relative;
}

/* A ripple spreads from where the button is pressed (auth-login.js adds it). */
.btn-effects .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .32);
    transform: scale(0);
    animation: signin-ripple .6s ease-out forwards;
}

@keyframes signin-ripple {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* While signing in, a thin light runs along the bottom edge again and again. */
.btn-signin.is-loading .btn-effects::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 35%;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff, rgba(255, 255, 255, 0));
    content: "";
    animation: signin-progress 1.2s ease-in-out infinite;
}

@keyframes signin-progress {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(290%);
    }
}

/* After a failed sign-in the form shakes once (the view adds .shake), like a phone refusing a wrong passcode. */
.auth-form.shake {
    animation: auth-shake .45s ease-in-out 1;
}

@keyframes auth-shake {
    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-8px);
    }

    30% {
        transform: translateX(7px);
    }

    45% {
        transform: translateX(-5px);
    }

    60% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-2px);
    }

    90% {
        transform: translateX(1px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-form.shake {
        animation: none;
    }

    .btn-effects .ripple {
        display: none;
    }

    .btn-signin.is-loading .btn-effects::after {
        animation-duration: 3s;
    }
}

.help {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.auth-foot {
    margin: 36px 0 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ---------- Tablets and phones ---------- */
@media (max-width: 991.98px) {
    /* Sized so the whole screen, footer included, fits a usual phone without scrolling (dvh follows the browser's
       address bar as it shows and hides). */
    .auth {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        min-height: 100dvh;
        background: var(--surface);
    }

    .auth-brand {
        flex: none;
        align-items: center;
        justify-content: flex-end;
        gap: 0;
        padding: 24px 24px 46px;
        text-align: center;
    }

    .brand-top {
        flex-direction: column;
        gap: 10px;
    }

    .brand-logo {
        width: 64px;
        height: 64px;
        border-radius: 18px;
    }

    .brand-logo img {
        width: 50px;
        height: 50px;
    }

    .brand-top b {
        font-size: 22px;
    }

    .brand-headline,
    .brand-features,
    .brand-receipt,
    .brand-foot {
        display: none;
    }

    .brand-tagline {
        margin: 6px 0 0;
        font-size: 14px;
    }

    .auth-main {
        position: relative;
        flex: 1;
        justify-content: flex-start;
        margin-top: -24px;
        padding: 28px 22px calc(16px + env(safe-area-inset-bottom));
        border-radius: 28px 28px 0 0;
        box-shadow: 0 -10px 30px rgba(3, 18, 56, .12);
    }

    /* A grab handle, as on a phone's bottom sheet. */
    .auth-main::before {
        position: absolute;
        top: 10px;
        left: 50%;
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: var(--line);
        content: "";
        transform: translateX(-50%);
    }

    .eyebrow {
        margin-bottom: 10px;
    }

    .auth-title {
        font-size: 26px;
    }

    .auth-sub {
        margin-bottom: 18px;
        font-size: 14px;
    }

    .field {
        margin-bottom: 14px;
    }

    .remember-row {
        margin: 2px 0 18px;
    }

    .help {
        margin-top: 16px;
    }

    .auth-foot {
        margin-top: auto;
        padding-top: 16px;
    }
}

/* Short phone screens (browser bars showing): a smaller header, without the tagline and the small label. */
@media (max-width: 991.98px) and (max-height: 720px) {
    .auth-brand {
        padding: 16px 24px 40px;
    }

    .brand-top {
        gap: 6px;
    }

    .brand-logo {
        width: 52px;
        height: 52px;
        border-radius: 15px;
    }

    .brand-logo img {
        width: 40px;
        height: 40px;
    }

    .brand-top b {
        font-size: 20px;
    }

    .brand-hero,
    .eyebrow {
        display: none;
    }
}

@media (min-width: 600px) and (max-width: 991.98px) {
    .auth-main {
        align-items: center;
    }
}

:root[data-theme="dark"] .auth-brand {
    background: linear-gradient(150deg, #071c4a 0%, #123f94 60%, #2c46c7 100%);
}

:root[data-theme="dark"] .switch span {
    background: #334155;
}

/* Dark: a lighter label and pressed eye, so they read on the dark form. */
:root[data-theme="dark"] .eyebrow {
    background: rgba(129, 140, 248, .16);
    color: #c7d2fe;
}

:root[data-theme="dark"] .control input::placeholder {
    color: #7d8ba6;
}

:root[data-theme="dark"] .eye[aria-pressed="true"] {
    color: #a5b8ff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .auth-brand {
        background: linear-gradient(150deg, #071c4a 0%, #123f94 60%, #2c46c7 100%);
    }

    :root:not([data-theme="light"]) .switch span {
        background: #334155;
    }

    :root:not([data-theme="light"]) .eyebrow {
        background: rgba(129, 140, 248, .16);
        color: #c7d2fe;
    }

    :root:not([data-theme="light"]) .control input::placeholder {
        color: #7d8ba6;
    }

    :root:not([data-theme="light"]) .eye[aria-pressed="true"] {
        color: #a5b8ff;
    }
}

/* Laboratory illustration floats directly on the blue brand panel. */
.lab-art { position: absolute; top: 50%; right: 22px; width: 230px; transform: translateY(-50%); text-align: center; pointer-events: none; }
.lab-art > svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 16px 20px rgba(7, 27, 85, .16)); }
.lab-art-caption { display: block; margin-top: 2px; color: #d6e7ff; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.brand-top b { overflow-wrap: anywhere; }
@media (min-width: 1200px) { .brand-hero { max-width: min(400px, calc(100% - 208px)); } }
@media (max-width: 1199.98px) { .lab-art { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
