/* ══════════════════════════════════════════════════════════════
   Login Page — Frosted Alpine  (matches variant-A-frosted-alpine.html)
   ══════════════════════════════════════════════════════════════ */

/* ── CSS variables (override auth-shared defaults) ── */
:root {
    --brand:       #002395;
    --accent:      #ffb612;
    --brand-hover: #0033cc;
}

/* ── Animations ── */
@keyframes panelIn {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes logoFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 0.72; }
}
@keyframes itemIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Reset auth-shared body overrides ── */
body,
body.login-shell {
    margin: 0;
    min-height: 100vh;
    background-color: #1a2d4e;
    background-image: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #1e293b;
}

/* Remove auth-shared grid overlay */
body::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(10, 22, 46, 0.12), rgba(10, 22, 46, 0.24)),
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 34%);
    pointer-events: none;
    z-index: 0;
    background-image: none; /* kill auth-shared grid */
    mask-image: none;
}

/* Remove auth-shared yellow stripes */
body::after {
    display: none;
}

/* ── Background photo layer ── */
.bg-layer {
    position: fixed;
    inset: 0;
    background-image: url('/images/loginBackground/juno-mountains-medium.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 0;
    pointer-events: none;
}
.bg-layer.loaded { opacity: 1; }

/* Dark grey overlay to dim the background without blurring it */
.bg-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 38, 0.45);
    pointer-events: none;
}

/* ── Corner logos ── */
.scene-logo {
    position: fixed;
    z-index: 1;
    pointer-events: none;
    animation: logoFadeIn 0.6s ease both;
}
.scene-logo img {
    display: block;
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1);
}

/* JunoAMS logo — mirrors the navbar brand: same top-left anchor, height, and padding */
.scene-logo-juno {
    top: 0;
    left: 0;
    width: auto;
    height: 44px;       /* matches --nav-height in navbar.css */
    display: flex;
    align-items: center;
    padding: 0 1.25rem; /* matches .navbar-juno side padding */
}
.scene-logo-juno img {
    width: auto;
    height: 26px;       /* matches .juno-header-logo height in layout-shell.css */
}

/* Lonrix logo — same width AND screen position as the authenticated
   shell footer Lonrix. The shell footer has `padding: 0.15rem 1.5rem`
   and its mark sits flush at the right edge — replicate those offsets
   here so the brand sits at byte-identical coordinates on login and
   post-login. */
.scene-logo-lonrix {
    bottom: 0.4rem;
    right: 1.5rem;
    width: 100px;
}
.scene-logo-lonrix img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Frosted glass panel ── */
.login-panel {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    box-shadow:
        0 26px 48px rgba(8, 20, 48, 0.18),
        0 8px 18px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.62);
    padding: 2rem;
    animation: panelIn 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

/* ── Client/account logo ── */
.client-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
    animation: itemIn 0.5s ease 0.45s both;
}
.client-logo-wrap img {
    display: block;
    width: auto;
    max-width: 210px;
    height: 44px;
    object-fit: contain;
}
.client-logo-wrap img.d-none,
.client-logo-wrap:has(img.d-none) { display: none; }

/* Hide the divider too when there is no client logo above it */
.client-logo-wrap:has(img.d-none) + .divider { display: none; }

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid rgba(0, 35, 149, 0.1);
    margin: 0.75rem 0 1.25rem;
    animation: itemIn 0.5s ease 0.5s both;
}

/* ── Page heading ── */
.login-panel h1 {
    color: var(--brand);
    font-size: 1.55rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
    animation: itemIn 0.5s ease 0.55s both;
}

/* ── Form fields ── */
.field {
    position: relative;
    margin-bottom: 1rem;
}

.field:nth-of-type(1) { animation: itemIn 0.45s ease 0.60s both; }
.field:nth-of-type(2) { animation: itemIn 0.45s ease 0.67s both; }
.field:nth-of-type(3) { animation: itemIn 0.45s ease 0.74s both; }

