/* ============================================================================
   obase-login.css - the OBase sign-in scene ("neural constellation").
   Shared by every app that uses it (it started as a copy in each app).

   Host setup, once in the app's <head>, after obase-theme.css:
     <link rel="stylesheet" href="_content/OBaseThemes/obase-login.css" />
     <script src="_content/OBaseThemes/obase-login-fx.js"></script>
   The page markup (class ob-ai-login and its children) stays in the app's
   Login.razor. Fonts: the headings ask for "Space Grotesk" and Inter, which
   the app loads (for example from Google Fonts); without them the browser
   uses Segoe UI or sans-serif.

   Accent-aware: every glow reads --obase-primary-rgb and the dark surfaces
   read the accent's dark ramp (both from obase-theme.css), so the scene
   follows the picked theme. The mesh canvas is driven by obase-login-fx.js;
   everything else is pure CSS. Collapses to the card alone under 860px.
   ============================================================================ */
.ob-ai-login {
    /* Lightened accent for text/glyphs sitting on the dark scene. Solid accent
       fallback; the @supports block below upgrades it where color-mix exists. */
    --ob-ai-accent-light: var(--obase-primary);
    position: relative;
    min-height: 100vh;
    color: #e8eefc;
    /* Stops past 100% are deliberate: they pull the gradient toward the accent's
       deep stop without ever reaching its full saturation on screen. */
    background:
        radial-gradient(1100px 700px at 82% 18%, rgba(var(--obase-primary-rgb), 0.13), transparent 60%),
        radial-gradient(900px 650px at 12% 85%, rgba(var(--obase-primary-rgb), 0.18), transparent 62%),
        linear-gradient(160deg, #060b16 0%, var(--obase-body-dark) 55%, var(--obase-grad-c) 165%);
}
@supports (color: color-mix(in srgb, red, white)) {
    .ob-ai-login { --ob-ai-accent-light: color-mix(in srgb, rgb(var(--obase-primary-rgb)) 55%, #ffffff); }
}

/* Background layers (orbs, grid, mesh canvas, AI core). The wrapper clips the
   deliberately-offscreen decorations so the page itself never scrolls sideways. */
.ob-ai-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.ob-ai-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.5;
    animation: obAiOrb 22s ease-in-out infinite alternate;
}
.ob-ai-orb-1 { width: 480px; height: 480px; left: -140px; top: -160px;
               background: radial-gradient(circle, rgba(var(--obase-primary-rgb), 0.45), transparent 70%); }
.ob-ai-orb-2 { width: 560px; height: 560px; right: -180px; top: 30%;
               background: radial-gradient(circle, rgba(var(--obase-primary-rgb), 0.22), transparent 70%);
               animation-delay: -7s; }
.ob-ai-orb-3 { width: 420px; height: 420px; left: 34%; bottom: -200px;
               background: radial-gradient(circle, rgba(255, 255, 255, 0.10), transparent 70%);
               animation-delay: -13s; }
@keyframes obAiOrb {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -35px) scale(1.12); }
}

.ob-ai-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(var(--obase-primary-rgb), 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--obase-primary-rgb), 0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 25%, transparent 74%);
    mask-image: radial-gradient(ellipse at 50% 50%, #000 25%, transparent 74%);
}

.ob-ai-mesh { position: absolute; inset: 0; width: 100%; height: 100%; }

/* AI core - bottom left: rotating rings, orbiting dots, breathing center */
.ob-ai-core {
    position: absolute;
    left: -130px;
    bottom: -150px;
    width: 540px;
    height: 540px;
}
.ob-ai-core-rings { position: absolute; inset: 0; animation: obAiSpin 70s linear infinite; }
.ob-ai-core-rings circle { fill: none; stroke: rgba(var(--obase-primary-rgb), 0.20); stroke-width: 1; }
.ob-ai-core-rings circle.dashed { stroke-dasharray: 4 10; stroke: rgba(255, 255, 255, 0.14); }
@keyframes obAiSpin { to { transform: rotate(360deg); } }

