/* ==========================================================================
   Cybroxa — authentication design layer
   Premium white monochrome, single violet accent.
   Loaded last; presentation only. Angular hooks, ids, names and scripts
   remain untouched (<baseTemplate/brand/> scope).
   ========================================================================== */

/* Fonts (variable, latin, swap) */
@font-face {
    font-family: "Inter";
    src: url("Inter-var-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("jetbrains-mono-latin.woff2") format("woff2");
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --cyx-bg: #F6F7F9;
    --cyx-card: #FFFFFF;
    --cyx-line: #E5E7EB;
    --cyx-line-strong: #D1D5DB;
    --cyx-ink: #0B0F17;
    --cyx-body: #24292F;
    --cyx-muted: #6B7280;
    --cyx-faint: #9CA3AF;
    --cyx-secondary: #4B5563;
    --cyx-violet: #7C3AED;
    --cyx-violet-700: #6D28D9;
    --cyx-violet-800: #5B21B6;
    --cyx-ring: rgba(124, 58, 237, 0.28);
    --cyx-danger: #DC2626;
    --cyx-danger-bg: #FEF2F2;
    --cyx-danger-line: #FEE2E2;
    --cyx-radius: 10px;
    --cyx-font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --cyx-font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* --- Canvas -------------------------------------------------------------- */

/* Neutralize the previous per-scheme auth palettes: this page is always
   the light, monochrome design. */
html.cp-evergreen.cp-auth {
    color-scheme: light;
}

html.cp-evergreen.cp-auth[data-theme="dark"] {
    color-scheme: light;
}

html.cp-evergreen.cp-auth body.cyx-page,
body.cyx-page {
    background: var(--cyx-bg) !important;
    color: var(--cyx-ink);
    font-family: var(--cyx-font-body);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.cyx-page ::selection {
    background: rgba(124, 58, 237, 0.16);
}

/* Focus visibility (keyboard users) */
html.cp-evergreen:is(.cp-auth, .cp-filemanager, .cp-fileeditor) :is(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--cyx-violet);
    outline-offset: 2px;
}

/* --- Layout: optional quiet left rail + centered card -------------------- */

.cyx-stage {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--cyx-bg);
}

.cyx-pane {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.cyx-rail {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(32px, 6vw, 96px);
    background: #FFFFFF;
}

@media (min-width: 992px) {
    .cyx-stage {
        grid-template-columns: 1fr 1fr;
    }

    .cyx-rail {
        display: flex;
        border-right: 1px solid var(--cyx-line);
    }
}

.cyx-rail-inner {
    max-width: 520px;
}

.cyx-eyebrow {
    margin: 0 0 18px;
    font-family: var(--cyx-font-mono);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cyx-faint);
}

/* The single gradient on this page. */
.cyx-accent-bar {
    width: 32px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(135deg, #7C3AED, #22D3EE);
    margin-bottom: 22px;
}

.cyx-rail-copy {
    margin: 0;
    max-width: 480px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.22;
    color: var(--cyx-ink);
}

/* --- Card ---------------------------------------------------------------- */

.cyx-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    background: var(--cyx-card);
    border: 1px solid var(--cyx-line);
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(11, 15, 23, 0.05),
        0 10px 24px rgba(11, 15, 23, 0.06);
}

.cyx-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.cyx-mark {
    display: block;
    width: 44px;
    height: 44px;
}

.cyx-wordmark {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--cyx-ink);
}

.cyx-headline {
    margin: 20px 0 4px;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--cyx-ink);
}

.cyx-sub {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cyx-muted);
}

/* --- Fields -------------------------------------------------------------- */

.cyx-field {
    margin-bottom: 14px;
}

.cyx-field:last-of-type {
    margin-bottom: 0;
}

.cyx-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cyx-body);
}

.cyx-input,
.cyx-select {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 12px;
    background: #FFFFFF;
    color: var(--cyx-ink);
    border: 1px solid var(--cyx-line);
    border-radius: var(--cyx-radius);
    font-family: var(--cyx-font-body);
    font-size: 14px;
    line-height: 1.4;
    box-shadow: none;
    outline: 0;
    caret-color: var(--cyx-violet-700);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cyx-input::placeholder {
    color: var(--cyx-faint);
    opacity: 1;
}

.cyx-input:hover,
.cyx-select:hover {
    border-color: var(--cyx-line-strong);
}

.cyx-input:focus,
.cyx-select:focus {
    border-color: var(--cyx-violet);
    box-shadow: 0 0 0 3px var(--cyx-ring);
}

.cyx-input:focus-visible,
.cyx-select:focus-visible {
    outline: none;
}

/* System-token field (2FA code) is the only mono input. */
.cyx-token {
    font-family: var(--cyx-font-mono);
    font-size: 13px;
    letter-spacing: 0.02em;
}

/* Language select: quiet custom chevron. */
.cyx-select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236B7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.cyx-select option {
    color: var(--cyx-ink);
    background: #FFFFFF;
}

/* Keep password manager autofill on-brand. */
.cyx-card input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 44px #FFFFFF inset;
    -webkit-text-fill-color: var(--cyx-ink);
    transition: background-color 9999s ease-in-out 0s;
}

