﻿/* Login page (Views/Home/Index.cshtml) — split layout: form card left, grain-gradient brand panel right.
   Plain CSS (no Bootstrap / Tailwind). Light theme only (color-scheme: light, so the OS dark mode doesn't recolour it).
   Field colours are solid on purpose: browser autofill ignores transparent backgrounds and paints its own light blue. */

:root {
    color-scheme: light;
    --lg-bg: #f3f5f9;
    --lg-card: #ffffff;
    --lg-ink: #0b0f17;
    --lg-ink-2: #5b6474;
    --lg-ink-3: #8a93a3;
    --lg-line: #dfe3ea;
    --lg-field: #ffffff;
    --lg-field-hover: #f8fafc;
    --lg-icon: #8a93a3;
    --lg-primary: #0556B3;
    --lg-primary-hover: #04479a;
    --lg-primary-ink: #ffffff;
    --lg-focus: rgba(5, 86, 179, .2);
    --lg-error: #c62828;
    --lg-error-bg: #fdecec;
    --lg-ok: #1b7f3b;
    --lg-ok-bg: #e7f6ec;
    --lg-accent: #0A7BEF;        /* gradient colour: Osyro blue (the original design used #FC7819) */
    --lg-accent-deep: #0556B3;
}

/* Fonts: Manrope for body / buttons / forms / navigation, Instrument Serif (regular only) for headlines.
   html:root outranks font-geist.css's :root, which loads after this file. */
html:root {
    --app-font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --lg-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
}

[ng-cloak], .ng-cloak { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
.lg-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

body.lg-body {
    background:
        radial-gradient(900px 520px at 0% 0%, #e6effc 0%, transparent 60%),
        radial-gradient(700px 420px at 30% 100%, #eef3fb 0%, transparent 60%),
        var(--lg-bg);
    color: var(--lg-ink);
    font-family: var(--app-font, 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
    -webkit-font-smoothing: antialiased;
    font-synthesis: none;
}

/* ── Layout ── */
/* desktop: exactly one screen tall; the form card scrolls inside itself if a screen is too short, the agents scale down */
.lg-page { height: 100vh; height: 100dvh; padding: 12px; }
.lg-grid { display: grid; gap: 12px; height: 100%; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr); }

/* ── Form card ── */
.lg-card {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--lg-line);
    border-radius: 16px;
    background: var(--lg-card);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .1);
    padding: 32px clamp(24px, 5vw, 72px) 24px;
}
.lg-brand { display: flex; align-items: center; gap: 10px; color: var(--lg-ink); }
/* logo.png is a 500 px square: grows with the window, 52 px on phones up to 72 px on wide screens */
.lg-brand img { height: clamp(52px, 4.4vw, 72px); width: auto; }
.lg-brand span { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }

.lg-card-main { flex: 1; display: flex; align-items: center; padding: 48px 0; }
.lg-card-inner { width: 100%; max-width: 420px; margin: 0 auto; }

.lg-title { margin: 0; font-family: var(--lg-display); font-size: clamp(36px, 3.3vw, 48px); line-height: 1.05; font-weight: 400; letter-spacing: -.01em; }
.lg-sub { margin: 10px 0 0; font-size: 16px; line-height: 1.5; color: var(--lg-ink-2); }

.lg-form { margin-top: 36px; display: grid; gap: 20px; }

.lg-group { display: grid; gap: 8px; }
.lg-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lg-label { font-size: 14px; font-weight: 500; color: var(--lg-ink); }
.lg-req { color: var(--lg-error); margin-left: 2px; }

.lg-field {
    position: relative;
    display: flex;
    align-items: center;
    height: 50px;
    border: 1px solid var(--lg-line);
    border-radius: 12px;
    background: var(--lg-field);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.lg-field:hover { border-color: #c9cfd9; }
.lg-field:focus-within { border-color: var(--lg-primary); box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-field.is-invalid { border-color: var(--lg-error); }
.lg-field.is-invalid:focus-within { box-shadow: 0 0 0 4px rgba(198, 40, 40, .15); }
.lg-field-icon { flex-shrink: 0; display: inline-flex; padding: 0 4px 0 14px; color: var(--lg-icon); pointer-events: none; }
.lg-field-icon svg { width: 18px; height: 18px; }
.lg-field:focus-within .lg-field-icon { color: var(--lg-primary); }
.lg-field input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0 14px 0 8px;
    border: 0;
    border-radius: 12px;
    outline: none;
    background: transparent;
    color: var(--lg-ink);
    caret-color: var(--lg-primary);
    font: inherit;
    font-size: 16px;
}
.lg-field input::placeholder { color: var(--lg-ink-3); }
/* autofill: repaint Chrome / Edge's light-blue fill with the field colour */
.lg-field input:-webkit-autofill,
.lg-field input:-webkit-autofill:hover,
.lg-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--lg-ink);
    -webkit-box-shadow: 0 0 0 1000px var(--lg-field) inset;
    box-shadow: 0 0 0 1000px var(--lg-field) inset;
    caret-color: var(--lg-primary);
    transition: background-color 9999s ease-out 0s;
}

.lg-eye {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 5px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--lg-icon);
    cursor: pointer;
}
.lg-eye:hover { color: var(--lg-ink); background: #f1f3f7; }
.lg-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lg-focus); }
.lg-eye svg { width: 19px; height: 19px; }

