/* Sign-in, password reset and first-login pages (_AuthLayout.cshtml, prefix auth). Standalone: no Metronic bundle. */

:root {
    --auth-navy: #0c2341;
    --auth-navy-2: #0a1c36;
    --auth-blue: #2f6fed;
    --auth-blue-strong: #1d4ed8;
    --auth-ink: #12233b;
    --auth-muted: #6d7d93;
    --auth-line: #d6e0ec;
    --auth-field: #f6f9fc;
    --auth-red: #e11d48;
    --auth-green: #0f9f6e;
    --auth-yellow: #f5b301;
    --auth-line-art: #8fb3e8;
    --auth-radius: 12px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body { height: 100%; }

body.auth {
    margin: 0;
    background: var(--auth-navy);
    color: var(--auth-ink);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

:where(.auth) :where(button, input) { font: inherit; color: inherit; }

.auth [hidden] { display: none !important; }

.auth-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- Hero (left) ---------- */

.auth-hero {
    position: relative;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
    padding: clamp(24px, 3.2vw, 48px) clamp(24px, 4vw, 64px) 0;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(60% 50% at 50% 78%, rgba(47, 111, 237, 0.28) 0%, rgba(47, 111, 237, 0) 70%),
        linear-gradient(180deg, var(--auth-navy) 0%, var(--auth-navy-2) 100%);
}

/* Blueprint grid */
.auth-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(143, 179, 232, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(143, 179, 232, 0.07) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, #000 55%, rgba(0, 0, 0, 0.5) 100%);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, #000 55%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
}

.auth-hero > * { position: relative; }

/* Logo and slogan sit centred over the scene on desktop; left-aligned on the compact mobile header. */
.auth-hero__logo {
    display: inline-block;
    align-self: center;
    line-height: 0;
}

.auth-hero__logo img {
    width: auto;
    height: clamp(40px, 4.4vw, 60px);
}

.auth-hero__copy {
    margin-top: clamp(16px, 3vh, 32px);
    text-align: center;
    animation: auth-rise 0.6s 0.05s ease-out both;
}

/* Montserrat echoes the geometric capitals of the logo; the form stays on Inter like the app. */
.auth-hero__title {
    margin: 0;
    font-family: Montserrat, Inter, "Segoe UI", sans-serif;
    font-size: clamp(19px, 1.6vw, 24px);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    text-wrap: balance;
}

.auth-hero__title span {
    display: block;
    color: #a9c6f5;
    font-weight: 400;
}

/* ---------- Scene ---------- */

/* Centred in the space left under the copy, capped in width so it doesn't dominate the panel. */
.auth-scene {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    align-self: center;
    width: min(100%, 600px);
    min-height: 0;
    padding: clamp(16px, 3vh, 32px) 0 clamp(28px, 7vh, 72px);
    animation: auth-rise 0.7s 0.15s ease-out both;
}

/* Status sign: a plate in the ISO 3864 / ISO 7010 language - green square = safe condition, yellow triangle =
   warning, red circle = stop, blue circle = mandatory action (lockout complete). */
.auth-scene__hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 8px;
}

.auth-sign {
    display: flex;
    align-items: stretch;
    min-width: 200px;
    max-width: 100%;
    height: 36px;
    border: 1px solid #0a1c36;
    border-radius: 2px;
    outline: 1px solid rgba(255, 255, 255, 0.32);
    outline-offset: 1.5px;
    background: #f4f7fb;
    color: #0a1c36;
}

.auth-sign__sym {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    place-items: center;
    border-right: 1px solid #0a1c36;
    background: #f4f7fb;
    transition: background-color 0.15s;
}

.auth-sign__sym svg { display: none; width: 22px; height: 22px; }
.auth-scene[data-state="run"] .auth-sign__sym { background: #0f9f6e; }
.auth-scene[data-state="run"] [data-sign="run"],
.auth-scene[data-state="warn"] [data-sign="warn"],
.auth-scene[data-state="stop"] [data-sign="stop"],
.auth-scene[data-state="safe"] [data-sign="safe"] { display: block; }

.auth-sign.is-changed .auth-sign__sym svg { animation: auth-sign-in 0.28s cubic-bezier(0.3, 1.5, 0.5, 1); }

.auth-sign__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 0 12px 0 10px;
    line-height: 1.15;
}

.auth-sign__text b {
    overflow: hidden;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.auth-sign__text span {
    overflow: hidden;
    margin-top: 1px;
    color: #45566f;
    font-size: 10.5px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-sign__text span:empty { display: none; }

@keyframes auth-sign-in {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: none; }
}

.auth-scene__svg {
    display: block;
    flex: 0 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: 100%;
    touch-action: pan-y;
    user-select: none;
}

.auth-scene__zone { fill: transparent; cursor: crosshair; }

.auth-scene .beam {
    stroke: #3ee0a1;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 3 9;
    opacity: 0.6;
    animation: auth-beam 1.1s linear infinite;
}

.auth-scene__svg.is-tripped .beam {
    stroke: #ff4d6a;
    stroke-dasharray: none;
    opacity: 0.95;
    animation: none;
}

.auth-scene .lamp { fill: #1a3157; transition: fill 0.15s; }
.auth-scene[data-state="run"] .lamp--green { fill: #3ee0a1; filter: drop-shadow(0 0 6px rgba(62, 224, 161, 0.9)); }
.auth-scene[data-state="warn"] .lamp--amber { fill: #ffc531; filter: drop-shadow(0 0 6px rgba(255, 197, 49, 0.9)); }
.auth-scene[data-state="stop"] .lamp--red { fill: #ff4d6a; filter: drop-shadow(0 0 7px rgba(255, 77, 106, 0.95)); }

.auth-scene .break__ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: auth-ping 1s ease-out infinite;
}

/* Emergency stop: present in every scene, latches until clicked again. */
.auth-scene .estop { cursor: pointer; }
.auth-scene .estop__btn {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.08s, fill 0.08s;
}
.auth-scene .estop:hover .estop__btn { fill: #f43f5e; }
.auth-scene .estop.is-pressed .estop__btn { transform: scale(0.78); fill: #a80f33; }

/* Scene 2 - laser scanner fields */
/* Yellow over navy greys out at low opacity, so the outline carries the colour and the fill only lights up when occupied. */
.auth-scene .sc-field { stroke-width: 2; stroke-dasharray: 7 4; stroke-linejoin: round; transition: fill-opacity 0.2s; }
.auth-scene .sc-field--warn { fill: #ffc531; stroke: #ffc531; fill-opacity: 0.12; }
.auth-scene .sc-field--prot { fill: #ff4d6a; stroke: #ff5f7a; fill-opacity: 0.28; }
.auth-scene[data-state="warn"] .sc-field--warn { fill-opacity: 0.55; }
.auth-scene[data-state="stop"] .sc-field--prot { fill-opacity: 0.75; }
.auth-scene .sc-beacon { fill: #3ee0a1; stroke: #0a1c36; stroke-width: 1.5; transition: fill 0.15s; }
.auth-scene[data-state="warn"] .sc-beacon { fill: #ffc531; }
.auth-scene[data-state="stop"] .sc-beacon { fill: #ff4d6a; }

/* Scene 3 - lockout / tagout */
.auth-scene .lt-flow {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 5 11;
    animation: auth-flow 0.8s linear infinite;
    transition: opacity 0.25s;
}
.auth-scene .lt-flow--e { stroke: #ffd24a; }
.auth-scene .lt-flow--p { stroke: #5ad1ff; }
.auth-scene .lt-flow.is-off { opacity: 0; }
.auth-scene .lt-handle { transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1); }
.auth-scene .lt-lock { opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.25s ease-out; }
.auth-scene .lt-lock.is-on { opacity: 1; transform: none; }
.auth-scene .lt-tagname rect { fill: #0a1c36; stroke: #ffd24a; stroke-width: 1.5; }
.auth-scene .lt-tagname text {
    fill: #ffd24a;
    font: 700 12px Inter, "Segoe UI", sans-serif;
    text-anchor: middle;
}
.auth-scene .lt-start { fill: #1f7a5c; stroke: #0a1c36; stroke-width: 1.5; transition: fill 0.08s; }
.auth-scene[data-state="run"] .lt-start,
.auth-scene .lt-start.is-trying { fill: #3ee0a1; }
.auth-scene .lt-hit { cursor: pointer; }
.auth-scene .lt-ring {
    fill: none;
    stroke: #ffd24a;
    stroke-width: 2;
    transform-box: fill-box;
    transform-origin: center;
    animation: auth-ring 1.6s ease-out infinite;
}
.auth-scene .lt-hit.is-off .lt-ring { display: none; }

/* Scene switcher under the scene */
.auth-scene__foot {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.auth-scene__hint {
    color: rgba(215, 226, 240, 0.6);
    font-size: 12.5px;
}

.auth-scene__dots {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.auth-scene__dots button {
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.auth-scene__dots button::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(207, 224, 255, 0.3);
    transition: background-color 0.15s, transform 0.15s;
}

.auth-scene__dots button:hover::before { background: rgba(207, 224, 255, 0.65); }
.auth-scene__dots button[aria-pressed="true"]::before { background: #fff; transform: scale(1.25); }
.auth .auth-scene__dots button:focus-visible { outline-color: #fff; }

@keyframes auth-flow { to { stroke-dashoffset: -16; } }
@keyframes auth-ring {
    from { transform: scale(0.75); opacity: 0.9; }
    to { transform: scale(1.25); opacity: 0; }
}
@keyframes auth-beam { to { stroke-dashoffset: -24; } }
@keyframes auth-ping {
    from { transform: scale(0.6); opacity: 0.9; }
    to { transform: scale(2.4); opacity: 0; }
}
@keyframes auth-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Main (right) ---------- */

.auth-main {
    display: flex;
    flex: 0 0 clamp(440px, 40vw, 580px);
    flex-direction: column;
    min-width: 0;
    padding: 20px clamp(24px, 3.5vw, 56px) 28px;
    background: #fff;
}

.auth-main__top {
    display: flex;
    justify-content: flex-end;
    min-height: 40px;
}

.auth-main__body {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    padding: 28px 0;
}

.auth-card {
    width: 100%;
    max-width: 392px;
}

.auth-view { animation: auth-rise 0.35s ease-out both; }

.auth-title {
    margin: 0 0 6px;
    font-size: clamp(24px, 2vw, 28px);
    font-weight: 750;
    letter-spacing: -0.03em;
    line-height: 1.15;
    text-wrap: balance;
}

.auth-lead {
    margin: 0 0 28px;
    color: var(--auth-muted);
}

.auth-badge {
    display: grid;
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 14px;
    background: #fff4d6;
    color: #b47d00;
}

.auth-badge svg { width: 26px; height: 26px; }

/* Fields */

.auth-field { margin-bottom: 18px; }

.auth-field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.auth-field__aside {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.auth-label {
    font-size: 13px;
    font-weight: 600;
}

.auth-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--auth-blue-strong);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.auth-link:hover { text-decoration: underline; }

.auth-input {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input > svg {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: #8a99ad;
    pointer-events: none;
}

.auth-input input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 42px;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    outline: 0;
    background: var(--auth-field);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.auth-input input::placeholder { color: #9aa8ba; }

.auth-input input:hover { border-color: #b9c8da; }

.auth-input input:focus {
    border-color: var(--auth-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.14);
}

.auth-input--toggle input { padding-right: 48px; }

.auth-eye {
    position: absolute;
    right: 6px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: none;
    color: #7b8ba0;
    cursor: pointer;
}

.auth-eye:hover { background: #e9eff6; color: var(--auth-ink); }
.auth-eye svg { width: 18px; height: 18px; }
.auth-eye .auth-eye__off,
.auth-eye[aria-pressed="true"] .auth-eye__on { display: none; }
.auth-eye[aria-pressed="true"] .auth-eye__off { display: block; }

/* Buttons */

.auth-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--auth-radius);
    background: var(--auth-blue);
    color: #fff;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.auth-btn:hover { background: var(--auth-blue-strong); box-shadow: 0 8px 20px rgba(29, 78, 216, 0.25); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn[disabled] { cursor: default; opacity: 0.75; box-shadow: none; }

.auth-btn--ghost {
    border-color: var(--auth-line);
    background: #fff;
    color: var(--auth-ink);
}

.auth-btn--ghost:hover { background: var(--auth-field); box-shadow: none; }

.auth-btn.is-loading { color: transparent; }

.auth-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.auth-btn--ghost.is-loading::after { border-color: #c5d1df; border-top-color: var(--auth-blue); }

.auth-actions {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.auth :is(a, button, input):focus-visible {
    outline: 2px solid var(--auth-blue);
    outline-offset: 2px;
}

.auth-input input:focus-visible { outline: 0; }

@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Alerts */

.auth-alert {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    padding: 11px 14px;
    border: 1px solid #f9c3cf;
    border-radius: var(--auth-radius);
    background: #fff1f4;
    color: #a3123a;
    font-size: 13.5px;
    font-weight: 500;
    animation: auth-rise 0.2s ease-out both;
}

.auth-alert::before {
    content: "";
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    margin-top: 8px;
    border-radius: 50%;
    background: currentColor;
}

.auth-alert[data-kind="success"] { border-color: #b4e6d3; background: #ecfbf5; color: #0b7450; }
.auth-alert[data-kind="info"] { border-color: #c6d8fb; background: #eff5ff; color: #1b46b0; }

/* Password rules */

.auth-rules {
    display: grid;
    gap: 7px;
    margin: 4px 0 0;
    padding: 0;
    color: var(--auth-muted);
    font-size: 13px;
    list-style: none;
}

.auth-rules li {
    display: flex;
    align-items: center;
    gap: 9px;
    transition: color 0.15s;
}

.auth-rules li::before {
    content: "";
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 1.5px solid #b9c8da;
    border-radius: 50%;
    transition: background-color 0.15s, border-color 0.15s;
}

.auth-rules li.is-ok { color: #0b7450; }

.auth-rules li.is-ok::before {
    border-color: var(--auth-green);
    background: var(--auth-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 8.3 2.3 2.3 4.7-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}

/* Language switcher */

.auth-lang { position: relative; }

.auth-lang__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.auth-lang__btn:hover { background: var(--auth-field); }
.auth-lang__btn svg { width: 16px; height: 16px; color: var(--auth-muted); }
.auth-lang__btn .auth-lang__chev { width: 14px; height: 14px; transition: transform 0.15s; }
.auth-lang__btn[aria-expanded="true"] .auth-lang__chev { transform: rotate(180deg); }

.auth-lang img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
}

.auth-lang__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 10;
    min-width: 190px;
    max-height: min(60vh, 360px);
    margin: 0;
    padding: 6px;
    overflow: auto;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 35, 64, 0.14);
    list-style: none;
}

.auth-lang__menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.auth-lang__menu button:hover { background: #eff5ff; }
.auth-lang__menu button[aria-current="true"] { color: var(--auth-blue-strong); font-weight: 650; }

.auth-lang__code {
    margin-left: auto;
    color: var(--auth-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
}

/* Store badges */

.auth-main__foot { text-align: center; }

.auth-stores__label {
    margin: 0 0 12px;
    color: var(--auth-muted);
    font-size: 12.5px;
    font-weight: 500;
}

.auth-stores {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.auth-stores a {
    display: block;
    border-radius: 9px;
    line-height: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}

.auth-stores a:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15, 35, 64, 0.18); }
.auth-stores img { width: auto; height: 44px; }

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .auth-shell { flex-direction: column; }

    .auth-hero {
        flex: 0 0 auto;
        padding: 22px 24px 26px;
    }

    .auth-hero__logo { align-self: flex-start; }
    .auth-hero__logo img { height: 38px; }
    .auth-hero__copy { margin-top: 18px; text-align: left; }
    .auth-hero__title { font-size: clamp(18px, 4.6vw, 24px); }
    .auth-scene { display: none; }

    .auth-main {
        flex: 1 1 auto;
        padding: 16px 24px 24px;
        border-radius: 22px 22px 0 0;
        margin-top: -14px;
        position: relative;
    }

    .auth-main__body { align-items: flex-start; padding: 20px 0 28px; }
}

/* Tall tablets have room for the scene. */
@media (min-width: 600px) and (max-width: 991.98px) and (min-height: 860px) {
    .auth-hero { padding-bottom: 14px; }
    .auth-scene { display: flex; flex: 0 0 auto; padding: 12px 0 8px; }
    .auth-scene__svg { max-height: 250px; }
}

@media (hover: none) {
    .auth-scene__zone { cursor: default; }
}

@media (prefers-reduced-motion: reduce) {
    .auth *,
    .auth *::before,
    .auth *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