.ob-ai-orbit {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(var(--obase-primary-rgb), 0.12);
    animation: obAiSpin linear infinite;
}
.ob-ai-orbit span {
    position: absolute;
    top: 50%; left: -4px;
    width: 8px; height: 8px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--ob-ai-accent-light);
    box-shadow: 0 0 12px 3px rgba(var(--obase-primary-rgb), 0.65);
}
.ob-ai-orbit-1 { inset: 70px;  animation-duration: 26s; }
.ob-ai-orbit-2 { inset: 130px; animation-duration: 17s; animation-direction: reverse; }
.ob-ai-orbit-3 { inset: 185px; animation-duration: 38s; }
.ob-ai-orbit-3 span { width: 6px; height: 6px; background: #e8eefc;
                      box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.45); }

.ob-ai-core-center {
    position: absolute;
    left: 50%; top: 50%;
    width: 150px; height: 150px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%,
        rgba(var(--obase-primary-rgb), 0.85),
        rgba(var(--obase-primary-rgb), 0.50) 45%,
        rgba(var(--obase-primary-rgb), 0.18) 75%);
    box-shadow:
        0 0 60px 12px rgba(var(--obase-primary-rgb), 0.35),
        inset 0 0 34px rgba(255, 255, 255, 0.30);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: obAiBreath 4.5s ease-in-out infinite;
}
.ob-ai-core-center svg {
    width: 54px; height: 54px;
    fill: none;
    stroke: #eaf2ff;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7));
}
@keyframes obAiBreath {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.05); }
}

.ob-ai-ring-pulse {
    position: absolute;
    left: 50%; top: 50%;
    width: 540px; height: 540px;
    margin: -270px 0 0 -270px;
    border-radius: 50%;
    border: 1px solid rgba(var(--obase-primary-rgb), 0.35);
    opacity: 0;
    animation: obAiRingOut 7s linear infinite;
}
.ob-ai-ring-pulse.rp-2 { animation-delay: 2.3s; }
.ob-ai-ring-pulse.rp-3 { animation-delay: 4.6s; }
@keyframes obAiRingOut {
    0%   { transform: scale(0.28); opacity: 0.55; }
    100% { transform: scale(1.55); opacity: 0; }
}

/* Layout: left brand panel + sign-in card. Capped width + auto margins keep
   the two columns companionable on ultra-wide screens instead of letting
   space-between stretch a void between them (the backdrop stays full-bleed). */
.ob-ai-layout {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    max-width: 2000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 48px 5vw;
}

.ob-ai-left { max-width: 540px; }

/* The logo asset carries the wordmark itself; a divided role label beside it
   names which portal of the suite this is (for example "Admin Portal"). */
.ob-ai-brand-row {
    display: flex;
    align-items: center;
    gap: 16px;
    animation: obAiFadeUp 0.7s ease both;
}
.ob-ai-brand-row img { height: 68px; width: auto; max-width: 260px; object-fit: contain; border-radius: 10px; }
.ob-ai-brand-role {
    padding-left: 16px;
    border-left: 1px solid rgba(226, 236, 254, 0.28);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(226, 236, 254, 0.78);
    white-space: nowrap;
}

