/* Auth mobile splash and standalone layout, loaded only by auth layout */
#login-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 46%, rgba(255,255,255,0.08), transparent 18%),
        linear-gradient(180deg, #1d5a43 0%, #1c573f 100%);
    overflow: hidden;
    will-change: opacity, transform;
    transition: opacity 0.42s ease, visibility 0s linear 0.42s;
}
#login-splash.splash-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#login-splash::before {
    content: "";
    position: absolute;
    inset: -18% -22%;
    background:
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.09), transparent 23%),
        radial-gradient(circle at 18% 22%, rgba(255,255,255,0.05), transparent 18%),
        radial-gradient(circle at 82% 76%, rgba(255,255,255,0.04), transparent 16%);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.8s ease, transform 1.2s ease;
}

#login-splash.splash-ready::before {
    opacity: 1;
    transform: scale(1);
}

@media (min-width: 992px) { #login-splash { display: none !important; } }

.splash-inner {
    position: relative;
    display: grid;
    justify-items: center;
    width: min(320px, calc(100vw - 4rem));
    isolation: isolate;
}

.splash-inner::before {
    content: "";
    position: absolute;
    width: min(280px, 78vw);
    height: 110px;
    top: 50%;
    left: 50%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.08) 42%, transparent 72%);
    filter: blur(18px);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
    transition: opacity 0.7s ease, transform 1s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: -1;
}

#login-splash.splash-ready .splash-inner::before {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1);
}

.splash-inner::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 156px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.72) 50%, rgba(255,255,255,0) 100%);
    filter: blur(5px);
    opacity: 0;
    transform: translate(-210px, -50%) rotate(18deg);
    pointer-events: none;
    mix-blend-mode: screen;
}

.splash-wordmark {
    width: min(248px, 70vw);
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    display: block;
    transform-origin: center;
    opacity: 0;
    transform: scale(0.76) translateY(10px);
    will-change: transform, opacity;
}

#login-splash.splash-ready .splash-wordmark {
    animation:
        splash-logo-in 0.98s cubic-bezier(0.22, 1, 0.36, 1) forwards,
        splash-logo-float 2.8s ease-in-out 1.05s infinite;
}

#login-splash.splash-accent .splash-inner::after {
    animation: splash-sheen 0.92s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes splash-logo-in {
    0% {
        opacity: 0;
        transform: scale(0.76) translateY(10px);
        filter: brightness(0) invert(1) blur(10px);
    }
    58% {
        opacity: 1;
        filter: brightness(0) invert(1) blur(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: brightness(0) invert(1);
    }
}

@keyframes splash-logo-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.012); }
}

@keyframes splash-sheen {
    0% {
        opacity: 0;
        transform: translate(-210px, -50%) rotate(18deg);
    }
    18% { opacity: 0.95; }
    100% {
        opacity: 0;
        transform: translate(186px, -50%) rotate(18deg);
    }
}

@media (max-width: 991.98px) {
    .auth-standalone-body {
        background: #1d5a43 !important;
        overflow-x: hidden;
    }
    .auth-standalone-body.auth-login-mobile {
        background: #1d5a43 !important;
    }
    .auth-standalone-body .container {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .auth-standalone-body .auth-shell-clean {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 0;
    }
    .auth-standalone-body .auth-surface {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 100vh;
        width: 100%;
        gap: 0;
        margin: 0;
    }
    .auth-standalone-body .auth-surface-visual { display: none !important; }
    .auth-standalone-body .auth-surface-form {
        display: flex;
        flex-direction: column;
        flex: 1;
        gap: 0;
        padding: 0;
    }
    .auth-standalone-body .auth-surface-brand {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding: calc(env(safe-area-inset-top, 0px) + 1.8rem) 1.5rem 1.35rem;
        min-height: 148px;
        max-height: 172px;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }
    .auth-mobile-header {
        display: block;
        width: 100%;
    }
    .auth-mobile-header-logo {
        width: min(250px, 68vw);
        height: auto;
        object-fit: contain;
        filter: brightness(0) invert(1);
        display: block;
        margin: 0 auto;
    }
    .auth-standalone-body .auth-login-card,
    .auth-standalone-body .auth-login-card-clean {
        flex: 1;
        border-radius: 32px 32px 0 0 !important;
        padding: 2rem 1.35rem calc(1.6rem + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: 0 -16px 42px rgba(8, 24, 19, 0.2) !important;
        background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,250,248,0.98) 100%) !important;
        overflow-y: auto;
        position: relative;
    }
    .auth-standalone-body .auth-login-title {
        font-size: 2.15rem;
        margin-bottom: 0.45rem;
    }
    .auth-standalone-body .auth-login-copy {
        font-size: 0.93rem;
        line-height: 1.55;
    }
    .auth-standalone-body .form-label {
        color: var(--forest);
        font-size: 0.86rem;
        font-weight: 700;
        margin-bottom: 0.45rem;
    }
    .auth-standalone-body .form-control {
        min-height: 54px;
        border-radius: 16px;
        border-color: rgba(20, 53, 43, 0.12);
        background: #fff;
        padding-inline: 1rem;
        font-size: 0.98rem;
        box-shadow: none;
    }
    .auth-standalone-body .form-control:focus {
        border-color: rgba(45, 115, 87, 0.42);
        box-shadow: 0 0 0 4px rgba(99, 192, 138, 0.12);
    }
    .auth-standalone-body .password-toggle-btn {
        right: 0.85rem;
    }
    .auth-standalone-body .btn.btn-primary {
        min-height: 54px;
        border-radius: 16px;
        font-weight: 800;
        letter-spacing: -0.01em;
        background: linear-gradient(135deg, #1e4d3a 0%, #2f7b5b 100%);
        border: none;
        box-shadow: 0 16px 28px rgba(30, 77, 58, 0.18);
    }
    .auth-standalone-body .auth-surface-brand {
        opacity: 0;
        transform: translateY(-16px) scale(0.96);
        transition: opacity 0.48s ease, transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .auth-standalone-body .auth-login-card,
    .auth-standalone-body .auth-login-card-clean {
        opacity: 0;
        transform: translateY(34px);
        transition: opacity 0.55s ease 0.14s, transform 0.62s cubic-bezier(0.22, 1, 0.36, 1) 0.14s;
    }
    body.splash-done .auth-surface-brand,
    body.splash-done .auth-login-card,
    body.splash-done .auth-login-card-clean {
        opacity: 1 !important;
        transform: none !important;
    }
    body.no-splash .auth-surface-brand,
    body.no-splash .auth-login-card,
    body.no-splash .auth-login-card-clean {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    body.auth-splash-leaving #login-splash .splash-wordmark {
        transform: translateY(-28vh) scale(0.78);
        opacity: 0.94;
        transition: transform 0.82s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
    }
    body.auth-splash-leaving #login-splash .splash-inner::before {
        opacity: 0.45;
        transform: translate(-50%, -50%) scale(1.16);
        transition: opacity 0.46s ease, transform 0.82s cubic-bezier(0.22, 1, 0.36, 1);
    }
    #login-splash::after {
        content: "";
        position: absolute;
        inset: auto 0 0;
        height: 180px;
        background: linear-gradient(180deg, rgba(20,53,43,0) 0%, rgba(20,53,43,0.28) 100%);
        pointer-events: none;
        transition: opacity 0.24s ease;
    }
    body.auth-splash-leaving #login-splash::after {
        opacity: 0;
    }
    body.auth-splash-leaving #login-splash::before {
        opacity: 0.68;
        transform: scale(1.06);
    }
}

@media (min-width: 992px) {
    .auth-mobile-header { display: none; }
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