.field-icon {
    position: absolute;
    left: 0.9rem;
    top: 0;
    height: 2.9rem; /* pin to input height — stays centred even when .field-error adds height */
    display: flex;
    align-items: center;
    transform: none;
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.15s;
    z-index: 2;
}
.field:focus-within .field-icon { color: var(--brand); }

/* ── Inputs (email, password, select) ── */
.login-panel input[type="email"],
.login-panel input[type="password"],
.login-panel input[type="text"],
.login-panel select {
    width: 100%;
    padding: 0.8rem 0.9rem 0.8rem 2.6rem;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.login-panel input[type="email"]:focus,
.login-panel input[type="password"]:focus,
.login-panel input[type="text"]:focus,
.login-panel select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 35, 149, 0.1);
}
.login-panel input::placeholder {
    color: #a0aec0;
    font-size: 0.92rem;
}

/* Password field: right padding for eye button */
.login-panel input[type="password"] {
    padding-right: 2.8rem;
}

/* ── Eye / password toggle ── */
.eye-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.9rem;
    line-height: 1;
}
.eye-btn:hover { color: var(--brand); }

/* ── Caps lock warning ── */
.caps-warn {
    font-size: 0.8rem;
    color: #b45309;
    margin-top: 0.35rem;
}
.caps-warn.d-none { display: none; }

/* ── Field-level validation errors ── */
.field-error {
    display: block;
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 0.3rem;
}
.field-error:empty { display: none; }

/* Suppress Bootstrap's validation icon + padding override — the custom field style handles invalid state */
.login-panel input.is-invalid,
.login-panel input.input-validation-error {
    background-image: none;
    padding-right: 0.9rem;
    border-color: #dc3545;
    box-shadow: none;
}
.login-panel input[type="password"].is-invalid,
.login-panel input[type="password"].input-validation-error {
    padding-right: 2.8rem; /* preserve room for eye toggle */
}

/* ── Account dropdown (CSS slide-in, no d-none) ── */
.account-row {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-12px);
    transition:
        max-height 0.38s ease,
        opacity    0.3s  ease,
        transform  0.3s  ease,
        margin-bottom 0.3s ease;
    margin-bottom: 0;
}
.account-row.visible {
    max-height: 140px;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 1rem;
}

/* ── Multi-account notice (inside .account-row) ── */
.multi-account-notice {
    font-size: 0.82rem;
    color: #0369a1;
    background: rgba(3, 105, 161, 0.09);
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    margin: 0 0 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ── Remember me + forgot row ── */
.row-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    animation: itemIn 0.45s ease 0.80s both;
}
.check-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #334155;
    cursor: pointer;
    font-size: 0.88rem;
    user-select: none;
}
.check-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--brand);
    cursor: pointer;
    flex-shrink: 0;
}
.forgot-link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
}
.forgot-link:hover { text-decoration: none; color: var(--brand-hover); }

/* ── Error / validation message ── */
.error-msg {
    display: none;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.error-msg.show,
.validation-summary-errors { display: block; }

/* Style asp-validation-summary errors to match */
.validation-summary-errors {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    list-style: none;
}
.validation-summary-errors ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.validation-summary-valid { display: none; }

/* ── Submit / login button — uses global .btn-junoams (client-ui.css) ── */
/* Login-page entrance animation applied here so the global class stays animation-free */
.btn-junoams { animation: itemIn 0.45s ease 0.87s both; }

/* ── Modal input (inside forgot password modal) ── */
.modal-input {
    width: 100%;
    padding: 0.8rem 0.9rem 0.8rem 2.6rem;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 35, 149, 0.1);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .login-panel {
        padding: 1.45rem 1.1rem 1.2rem;
        border-radius: 16px;
    }
    .scene-logo-juno   { top: 1.25rem; left:  1.25rem; width: 80px; }
    .scene-logo-lonrix { bottom: 0.4rem; right: 1rem; width: 80px; }
    .row-split {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-height: 640px) {
    body, body.login-shell { align-items: flex-start; padding-top: 1.5rem; }
    .login-panel { padding: 1.5rem; }
    .login-panel h1 { font-size: 1.3rem; margin-bottom: 1rem; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
