﻿/* The WPF host renders into #app (unlike the web host, which renders into body), so it must fill the window: */
#app {
    height: 100%;
}

/* ── Stage: dark, calm, technical ─────────────────────────────────── */
.rodly-login {
    --ink: #0b1220;
    --ink-2: #111a2e;
    --blue: #1986f2;
    --blue-soft: #60a5fa;
    --line: rgba(148, 163, 184, 0.14);
    --text: #e2e8f0;
    --muted: #94a3b8;

    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    min-height: 100vh;
    overflow: hidden;
    font-family: Poppins, sans-serif;
    color: var(--text);
    background:
        radial-gradient(60rem 40rem at 15% 110%, rgba(25, 134, 242, 0.22), transparent 60%),
        radial-gradient(40rem 30rem at 95% -10%, rgba(96, 165, 250, 0.14), transparent 60%),
        linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
}

/* Blueprint grid, slowly drifting: */
.rodly-login::before {
    content: "";
    position: absolute;
    inset: -64px;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at 30% 60%, #000 20%, transparent 75%);
    animation: rodly-grid 40s linear infinite;
    pointer-events: none;
}

@keyframes rodly-grid {
    to { transform: translate(64px, 64px); }
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.rodly-login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 56px 64px;
}

.rodly-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    animation: rodly-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--blue-soft), var(--blue));
    box-shadow: 0 8px 24px rgba(25, 134, 242, 0.45);
    font-weight: 700;
    color: #fff;
}

    .rodly-login-mark img {
        width: 60%;
        height: 60%;
        display: block;
    }

.rodly-login-eyebrow {
    margin: 0 0 18px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--blue-soft);
    animation: rodly-rise 0.8s 0.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-title {
    margin: 0;
    max-width: 12ch;
    font-size: clamp(2.6rem, 5.2vw, 4.6rem);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.035em;
    color: #fff;
    animation: rodly-rise 0.9s 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-title span {
    background: linear-gradient(90deg, var(--blue-soft), var(--blue));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.rodly-login-lead {
    max-width: 34rem;
    margin: 22px 0 0;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--muted);
    animation: rodly-rise 0.9s 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-steps {
    display: flex;
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.78rem;
    color: var(--muted);
    animation: rodly-rise 0.9s 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-steps li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rodly-login-steps b {
    font-weight: 600;
    color: var(--blue-soft);
}

/* ── Panel (form / companies) ─────────────────────────────────────── */
.rodly-login-side {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.rodly-login-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 380px;
    padding: 36px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(18px);
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: rodly-rise 0.9s 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-card h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
}

.rodly-login-card .rodly-login-sub {
    margin: -10px 0 4px;
    font-size: 0.88rem;
    color: var(--muted);
}

.rodly-login-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rodly-login-card label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.rodly-login-card input {
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.45);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    letter-spacing: normal;
    text-transform: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rodly-login-card input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(25, 134, 242, 0.22);
}

.rodly-login-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
    padding: 13px 20px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--blue-soft) 0%, var(--blue) 100%);
    box-shadow: 0 12px 30px rgba(25, 134, 242, 0.35);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.rodly-login-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(25, 134, 242, 0.45);
}

.rodly-login-primary:disabled,
.rodly-login-secondary:disabled,
.rodly-login-company:disabled {
    opacity: 0.6;
    cursor: default;
}

.rodly-login-arrow {
    transition: transform 0.2s;
}

.rodly-login-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rodly-login-spin 0.8s linear infinite;
}

@keyframes rodly-login-spin {
    to { transform: rotate(360deg); }
}

.rodly-login-primary:hover:not(:disabled) .rodly-login-arrow,
.rodly-login-company:hover:not(:disabled) .rodly-login-arrow {
    transform: translateX(4px);
}

.rodly-login-secondary {
    align-self: flex-start;
    padding: 6px 0;
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}

.rodly-login-secondary:hover:not(:disabled) {
    color: #fff;
}

