/* Sign-in and first-time setup pages (Login.razor, Setup.razor), as IMS_rtms's sign-in page:
   a brand panel on the left, the form on the right. */
.login-page {
    /* The logo's colours: deep blue background, blue -> cyan -> green ring. */
    --brand-navy: #061266;
    --brand-navy-2: #0b2291;
    --brand-blue: #2f6bff;
    --brand-accent: #3ee0c8;
    --brand-field: #f1f5f8;
    --brand-text: #0f2742;
    --brand-muted: #6b7a87;
    --brand-card: #ffffff;
    --brand-page: #e9eef2;

    flex: 1 1 auto;
    width: 100%;
    /* <body> doesn't scroll (overflow: hidden): this page does, when the form is taller than the window. */
    height: 100vh;
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--brand-page);
    overflow-y: auto;
}

.login-shell {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 900px;
    min-height: 520px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--brand-card);
    box-shadow: 0 20px 50px rgba(15, 39, 66, .18);
}

.login-shell.wide {
    max-width: 1080px;
}

/* ---------- Left: brand panel ---------- */
.login-brand {
    position: relative;
    flex: 0 0 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(160deg, var(--brand-navy-2) 0%, var(--brand-navy) 50%, #040b3b 100%);
    transition: flex-basis .6s cubic-bezier(.65, 0, .35, 1);
}

.login-shell.wide .login-brand {
    flex-basis: 32%;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    text-align: center;
}

.login-brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: .02em;
}

/* The app icon (assets/media/logo), with a soft glow on the dark panel. */
.login-logo {
    width: 64px;
    height: 64px;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .08);
}

.login-brand-text {
    max-width: 260px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .8);
    transition: opacity .2s ease;
}

.shape {
    position: absolute;
    pointer-events: none;
}

.shape-circle {
    width: 260px;
    height: 260px;
    left: -90px;
    bottom: -90px;
    border-radius: 50%;
    background: var(--brand-blue);
    opacity: .3;
}

.shape-diamond {
    width: 46px;
    height: 46px;
    top: 48px;
    right: 64px;
    transform: rotate(45deg);
    background: var(--brand-accent);
    opacity: .25;
}

.shape-diamond-sm {
    width: 26px;
    height: 26px;
    bottom: 70px;
    right: 40px;
    transform: rotate(45deg);
    background: var(--brand-accent);
    opacity: .3;
}

/* ---------- Right: form ---------- */
.login-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 48px 32px;
    transition: opacity .25s ease, padding .6s cubic-bezier(.65, 0, .35, 1);
}

.login-form > * {
    width: 100%;
    max-width: 320px;
}

.login-title {
    margin: 0;
    text-align: center;
    font-size: 30px;
    font-weight: 700;
    color: var(--brand-blue);
}

.login-subtitle {
    margin: -6px 0 6px;
    text-align: center;
    font-size: 13px;
    color: var(--brand-muted);
}

.login-error,
.login-info {
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
}

.login-error {
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

.login-info {
    border: 1px solid #86efac;
    background: #f0fdf4;
    color: #166534;
}

.login-field {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: var(--brand-field);
    color: var(--brand-muted);
    cursor: text;
    transition: border-color .15s, box-shadow .15s;
}

.login-field:focus-within {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(108, 180, 255, .25);
}

.login-field input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 14px;
    color: var(--brand-text);
}

.login-field input::placeholder {
    color: var(--brand-muted);
}

/* A value the browser filled in keeps the field's own colour. */
.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--brand-field) inset;
    -webkit-text-fill-color: var(--brand-text);
    caret-color: var(--brand-text);
}

.login-form .validation-message {
    margin-top: -8px;
    font-size: 12px;
    color: #b91c1c;
}

.login-eye {
    display: flex;
    align-items: center;
    border: 0;
    background: transparent;
    color: var(--brand-muted);
    cursor: pointer;
    padding: 4px;
}

.password-icon-hide {
    display: none;
}

.active[data-kt-toggle-password-initialized] .password-icon-show {
    display: none;
}

.active[data-kt-toggle-password-initialized] .password-icon-hide {
    display: block;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--brand-muted);
    cursor: pointer;
}

