/* =========================================================================
   ORBUS EAM — sign-in pages follow the selected application theme
   Loaded after master.css and theme-default.css on Login, EmailVerification,
   ForgotEmailVerification, NewPassword, EmailOTP and ForgotPasswordOtp.
   An inline script in each page's <head> reads the theme the user last picked
   (localStorage "orbus.theme", set by the Themes panel) and puts it on <html>
   as data-ods-theme, together with the class "ods-auth".
   Colours only: no markup, form, field or script behaviour is changed.
   ========================================================================= */

/* theme palettes — same values as orbus-ds.css */
html.ods-auth {
    --th-bg: #000000;
    --th-g1: 70, 70, 82;
    --th-g2: 48, 48, 58;
    --th-g3: 60, 60, 70;
    --th-line: 150, 150, 165;
}
html.ods-auth[data-ods-theme="midnight"] { --th-bg: #050507; --th-g1: 99, 102, 241; --th-g2: 139, 92, 246; --th-g3: 20, 184, 166; --th-line: 96, 165, 250; }
html.ods-auth[data-ods-theme="ocean"]    { --th-bg: #03111c; --th-g1: 14, 165, 233;  --th-g2: 37, 99, 235;   --th-g3: 6, 182, 212;   --th-line: 56, 189, 248; }
html.ods-auth[data-ods-theme="aurora"]   { --th-bg: #03130e; --th-g1: 16, 185, 129;  --th-g2: 20, 184, 166;  --th-g3: 132, 204, 22;  --th-line: 52, 211, 153; }
html.ods-auth[data-ods-theme="nebula"]   { --th-bg: #0c0616; --th-g1: 168, 85, 247;  --th-g2: 236, 72, 153;  --th-g3: 99, 102, 241;  --th-line: 192, 132, 252; }
html.ods-auth[data-ods-theme="sunset"]   { --th-bg: #150906; --th-g1: 249, 115, 22;  --th-g2: 239, 68, 68;   --th-g3: 245, 158, 11;  --th-line: 251, 146, 60; }
html.ods-auth[data-ods-theme="graphite"] { --th-bg: #0b0b0c; --th-g1: 113, 113, 122; --th-g2: 82, 82, 91;    --th-g3: 161, 161, 170; --th-line: 161, 161, 170; }
html.ods-auth[data-ods-theme="navy"]     { --th-bg: #06101e; --th-g1: 30, 64, 175;  --th-g2: 14, 116, 144;  --th-g3: 71, 85, 105;   --th-line: 96, 140, 200; }
html.ods-auth[data-ods-theme="slate"]    { --th-bg: #0c1117; --th-g1: 71, 85, 105;  --th-g2: 51, 65, 85;    --th-g3: 100, 116, 139; --th-line: 148, 163, 184; }
html.ods-auth[data-ods-theme="forest"]   { --th-bg: #07110c; --th-g1: 21, 128, 61;  --th-g2: 22, 101, 52;   --th-g3: 101, 163, 13;  --th-line: 74, 222, 128; }
/* light themes: the photo keeps its depth, washed in the theme's light colour */
html.ods-auth[data-ods-theme="light"]     { --th-bg: #f4f5f7; --th-g1: 148, 163, 184; --th-g2: 203, 213, 225; --th-g3: 186, 196, 210; --th-line: 148, 163, 184; }
html.ods-auth[data-ods-theme="glacier"]   { --th-bg: #eaf1f8; --th-g1: 96, 165, 250;  --th-g2: 125, 211, 252; --th-g3: 165, 180, 252; --th-line: 96, 165, 250; }
html.ods-auth[data-ods-theme="sandstone"] { --th-bg: #f4eee4; --th-g1: 217, 164, 103; --th-g2: 234, 196, 140; --th-g3: 200, 150, 110; --th-line: 217, 164, 103; }

/* backdrop: the original sign-in photo, recoloured to the selected theme */
html.ods-auth {
    background: var(--th-bg) url('images/background.png') no-repeat center center fixed !important;
    background-size: cover !important;
}
html.ods-auth body {
    background: transparent !important;
    background-image: none !important;
}
/* 1) colour layer: keeps the photo's light and shade, swaps its hue for the theme's */
html.ods-auth body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background: rgb(var(--th-g1));
    mix-blend-mode: color;
}
/* 2) light layer: dims the photo a little and adds the theme's soft moving glow */
html.ods-auth body::after {
    content: "";
    position: fixed;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(40% 45% at 18% 22%, rgba(var(--th-g1), .22), transparent 70%),
        radial-gradient(38% 42% at 85% 18%, rgba(var(--th-g2), .18), transparent 70%),
        radial-gradient(45% 50% at 60% 92%, rgba(var(--th-g3), .16), transparent 70%),
        rgba(0, 0, 0, .28);
    animation: ods-auth-drift 40s ease-in-out infinite alternate;
}
@keyframes ods-auth-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(4%, 3%) scale(1.06); }
    100% { transform: translate(-3%, 5%) scale(.97); }
}
/* floating particles and status lights in the theme colour */
html.ods-auth body .orb { background: rgb(var(--th-line)) !important; box-shadow: 0 0 10px rgba(var(--th-line), .8) !important; }
html.ods-auth body .bb-dot,
html.ods-auth body .kb-dot,
html.ods-auth body .live-dot { background: rgb(var(--th-line)) !important; box-shadow: 0 0 6px rgba(var(--th-line), .8) !important; }
html.ods-auth body .ticker-bar { background: rgba(var(--th-line), .04) !important; border-bottom-color: rgba(var(--th-line), .12) !important; }
html.ods-auth body .tsep { color: rgba(var(--th-line), .35) !important; }
html.ods-auth body .bottom-bar { background: rgba(0, 0, 0, .55) !important; border-top-color: rgba(var(--th-line), .1) !important; }

/* sign-in card: the same clear glass as the Work Order submenu cards */
html.ods-auth body .card {
    background: linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015) 60%), rgba(0, 0, 0, .12) !important;
    border-color: rgba(255, 255, 255, .08) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 6px 22px rgba(0, 0, 0, .38) !important;
}
html.ods-auth body .card::before { border-top-color: rgb(var(--th-line)) !important; border-left-color: rgb(var(--th-line)) !important; }
html.ods-auth body .card::after { border-bottom-color: rgba(var(--th-g1), 1) !important; border-right-color: rgba(var(--th-g1), 1) !important; }
html.ods-auth body .corner-tr { border-top-color: rgb(var(--th-line)) !important; border-right-color: rgb(var(--th-line)) !important; }
html.ods-auth body .corner-bl { border-bottom-color: rgba(var(--th-g1), 1) !important; border-left-color: rgba(var(--th-g1), 1) !important; }
html.ods-auth body .shimmer-bar { background: linear-gradient(90deg, transparent, rgba(var(--th-line), .65), rgba(var(--th-g1), .55), transparent) !important; }
html.ods-auth body .status-bar { background: linear-gradient(90deg, rgb(var(--th-line)), rgb(var(--th-g1)), rgb(var(--th-line))) !important; background-size: 200% 100% !important; }

/* fields and the main button pick up the theme colour on focus */
html.ods-auth body :is(.inp, input[type="text"], input[type="email"], input[type="password"], input[type="tel"]):focus {
    border-color: rgba(var(--th-line), .6) !important;
    box-shadow: 0 0 0 3px rgba(var(--th-line), .15) !important;
}

@media (prefers-reduced-motion: reduce) {
    html.ods-auth body::after { animation: none; }
}