/* ── Companies ─────────────────────────────────────────────────────── */
.rodly-login-companies {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50vh;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.rodly-login-companies li {
    animation: rodly-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rodly-login-company {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.35);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.rodly-login-company:hover:not(:disabled) {
    border-color: rgba(25, 134, 242, 0.6);
    background: rgba(25, 134, 242, 0.12);
    transform: translateY(-1px);
}

.rodly-login-company.is-busy {
    border-color: var(--blue);
    background: rgba(25, 134, 242, 0.16);
}

.rodly-login-initial {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(25, 134, 242, 0.18);
    color: var(--blue-soft);
    font-weight: 700;
}

.rodly-login-company-name {
    flex: 1;
    font-weight: 500;
}

.rodly-login-arrow {
    color: var(--blue-soft);
}

.rodly-login-error {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 10px;
    background: rgba(127, 29, 29, 0.25);
    color: #fca5a5;
    font-size: 0.85rem;
}

/* ── Spinner / loading ─────────────────────────────────────────────── */
.rodly-login-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rodly-spin 0.8s linear infinite;
}

.rodly-loading {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    min-height: 100vh;
    overflow: hidden;
    font-family: Poppins, sans-serif;
    color: #94a3b8;
    background:
        radial-gradient(40rem 30rem at 50% 60%, rgba(25, 134, 242, 0.18), transparent 65%),
        linear-gradient(160deg, #0b1220 0%, #111a2e 100%);
}

.rodly-loading-mark {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, #60a5fa, #1986f2);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    animation: rodly-pulse 2s ease-in-out infinite;
}

    .rodly-loading-mark img {
        width: 60%;
        height: 60%;
        display: block;
    }

.rodly-loading-track {
    position: relative;
    width: 180px;
    height: 2px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.18);
}

.rodly-loading-track::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    background: linear-gradient(90deg, transparent, #60a5fa, transparent);
    animation: rodly-scan 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.rodly-loading-text {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

@keyframes rodly-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes rodly-spin {
    to { transform: rotate(360deg); }
}

@keyframes rodly-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(25, 134, 242, 0.5), 0 12px 32px rgba(25, 134, 242, 0.35); }
    50% { box-shadow: 0 0 0 18px rgba(25, 134, 242, 0), 0 12px 32px rgba(25, 134, 242, 0.35); }
}

@keyframes rodly-scan {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

/* ── Intro: the loading screen dissolves like a lifting mist into the welcome ─────── */
/* The stage only wraps the app; it must keep the full window height (no transforms, they break fixed/100% layouts): */
.rodly-stage {
    height: 100%;
}

.rodly-intro {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: none;
    pointer-events: none;
}

/* Soft clouds in the colors of the loading screen; they drift apart and evaporate: */
.rodly-intro-cloud {
    position: absolute;
    width: 90vmax;
    height: 90vmax;
    border-radius: 50%;
    background: radial-gradient(closest-side, #111a2e 0%, rgba(17, 26, 46, 0.92) 45%, rgba(17, 26, 46, 0) 100%);
    filter: blur(30px);
}

.rodly-intro-cloud--1 { left: -30vmax; top: -35vmax; }
.rodly-intro-cloud--2 { right: -30vmax; top: -25vmax; }
.rodly-intro-cloud--3 { left: -25vmax; bottom: -35vmax; }
.rodly-intro-cloud--4 { right: -30vmax; bottom: -30vmax; }
.rodly-intro-cloud--5 { left: calc(50% - 45vmax); top: calc(50% - 45vmax); }

.rodly-intro-base {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(40rem 30rem at 50% 60%, rgba(25, 134, 242, 0.18), transparent 65%),
        linear-gradient(160deg, #0b1220 0%, #111a2e 100%);
}

/* The blue glow behind the mark, above the clouds so it stays visible until it fades with the mark: */
.rodly-intro-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(40rem 30rem at 50% 60%, rgba(25, 134, 242, 0.18), transparent 65%);
}

.rodly-intro.is-leaving .rodly-intro-glow {
    animation: rodly-mist-fade 0.6s ease-out both;
}

.rodly-intro-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.rodly-intro.is-leaving .rodly-intro-base {
    animation: rodly-mist-fade 0.6s ease-out both;
}

.rodly-intro.is-leaving .rodly-intro-content {
    animation: rodly-mist-content 0.45s ease-in both;
}

.rodly-intro.is-leaving .rodly-intro-cloud {
    animation: rodly-mist-drift 1.2s cubic-bezier(0.33, 0, 0.2, 1) both;
}

.rodly-intro.is-leaving .rodly-intro-cloud--1 { --dx: -18vw; --dy: -14vh; animation-delay: 0.05s; }
.rodly-intro.is-leaving .rodly-intro-cloud--2 { --dx: 18vw; --dy: -12vh; animation-delay: 0.2s; }
.rodly-intro.is-leaving .rodly-intro-cloud--3 { --dx: -16vw; --dy: 14vh; animation-delay: 0.15s; }
.rodly-intro.is-leaving .rodly-intro-cloud--4 { --dx: 16vw; --dy: 16vh; animation-delay: 0.3s; }
.rodly-intro.is-leaving .rodly-intro-cloud--5 { --dx: 0; --dy: -8vh; animation-delay: 0s; }

/* The welcome text of the workspace emerges from the mist: */
.rodly-stage.is-revealing .session-workspace__empty > * {
    animation: rodly-welcome 1s 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.rodly-stage.is-revealing .session-workspace__empty > :nth-child(2) {
    animation-delay: 0.5s;
}

/* After logging in: the curtain fades in over the login, the welcome emerges: */
.rodly-intro.is-entering {
    animation: rodly-intro-in 0.25s ease-out both;
}

.rodly-intro-welcome {
    font-size: 1.1rem;
    animation: rodly-welcome 0.7s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rodly-intro-in {
    from { opacity: 0; }
}

@keyframes rodly-mist-fade {
    to { opacity: 0; }
}

@keyframes rodly-mist-content {
    to { opacity: 0; filter: blur(8px); }
}

@keyframes rodly-mist-drift {
    from { opacity: 1; transform: translate(0, 0) scale(1); }
    to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.35); }
}

@keyframes rodly-welcome {
    from { opacity: 0; filter: blur(12px); letter-spacing: 0.04em; }
    to { opacity: 1; filter: blur(0); }
}


/* Narrow windows: hide the hero, keep the panel: */
@media (max-width: 860px) {
    .rodly-login {
        grid-template-columns: 1fr;
    }

    .rodly-login-hero {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rodly-login *,
    .rodly-login::before,
    .rodly-loading *,
    .rodly-stage {
        animation: none !important;
        transition: none !important;
    }

    .rodly-intro.is-leaving {
        display: none;
    }
}