.lg-hint { margin: 0; font-size: 13px; color: var(--lg-error); }

.lg-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--lg-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.lg-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.lg-link:focus-visible { outline: none; border-radius: 4px; box-shadow: 0 0 0 3px var(--lg-focus); }

.lg-msg { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 11px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45; color: var(--lg-error); background: var(--lg-error-bg); }
.lg-msg svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.lg-msg.is-ok { color: var(--lg-ok); background: var(--lg-ok-bg); }

.lg-submit {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 12px;
    background: var(--lg-primary);
    color: var(--lg-primary-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px -8px rgba(5, 86, 179, .6);
    transition: background-color .15s ease, transform .1s ease;
}
.lg-submit:hover { background: var(--lg-primary-hover); }
.lg-submit:active { transform: translateY(1px); }
.lg-submit:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-submit svg { width: 18px; height: 18px; transition: transform .15s ease; }
.lg-submit:hover svg { transform: translateX(3px); }

.lg-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--lg-ink-3); }

/* ── Brand panel: "Osyro agents" — light, dot-grid canvas with four agents wired to the Osyro hub ──
   Stage coordinates are a 560 × 420 box (same as the SVG viewBox); HTML parts are placed in % of it so wires and
   avatars line up at any size. Lightweight on purpose: SVG + transforms/opacity only, no WebGL, no blur filters. */