.ob-ai-headline {
    font-family: "Space Grotesk", Inter, "Segoe UI", sans-serif;
    font-size: clamp(30px, 3.4vw, 44px);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: -0.8px;
    margin: 36px 0 16px;
    animation: obAiFadeUp 0.7s 0.12s ease both;
    /* Routes.razor's FocusOnNavigate targets the page's first h1 - this one -
       so suppress the browser focus ring on the non-interactive heading. */
    outline: none;
}
.ob-ai-headline:focus, .ob-ai-headline:focus-visible,
.ob-ai-card h1:focus, .ob-ai-card h1:focus-visible { outline: none; box-shadow: none; }
.ob-ai-headline span {
    background: linear-gradient(100deg, rgb(var(--obase-primary-rgb)) 5%, #dbeafe 95%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.ob-ai-subline {
    font-size: 16px;
    line-height: 1.65;
    color: rgba(226, 236, 254, 0.68);
    max-width: 46ch;
    animation: obAiFadeUp 0.7s 0.22s ease both;
}

.ob-ai-stats {
    display: flex;
    gap: 44px;
    margin-top: 46px;
    animation: obAiFadeUp 0.7s 0.34s ease both;
}
.ob-ai-stat-num {
    font-family: "Space Grotesk", Inter, "Segoe UI", sans-serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.ob-ai-stat-num span { color: var(--ob-ai-accent-light); }
.ob-ai-stat-lbl {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(226, 236, 254, 0.45);
}

@keyframes obAiFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Sign-in card */
.ob-ai-right { width: 440px; flex-shrink: 0; }

.ob-ai-card {
    position: relative;
    background: rgba(13, 21, 38, 0.74);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(var(--obase-primary-rgb), 0.18);
    border-radius: 20px;
    padding: 34px 32px 26px;
    box-shadow:
        0 30px 80px rgba(3, 8, 20, 0.55),
        inset 0 0 0 1px rgba(var(--obase-primary-rgb), 0.05);
    animation: obAiCardIn 0.8s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.05) both;
}
@supports (color: color-mix(in srgb, red, white)) {
    .ob-ai-card { background: color-mix(in srgb, var(--obase-surface-dark) 74%, transparent); }
}
/* Light seam along the card's top edge */
.ob-ai-card::before {
    content: "";
    position: absolute;
    top: 0; left: 26px; right: 26px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--obase-primary-rgb), 0.75), transparent);
}
@keyframes obAiCardIn {
    from { opacity: 0; transform: translateY(26px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ob-ai-card-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.ob-ai-card-brand img { height: 46px; width: auto; max-width: 190px; object-fit: contain; border-radius: 8px; }
.ob-ai-card-role {
    padding-left: 12px;
    border-left: 1px solid rgba(226, 236, 254, 0.24);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(226, 236, 254, 0.65);
    white-space: nowrap;
}

.ob-ai-card h1 {
    font-family: "Space Grotesk", Inter, "Segoe UI", sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin: 0 0 5px;
    color: #e8eefc;
    text-align: left;
    outline: none;
}
.ob-ai-hint { font-size: 14px; color: rgba(226, 236, 254, 0.68); }

/* "Assistant online" strip - dots + flowing line. :focus-within makes the
   assistant "think" faster while any field has focus (no JS involved). */
.ob-ai-think {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 22px;
}
.ob-ai-think-dots { display: flex; gap: 5px; }
.ob-ai-think-dots span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ob-ai-accent-light), #dbeafe);
    animation: obAiDot 1.6s ease-in-out infinite;
}
.ob-ai-think-dots span:nth-child(2) { animation-delay: 0.18s; }
.ob-ai-think-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes obAiDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
    30%           { transform: translateY(-4px); opacity: 1; }
}
.ob-ai-think-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg,
        rgba(var(--obase-primary-rgb), 0),
        rgba(var(--obase-primary-rgb), 0.55),
        rgba(255, 255, 255, 0.45),
        rgba(var(--obase-primary-rgb), 0));
    background-size: 200% 100%;
    animation: obAiLineFlow 3.2s linear infinite;
    transition: filter 0.3s ease;
}
@keyframes obAiLineFlow {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
.ob-ai-think-lbl {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(226, 236, 254, 0.50);
    white-space: nowrap;
}
.ob-ai-card:focus-within .ob-ai-think-dots span { animation-duration: 0.55s; }
.ob-ai-card:focus-within .ob-ai-think-line { filter: brightness(1.8); }

/* Fields */
.ob-ai-group { margin-bottom: 16px; }
.ob-ai-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(226, 236, 254, 0.68);
    margin-bottom: 7px;
}
.ob-ai-field { position: relative; }
.ob-ai-input {
    width: 100%;
    background: rgba(8, 14, 27, 0.65);
    border: 1px solid rgba(var(--obase-primary-rgb), 0.22);
    border-radius: 12px;
    padding: 12px 14px 12px 44px;
    font: inherit;
    font-size: 15px;
    color: #e8eefc;
    outline: none;
    caret-color: var(--ob-ai-accent-light);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.ob-ai-input::placeholder { color: rgba(200, 216, 245, 0.35); }
.ob-ai-input:disabled { opacity: 0.6; }
/* Chrome autofill paints a white field on dark cards - repaint it dark */
.ob-ai-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #0a1121 inset;
    -webkit-text-fill-color: #e8eefc;
    caret-color: #e8eefc;
    transition: background-color 9999s;
}
.ob-ai-field svg {
    position: absolute;
    left: 15px; top: 50%;
    width: 18px; height: 18px;
    transform: translateY(-50%);
    stroke: rgba(148, 180, 255, 0.55);
    transition: stroke 0.2s ease, filter 0.2s ease;
    pointer-events: none;
}
.ob-ai-input:focus {
    border-color: var(--obase-primary);
    background: rgba(10, 17, 33, 0.85);
    box-shadow:
        0 0 0 3px rgba(var(--obase-primary-rgb), 0.18),
        0 0 26px rgba(var(--obase-primary-rgb), 0.16);
}
.ob-ai-input:focus + svg {
    stroke: var(--ob-ai-accent-light);
    filter: drop-shadow(0 0 5px rgba(var(--obase-primary-rgb), 0.6));
}