.login-submit {
    width: 200px !important;
    height: 46px;
    margin-top: 12px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-navy-2), var(--brand-blue));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(27, 63, 107, .3);
    transition: filter .15s, transform .2s ease, box-shadow .2s ease, letter-spacing .2s ease;
    position: relative;
    overflow: hidden;
}

.login-submit.wide {
    width: 280px !important;
}

/* Hover: the button lifts, its shadow grows, the letters spread a little and a light sweeps across it once. */
.login-submit::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}

.login-submit:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(27, 63, 107, .4);
    letter-spacing: .16em;
}

.login-submit:hover::after {
    left: 125%;
    transition: left .6s ease;
}

.login-submit:active {
    transform: translateY(1px);
}

/* ---------- Setup: two groups of fields in two columns ---------- */
.setup-form > * {
    max-width: 560px;
}

.setup-group-title {
    margin: 6px 0 -4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-muted);
}

.setup-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.setup-fields > div {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- Signing in ----------
   The form was sent (.signing-in on .login-shell, App.razor's script): the brand panel widens over the form and
   shows "Signing in" with three bouncing dots until the app opens. */
.login-signing {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: opacity .3s ease .35s;
}

.login-signing-text {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .85);
}

.login-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-accent);
}

.login-shell.signing-in .login-brand {
    flex-basis: 100%;
}

.login-shell.signing-in .login-form {
    flex: 0 0 0;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.login-shell.signing-in .login-brand-text {
    height: 0;
    margin: 0;
    opacity: 0;
    overflow: hidden;
}

.login-shell.signing-in .login-signing {
    height: 20px;
    opacity: 1;
}

.login-shell.signing-in .login-dot {
    animation: login-bounce 1s ease-in-out infinite;
}

.login-shell.signing-in .login-dot:nth-child(2) {
    animation-delay: .15s;
}

.login-shell.signing-in .login-dot:nth-child(3) {
    animation-delay: .3s;
}

.login-shell.signing-in .shape-circle {
    animation: login-pulse 2.4s ease-in-out infinite;
}

.login-shell.signing-in .shape-diamond,
.login-shell.signing-in .shape-diamond-sm {
    animation: login-spin 3s linear infinite;
}

@keyframes login-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .5; }
    40% { transform: translateY(-7px); opacity: 1; }
}

@keyframes login-pulse {
    0%, 100% { transform: scale(1); opacity: .3; }
    50% { transform: scale(1.15); opacity: .45; }
}

@keyframes login-spin {
    from { transform: rotate(45deg); }
    to { transform: rotate(405deg); }
}

@media (prefers-reduced-motion: reduce) {
    .login-brand,
    .login-form,
    .login-signing,
    .login-submit,
    .login-submit:hover::after {
        transition: none;
    }

    .login-submit:hover {
        transform: none;
    }

    .login-submit::after,
    .login-shell.signing-in .login-dot,
    .login-shell.signing-in .shape {
        animation: none;
    }
}

/* ---------- Phone: stacked ---------- */
@media (max-width: 720px) {
    .login-shell {
        flex-direction: column;
        min-height: 0;
    }

    /* The decorative diamonds would sit behind the name on a narrow panel. */
    .shape-diamond,
    .shape-diamond-sm {
        display: none;
    }

    .login-brand {
        flex: none;
        padding: 32px 24px;
    }

    .login-form {
        padding: 32px 20px;
    }

    .setup-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Language switch: a small segmented control in the card's top-right corner ---------- */
.login-language {
    position: absolute;
    top: 16px;
    right: 18px;
    display: inline-flex;
    padding: 2px;
    border-radius: 999px;
    background: #f1f4f9;
    border: 1px solid #e3e8f0;
    z-index: 2;
}

.login-language button {
    min-width: 34px;
    padding: 3px 9px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #78829d;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.login-language button:hover {
    color: #1b84ff;
}

.login-language button.active {
    background: #fff;
    color: #1b84ff;
    box-shadow: 0 1px 3px rgba(15, 39, 66, .12);
}

.dark .login-language {
    background: #1b1f2a;
    border-color: #2a3040;
}

.dark .login-language button.active {
    background: #2a3040;
}