.lg-art {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 28px;
    border: 1px solid #dbe4f1;
    border-radius: 16px;
    background:
        radial-gradient(circle at 1px 1px, rgba(5, 86, 179, .13) 1px, transparent 1.6px) 0 0 / 22px 22px,
        radial-gradient(70% 60% at 50% 58%, rgba(10, 123, 239, .09), transparent 70%),
        linear-gradient(180deg, #f4f8fe 0%, #eaf1fb 100%);
    color: var(--lg-ink);
    padding: clamp(28px, 3.4vw, 52px);
}

.lg-art-head { max-width: 520px; }
.lg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 11px 5px 9px;
    border: 1px solid #cfe0f7;
    border-radius: 999px;
    background: #fff;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--lg-primary);
}
.lg-live { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); animation: lg-ping 2s ease-out infinite; }
@keyframes lg-ping { 70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.lg-art-title { margin: 16px 0 0; font-family: var(--lg-display); font-size: clamp(36px, 3.4vw, 50px); line-height: 1.05; font-weight: 400; letter-spacing: -.01em; color: #0b1730; }
.lg-art-lead { margin: 12px 0 0; max-width: 460px; font-size: 15.5px; line-height: 1.55; color: var(--lg-ink-2); }

.lg-stage-wrap { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
/* as large as the space allows: limited by the width, by the height (420 x 4/3 = 560) and by 700px */
.lg-stage { position: relative; width: min(100cqw, 133.333cqh, 700px); aspect-ratio: 560 / 420; container: lgstage / inline-size; }
/* small diagram: compact bubbles so they never run into the agent below */
@container lgstage (max-width: 540px) {
    .lg-bubble { padding: 7px 9px 8px; margin-top: 7px; }
    .lg-who span { display: none; }
    .lg-task { min-height: 0; font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .lg-state { margin-top: 4px; font-size: 10.5px; }
}
.lg-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lg-wire { fill: none; stroke: #b9c9df; stroke-width: 1.6; stroke-dasharray: 4 6; stroke-linecap: round; transition: stroke .3s ease; }
.lg-wire.is-flow { stroke: #6aa7ec; animation: lg-flow 1s linear infinite; }
@keyframes lg-flow { to { stroke-dashoffset: -20; } }
.lg-packet { fill: var(--lg-primary); stroke: #fff; stroke-width: 2.5; opacity: 0; transition: opacity .2s ease; }
.lg-packet.is-on { opacity: 1; }

/* hub */
.lg-hub {
    position: absolute;
    left: 40.714%; top: 37.619%; width: 18.571%;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 26%;
    background: #fff;
    border: 1px solid #d6e2f2;
    box-shadow: 0 18px 40px -18px rgba(5, 86, 179, .45), 0 2px 6px rgba(15, 23, 42, .05);
}
.lg-hub::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; box-shadow: 0 0 0 0 rgba(10, 123, 239, .35); }
.lg-hub.is-hit::after { animation: lg-hit .7s ease-out; }
@keyframes lg-hit { from { box-shadow: 0 0 0 0 rgba(10, 123, 239, .4); } to { box-shadow: 0 0 0 16px rgba(10, 123, 239, 0); } }
.lg-hub img { width: 44%; height: auto; }
.lg-hub-count { font-size: 10.5px; color: var(--lg-ink-2); white-space: nowrap; }
.lg-hub-count strong { color: var(--lg-ink); font-variant-numeric: tabular-nums; }

/* agents: box = avatar on top + bubble under it */
.lg-agent { position: absolute; width: 30.714%; }
.lg-a1 { left: 7.143%; top: 11.429%; }
.lg-a2 { left: 62.143%; top: 11.429%; }
.lg-a3 { left: 7.143%; top: 61.429%; }
.lg-a4 { left: 62.143%; top: 61.429%; }
.lg-av { position: relative; display: block; width: 32.558%; aspect-ratio: 1; margin-left: 16.279%; }
.lg-a2 .lg-av, .lg-a4 .lg-av { margin-left: 51.163%; }
.lg-av svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 10px rgba(15, 23, 42, .14)); }
/* working: a slow dashed ring turns around the avatar; done: a green tick badge */
.lg-av::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1.5px dashed transparent; }
.lg-agent.is-working .lg-av::before { border-color: #8db8ea; animation: lg-spin 6s linear infinite; }
.lg-av::after {
    content: '\2713';
    position: absolute;
    right: -4px; bottom: -2px;
    width: 18px; height: 18px;
    display: grid; place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    transform: scale(0);
    transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.lg-agent.is-done .lg-av::after { transform: scale(1); }

.lg-bubble {
    position: relative;
    margin-top: 10px;
    padding: 9px 11px 10px;
    border: 1px solid #dde6f2;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .3);
}
.lg-who { display: flex; align-items: baseline; gap: 6px; }
.lg-who strong { font-size: 13px; font-weight: 600; color: var(--lg-ink); }
.lg-who span { font-size: 11px; color: var(--lg-ink-3); }
.lg-task { margin-top: 3px; min-height: 2.7em; font-size: 12px; line-height: 1.35; color: var(--lg-ink-2); }
.lg-agent.is-done .lg-task { color: var(--lg-ink); }
.lg-state { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--lg-primary); }
.lg-state-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.lg-agent.is-working .lg-state-dot { animation: lg-blink 1s ease-in-out infinite; }
@keyframes lg-blink { 50% { opacity: .25; } }
.lg-agent.is-done .lg-state { color: #15803d; }

.lg-art-note { margin: 0; font-size: 11.5px; color: var(--lg-ink-3); }

/* ── Entrance: form and panel fade up once ── */
.lg-card-inner > *, .lg-brand, .lg-art-head, .lg-stage { animation: lg-in .6s cubic-bezier(.2, .7, .2, 1) both; }
.lg-card-inner > :nth-child(2) { animation-delay: .06s; }
.lg-card-inner > :nth-child(3) { animation-delay: .12s; }
.lg-stage { animation-delay: .18s; }
@keyframes lg-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .lg-card-inner > *, .lg-brand, .lg-art-head, .lg-stage, .lg-live, .lg-wire.is-flow, .lg-agent .lg-av::before, .lg-state-dot { animation: none !important; }
}

/* ── Busy overlay used by Home.js ($('#processing').show() while signing in) ── */
#processing { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .35); }
.lg-spinner { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 4px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: lg-spin .8s linear infinite; }
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* ── Short desktop screens: tighten spacing so everything fits one screen ── */
@media (min-width: 992px) and (max-height: 820px) {
    .lg-card { padding-top: 24px; padding-bottom: 18px; }
    .lg-brand img { height: clamp(48px, 3.8vw, 60px); }
    .lg-card-main { padding: 20px 0; }
    .lg-title { font-size: clamp(28px, 2.4vw, 34px); }
    .lg-sub { margin-top: 6px; font-size: 15px; }
    .lg-form { margin-top: 24px; gap: 14px; }
    .lg-field, .lg-submit { height: 46px; }
    .lg-art { padding: 24px 32px; gap: 14px; }
    .lg-eyebrow { padding-top: 4px; padding-bottom: 4px; }
    .lg-art-title { margin-top: 10px; font-size: clamp(26px, 2.3vw, 34px); }
    .lg-art-lead { margin-top: 8px; font-size: 14px; }
}
@media (min-width: 992px) and (max-height: 700px) { .lg-art-note { display: none; } }
/* compact (about 460-640px tall, e.g. a laptop at 150% display scaling): smaller type, the panel keeps only its headline */
@media (min-width: 992px) and (max-height: 640px) {
    .lg-page { padding: 8px; }
    .lg-grid { gap: 8px; }
    .lg-card { padding: 14px 28px 12px; }
    .lg-brand img { height: 40px; }
    .lg-brand span { font-size: 17px; }
    .lg-card-main { padding: 8px 0; }
    .lg-title { font-size: 26px; }
    .lg-sub { font-size: 14px; }
    .lg-form { margin-top: 16px; gap: 12px; }
    .lg-group { gap: 6px; }
    .lg-label, .lg-link { font-size: 13px; }
    .lg-field, .lg-submit { height: 42px; }
    .lg-submit { margin-top: 2px; font-size: 15px; }
    .lg-foot { font-size: 12px; }
    .lg-art { padding: 16px 24px; gap: 8px; }
    .lg-art-title { margin-top: 8px; font-size: 24px; }
    .lg-art-title br { display: none; }
    .lg-art-lead, .lg-art-note { display: none; }
}
/* very short screens (under 460px): let the page scroll instead of squeezing */
@media (min-width: 992px) and (max-height: 459px) {
    .lg-page { height: auto; min-height: 100vh; }
    .lg-grid { height: auto; min-height: calc(100vh - 24px); }
    .lg-card { overflow: visible; }
    .lg-stage-wrap { flex: none; height: 420px; }
}

/* ── Responsive: stacked below 992px, form first; agents as a simple 2-column grid (no wires / hub) ── */
@media (max-width: 991.98px) {
    .lg-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .lg-card { padding: 24px 24px 20px; }
    .lg-card-main { padding: 36px 0; }
    .lg-art { gap: 22px; }
    .lg-page { height: auto; min-height: 100vh; }
    .lg-grid { height: auto; }
    .lg-card { overflow: visible; }
    .lg-stage-wrap { display: block; container-type: normal; }
    .lg-stage { width: auto; aspect-ratio: auto; max-width: none; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .lg-wires, .lg-hub { display: none; }
    .lg-agent { position: static; width: auto; display: flex; align-items: flex-start; gap: 10px; }
    .lg-av, .lg-a2 .lg-av, .lg-a4 .lg-av { flex-shrink: 0; width: 44px; margin: 4px 0 0; }
    .lg-bubble { flex: 1; min-width: 0; margin-top: 0; }
}
@media (max-width: 575.98px) {
    .lg-page { padding: 8px; }
    .lg-grid { gap: 8px; }
    .lg-card { padding: 20px 18px 18px; border-radius: 14px; }
    .lg-art { border-radius: 14px; padding: 24px 18px; }
    .lg-stage { grid-template-columns: minmax(0, 1fr); }
}