.ob-ai-forgot {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 18px;
}
.ob-ai-forgot a, .ob-ai-foot a {
    color: var(--ob-ai-accent-light);
    font-size: 13px;
    text-decoration: none;
}
.ob-ai-forgot a:hover, .ob-ai-foot a:hover { text-decoration: underline; }

/* Submit button - accent gradient, sheen sweep on hover, send pulse on click */
.ob-ai-btn {
    position: relative;
    width: 100%;
    padding: 13px 16px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--obase-primary), var(--obase-primary-hover));
    color: var(--obase-primary-contrast);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(var(--obase-primary-rgb), 0.35);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.ob-ai-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(var(--obase-primary-rgb), 0.50);
}
.ob-ai-btn:disabled { opacity: 0.6; cursor: default; }
.ob-ai-btn-arrow {
    display: inline-block;
    margin-left: 6px;
    transition: transform 0.2s ease;
}
.ob-ai-btn:hover:not(:disabled) .ob-ai-btn-arrow { transform: translateX(4px); }
.ob-ai-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.22) 50%, transparent 68%);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
}
.ob-ai-btn:hover:not(:disabled)::before { transform: translateX(120%); }
.ob-ai-btn.ob-ai-sending { animation: obAiBtnPulse 0.6s ease-out; }
@keyframes obAiBtnPulse {
    0%   { box-shadow: 0 0 0 0 rgba(var(--obase-primary-rgb), 0.6), 0 10px 30px rgba(var(--obase-primary-rgb), 0.35); }
    100% { box-shadow: 0 0 0 26px rgba(var(--obase-primary-rgb), 0), 0 10px 30px rgba(var(--obase-primary-rgb), 0.35); }
}

.ob-ai-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(226, 236, 254, 0.35);
}
.ob-ai-divider::before, .ob-ai-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(var(--obase-primary-rgb), 0.16);
}

.ob-ai-foot {
    text-align: center;
    font-size: 13px;
    color: rgba(226, 236, 254, 0.68);
}
.ob-ai-foot a { font-weight: 600; font-size: 13px; }
.ob-ai-copy {
    margin-top: 14px;
    text-align: center;
    font-size: 11px;
    color: rgba(226, 236, 254, 0.30);
}

/* Alerts sit on the dark glass card - keep Bootstrap's semantics, trim margins */
.ob-ai-card .alert { padding: 10px 12px; font-size: 13.5px; margin-bottom: 16px; }

@media (max-width: 1250px) {
    .ob-ai-core { transform: scale(0.75); opacity: 0.8; }
}
@media (max-width: 980px) {
    .ob-ai-stats { gap: 28px; }
}
@media (max-width: 860px) {
    .ob-ai-left, .ob-ai-core { display: none; }
    .ob-ai-layout { justify-content: center; padding: 32px 16px; }
    .ob-ai-right { width: min(440px, 100%); }
}

/* Accessibility: no motion for users who ask for it */
@media (prefers-reduced-motion: reduce) {
    .ob-ai-login *,
    .ob-ai-login *::before,
    .ob-ai-login *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}