/* In-flight indicator (id is used by login-system.js; shown via jQuery). */
#verifyingLogin {
    display: none;
    width: 18px;
    height: auto;
    margin: 8px auto 0;
}

/* --- Primary action ------------------------------------------------------ */

.cyx-submit {
    display: block;
    width: 100%;
    height: 44px;
    margin-top: 18px;
    padding: 0 16px;
    background: var(--cyx-violet-700);
    color: #FFFFFF;
    border: 0;
    border-radius: var(--cyx-radius);
    font-family: var(--cyx-font-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(109, 40, 217, 0.35);
    transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.cyx-submit:hover {
    background: var(--cyx-violet-800);
}

.cyx-submit:active {
    background: var(--cyx-violet-800);
    transform: translateY(1px);
    box-shadow: 0 1px 1px rgba(109, 40, 217, 0.25);
}

.cyx-submit:focus-visible {
    outline: none;
    box-shadow: 0 1px 2px rgba(109, 40, 217, 0.35), 0 0 0 3px var(--cyx-ring);
}

/* --- Error state ---------------------------------------------------------- */

#loginFailed {
    display: none;
    margin: 14px 0 0;
    padding: 10px 12px;
    background: var(--cyx-danger-bg);
    border: 1px solid var(--cyx-danger-line);
    border-radius: var(--cyx-radius);
    font-size: 13px;
    line-height: 1.55;
    color: var(--cyx-danger);
    word-break: break-word;
}

#loginFailed p {
    margin: 0;
}

/* --- Card footer ---------------------------------------------------------- */

.cyx-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #F3F4F6;
}

.cyx-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--cyx-secondary);
    text-decoration: none;
}

.cyx-link:hover {
    text-decoration: underline;
    color: var(--cyx-secondary);
}

.cyx-version {
    font-family: var(--cyx-font-mono);
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--cyx-faint);
    white-space: nowrap;
}

/* --- Boot overlay (id + .spinner used by the legacy loader script) -------- */

html.cp-evergreen.cp-auth #loading {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5555;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cyx-bg);
}

html.cp-evergreen.cp-auth #loading .spinner {
    position: static;
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    height: auto;
    margin: 0;
    text-align: left;
}

html.cp-evergreen.cp-auth #loading .spinner > div {
    width: 8px;
    height: 8px;
    margin: 0;
    display: block;
    background: var(--cyx-violet-700) !important;
    border-radius: 999px;
    opacity: 0.35;
    -webkit-animation: cyx-pulse 1s infinite ease-in-out;
    animation: cyx-pulse 1s infinite ease-in-out;
}

html.cp-evergreen.cp-auth #loading .spinner .bounce2 {
    -webkit-animation-delay: 0.15s;
    animation-delay: 0.15s;
}

html.cp-evergreen.cp-auth #loading .spinner .bounce3 {
    -webkit-animation-delay: 0.3s;
    animation-delay: 0.3s;
}

@-webkit-keyframes cyx-pulse {

    0%,
    100% {
        opacity: 0.35;
        -webkit-transform: scale(0.85);
        transform: scale(0.85);
    }

    45% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

@keyframes cyx-pulse {

    0%,
    100% {
        opacity: 0.35;
        -webkit-transform: scale(0.85);
        transform: scale(0.85);
    }

    45% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

/* --- Motion & small screens ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .cyx-input,
    .cyx-select,
    .cyx-submit,
    .cyx-link {
        transition: none;
    }

    html.cp-evergreen.cp-auth #loading .spinner > div {
        -webkit-animation: none;
        animation: none;
        opacity: 0.9;
        -webkit-transform: none;
        transform: none;
    }

    .cyx-submit:active {
        transform: none;
    }
}

@media (max-width: 480px) {

    .cyx-pane {
        padding: 16px;
    }

    .cyx-card {
        padding: 24px;
        border-radius: 14px;
    }
}
