/* login page: animated scene on the left (behind the form on phones), form card on the right */
:root {
    /* Mirrors resources/css/palette.css (this page does not load Tailwind). */
    --brand: #cd2f06;        /* primary-600: buttons, focus (white text passes AA) */
    --brand-light: #ea4724;  /* primary-500: the IST logo orange */
    --brand-text: #cd2f06;   /* brand-colored text on the page background */
    --brand-2: #2abafc;      /* secondary-400: the Verita logo blue */
    --brand-2-soft: #b8e4fe; /* secondary-200 */
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --card: #ffffff;
    --page: #f5f6fb;
    --field: #f9fafb;
    --danger: #e11d48;
    --danger-bg: #fef2f2;
    --ok: #0d853a;
    --ok-bg: #f0fdf4;
    --scene-1: #012a3e;
    --scene-2: #055779;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #f3f4f6;
        --muted: #9ca3af;
        --line: #2f3442;
        --card: #161a24;
        --page: #0d1017;
        --field: #1d2230;
        --danger-bg: rgba(220, 38, 38, .12);
        --ok-bg: rgba(21, 128, 61, .14);
        --brand-text: #fe7254;  /* primary-400 */
        --danger: #fd8189;
        --ok: #61cf7b;
    }
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--page);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

.login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr);
}

/* ---------- scene ---------- */
.login-scene {
    position: relative;
    overflow: hidden;
    background: radial-gradient(120% 90% at 10% 0%, var(--scene-2) 0%, var(--scene-1) 60%, #00131d 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(32px, 5vw, 64px);
}

#login-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.scene-copy { position: relative; max-width: 520px; }

.scene-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    backdrop-filter: blur(6px);
}

.scene-copy h1 {
    font-size: clamp(30px, 3.4vw, 46px);
    line-height: 1.12;
    font-weight: 800;
    margin: 20px 0 14px;
    letter-spacing: -.02em;
}

.scene-accent {
    background: linear-gradient(90deg, var(--brand-2-soft), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    transition: opacity .35s ease, transform .35s ease;
}

.scene-accent.swap { opacity: 0; transform: translateY(8px); }

.scene-copy p { color: rgba(255, 255, 255, .72); font-size: 16px; margin: 0; }

.scene-flow {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 220px));
    gap: 14px;
    margin-top: 40px;
}

.flow-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    transition: transform .25s ease-out, background .25s, border-color .25s;
    opacity: 0;
    animation: card-in .7s cubic-bezier(.2, .8, .2, 1) forwards;
}

.flow-card:nth-child(1) { animation-delay: .15s; }
.flow-card:nth-child(2) { animation-delay: .3s; margin-top: 26px; }
.flow-card:nth-child(3) { animation-delay: .45s; }
.flow-card:nth-child(4) { animation-delay: .6s; margin-top: 26px; }

.flow-card.lit { background: rgba(255, 255, 255, .16); border-color: rgba(131, 209, 254, .6); }

.flow-card > i {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 18px;
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
}

.flow-card b { display: block; font-size: 14px; font-weight: 700; }
.flow-card small { display: block; font-size: 12px; color: rgba(255, 255, 255, .65); }

.flow-bar {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 7px;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .15);
    overflow: hidden;
}

.flow-bar span {
    display: block;
    height: 100%;
    width: 60%;
    background: linear-gradient(90deg, var(--brand-2), var(--brand-2-soft));
    animation: bar 3.2s ease-in-out infinite alternate;
}

@keyframes card-in {
    from { opacity: 0; translate: 0 18px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes bar {
    from { width: 35%; }
    to { width: 85%; }
}

/* ---------- form ---------- */
.login-panel {
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    animation: card-in .6s cubic-bezier(.2, .8, .2, 1) both;
}

.login-logo { height: 56px; width: auto; margin-bottom: 28px; }

.login-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }

.login-sub { color: var(--muted); margin: 0 0 28px; }

.login-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 14px;
    margin-bottom: 18px;
    animation: shake .4s ease;
}

.login-alert-ok { background: var(--ok-bg); color: var(--ok); animation: none; }

@keyframes shake {
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.field { position: relative; margin-bottom: 16px; }

.field input {
    width: 100%;
    height: 56px;
    padding: 22px 46px 8px 46px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--field);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.field input:focus {
    border-color: var(--brand-light);
    background: var(--card);
    box-shadow: 0 0 0 4px rgba(234, 71, 36, .15);
}

.field label {
    position: absolute;
    left: 46px;
    top: 18px;
    font-size: 15px;
    color: var(--muted);
    pointer-events: none;
    transition: top .18s ease, font-size .18s ease, color .18s ease;
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--brand-text);
}

.field-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 17px;
    transition: color .2s;
}

.field input:focus ~ .field-icon { color: var(--brand-text); }

.field-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    cursor: pointer;
}

.field-toggle:hover { color: var(--ink); background: rgba(127, 127, 127, .1); }

.caps-hint { font-size: 13px; color: #a36701; margin: -6px 0 12px 4px; }

.remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    margin: 4px 0 24px;
}

.remember input { width: 17px; height: 17px; accent-color: var(--brand); }

.login-btn {
    position: relative;
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(110deg, var(--brand) 0%, var(--brand-light) 50%, var(--brand) 100%);
    background-size: 200% 100%;
    box-shadow: 0 10px 24px rgba(234, 71, 36, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-position .5s ease, transform .15s ease, box-shadow .2s;
}

.login-btn:hover { background-position: 100% 0; box-shadow: 0 14px 30px rgba(234, 71, 36, .45); }
.login-btn:active { transform: scale(.985); }
.login-btn:focus-visible { outline: 3px solid rgba(234, 71, 36, .45); outline-offset: 3px; }

.btn-arrow { transition: transform .2s ease; }
.login-btn:hover .btn-arrow { transform: translateX(4px); }

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

.login-btn.loading { pointer-events: none; }
.login-btn.loading .btn-label,
.login-btn.loading .btn-arrow { display: none; }
.login-btn.loading .btn-spinner { display: block; }

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

.login-foot { margin: 32px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- tablet / phone: the scene becomes the backdrop ---------- */
@media (max-width: 960px) {
    .login { grid-template-columns: 1fr; }

    .login-scene {
        position: fixed;
        inset: 0;
        padding: 0;
        z-index: 0;
    }

    .scene-copy, .scene-flow { display: none; }

    .login-panel { position: relative; z-index: 1; min-height: 100vh; }

    .login-card {
        background: var(--card);
        padding: 32px 24px;
        border-radius: 22px;
        box-shadow: 0 24px 60px rgba(0, 19, 29, .5);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ---------- additions for this app ---------- */
.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 24px;
}

.login-row .remember { margin: 0; }

.login-link { font-size: 14px; font-weight: 600; color: var(--brand-text); text-decoration: none; }
.login-link:hover { text-decoration: underline; }

.login-card form { margin: 0; }
.login-card form .login-btn { margin-top: 8px; }
.login-row + .login-btn { margin-top: 0 !important; }

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

.login-text-btn {
    display: block;
    margin: 16px auto 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}

.login-text-btn:hover { color: var(--ink); text-decoration: underline; }
