/*
 * Split-screen sign-in page (App\Filament\Auth\Login), matching the OIC Voucher System.
 * Adapted from voucher/resources/css/filament/main/login.css for Filament 3:
 *   - Filament 3 has no hook inside the simple layout, so the brand panel is the
 *     first child of <body> (BODY_START hook) and the body becomes a flex row.
 *   - Colour variables are "r, g, b" triplets: var(--primary-800).
 * Plain CSS (no build step); registered as a Filament asset in AppServiceProvider.
 * Classes: .lb-* (login brand). Only applies where the brand panel is present.
 */

body:has(> .lb-brand) {
    display: flex;
    flex-direction: column; /* phones: compact band, then the form */
    min-height: 100dvh;
    background:
        radial-gradient(60rem 40rem at 110% -10%, color-mix(in oklab, var(--primary-500) 10%, transparent), transparent 60%),
        var(--gray-50);
}

.dark body:has(> .lb-brand),
body.dark:has(> .lb-brand) {
    background:
        radial-gradient(60rem 40rem at 110% -10%, color-mix(in oklab, var(--primary-500) 14%, transparent), transparent 60%),
        var(--gray-950);
}

body:has(> .lb-brand) > .fi-simple-layout {
    flex: 1 1 auto;
    min-height: 0;
}

/* Brand panel */
.lb-brand {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.75rem 1.5rem 2rem;
    color: #fff;
    /* Text on this gradient keeps >= 4.5:1 contrast. */
    background: linear-gradient(150deg, var(--primary-800) 0%, var(--primary-900) 55%, var(--primary-950) 100%);
}

.lb-brand-glow {
    position: absolute;
    inset: -30% -20% auto auto;
    width: 32rem;
    height: 32rem;
    border-radius: 9999px;
    background: radial-gradient(circle, color-mix(in oklab, var(--primary-300) 45%, transparent), transparent 65%);
    filter: blur(10px);
    z-index: -1;
}

.lb-brand-grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.12;
    background-image:
        linear-gradient(to right, rgb(255 255 255 / 0.5) 1px, transparent 1px),
        linear-gradient(to bottom, rgb(255 255 255 / 0.5) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}

.lb-brand-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lb-brand-mark {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: none;
    border-radius: 0.875rem;
    background: rgb(255 255 255 / 0.12);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22);
    backdrop-filter: blur(6px);
}

.lb-brand-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.lb-brand-org {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.lb-brand-body {
    display: none; /* phones: compact band only */
}

.lb-brand-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--primary-100);
}

.lb-brand-title {
    margin-top: 0.875rem;
    font-size: clamp(1.9rem, 2.6vw, 2.75rem);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.lb-brand-text {
    margin-top: 1rem;
    max-width: 28rem;
    font-size: 0.975rem;
    line-height: 1.65;
    color: rgb(255 255 255 / 0.88);
}

.lb-brand-points {
    margin-top: 2rem;
    display: grid;
    gap: 0.75rem;
}

.lb-brand-points li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: rgb(255 255 255 / 0.9);
}

.lb-point-icon {
    width: 2rem;
    height: 2rem;
    padding: 0.4rem;
    flex: none;
    border-radius: 0.625rem;
    background: rgb(255 255 255 / 0.1);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16);
}

.lb-brand-foot {
    display: none;
    font-size: 0.75rem;
    color: rgb(255 255 255 / 0.55);
}

/* Form side */
body:has(> .lb-brand) .fi-simple-main-ctn {
    padding: 2rem 1.25rem 3rem;
}

body:has(> .lb-brand) .fi-simple-main {
    margin: 0;
    max-width: 27rem;
    padding: 2.25rem 1.75rem;
    border-radius: 1.25rem;
    background: rgb(255 255 255 / 0.85);
    backdrop-filter: blur(8px);
    --tw-ring-shadow: 0 0 #0000;
    box-shadow:
        0 1px 2px rgb(15 23 42 / 0.04),
        0 20px 45px -20px rgb(15 23 42 / 0.18);
}

.dark body:has(> .lb-brand) .fi-simple-main {
    background: rgb(17 24 39 / 0.8);
}

body:has(> .lb-brand) .fi-simple-header {
    align-items: flex-start;
}

body:has(> .lb-brand) .fi-simple-header .fi-logo {
    display: none; /* the brand panel carries the organisation name */
}

body:has(> .lb-brand) .fi-simple-header-heading {
    text-align: left;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

body:has(> .lb-brand) .fi-simple-header-subheading {
    text-align: left;
    margin-top: 0.375rem;
}

body:has(> .lb-brand) .fi-input-wrp {
    border-radius: 0.75rem;
}

body:has(> .lb-brand) .fi-input-wrp input {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

body:has(> .lb-brand) .fi-form-actions .fi-btn {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    border-radius: 0.75rem;
    font-weight: 600;
    color: #fff;
    /* White text needs green-700 or darker for 4.5:1 (green-600 measured 3.2:1). */
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
    box-shadow: 0 10px 22px -10px color-mix(in oklab, var(--primary-700) 70%, transparent);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

body:has(> .lb-brand) .fi-form-actions .fi-btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 14px 28px -12px color-mix(in oklab, var(--primary-700) 80%, transparent);
}

body:has(> .lb-brand) .fi-form-actions .fi-btn:active {
    transform: translateY(1px);
}

.lb-login-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* gray-500 on the dark background measured 4.23:1; gray-400 keeps it above 4.5:1. */
.dark .lb-login-note {
    color: var(--gray-400);
}

.lb-login-note-icon {
    width: 1rem;
    height: 1rem;
    color: var(--primary-600);
}

/* Desktop: two columns, brand panel full height */
@media (min-width: 1024px) {
    body:has(> .lb-brand) {
        flex-direction: row;
    }

    .lb-brand {
        flex: 0 0 51%;
        justify-content: space-between;
        padding: 3rem clamp(2.5rem, 5vw, 5rem);
        min-height: 100dvh;
    }

    .lb-brand-body,
    .lb-brand-foot {
        display: block;
    }

    body:has(> .lb-brand) .fi-simple-main,
    .dark body:has(> .lb-brand) .fi-simple-main {
        padding: 2.75rem 2.5rem;
        background: transparent;
        backdrop-filter: none;
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    body:has(> .lb-brand) .fi-form-actions .fi-btn {
        transition: none;
    }
}
