/* TPL sign-in. Reproduces the TPL app's AuthMessage screen (MudBlazor paper card, NewBlue palette) without MudBlazor.
   Palette copied from TPL/Client/Shared/Themes/NewBlue.cs. Layout uses flexbox only. */

:root {
    --tpl-primary: #1e597a;
    --tpl-primary-dark: #174660;
    --tpl-secondary: #a8bfcb;
    --tpl-background: #f7f7f8;
    --tpl-surface: #ffffff;
    --tpl-text: #424242;
    --tpl-text-muted: #6b6b6b;
    --tpl-error: #8e1c38;
    --tpl-success: #89ab7e;
    --tpl-radius: 8px;
    --tpl-focus: 0 0 0 2px var(--tpl-surface), 0 0 0 4px var(--tpl-primary);
}

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

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--tpl-background);
    color: var(--tpl-text);
    font-family: Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

/* Decorative squiggles (as in AuthMessage.razor) */
.top-squiggly {
    position: absolute;
    top: 0;
    right: 0;
    pointer-events: none;
    transform: translateX(50%);
    margin-right: -4rem;
    z-index: 0;
}

.bottom-squiggly {
    position: absolute;
    left: 0;
    bottom: 0;
    margin-left: -16rem;
    pointer-events: none;
    z-index: 0;
}

.top-squiggly svg, .bottom-squiggly svg {
    display: block;
    max-width: 100%;
}

.login-box-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

/* MudPaper Elevation="1" Class="rounded login-box" */
.login-box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 450px;
    max-width: 100%;
    background: var(--tpl-surface);
    border-radius: var(--tpl-radius);
    box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
    text-align: center;
}

.login-box .inner {
    padding: 0.5em 2.5em;
}

.indicator {
    display: flex;
    justify-content: center;
    height: 120px;
}

.indicator .mark {
    margin-top: 10px;
    width: 100px;
    height: 100px;
}

h1 {
    margin: 0.5rem 0 1rem;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--tpl-text);
}

h1:focus {
    outline: none;
}

p {
    margin: 0 0 1rem;
}

.message, .intro {
    color: var(--tpl-text);
}

.muted {
    color: var(--tpl-text-muted);
}

form {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.field {
    display: flex;
    flex-direction: column;
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
    text-align: left;
}

.field label, .field legend {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tpl-text);
}

.field-hint {
    margin: 0 0 0.25rem;
    font-size: 0.8125rem;
    color: var(--tpl-text-muted);
}

.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=date],
.field input[type=password],
.field select {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #8a8a8a;
    border-radius: 4px;
    background: var(--tpl-surface);
    color: var(--tpl-text);
    font: inherit;
}

.field input[readonly] {
    background: var(--tpl-background);
}

.field input:focus-visible, .field select:focus-visible {
    border-color: var(--tpl-primary);
    outline: 2px solid var(--tpl-primary);
    outline-offset: 0;
}

.field input[aria-invalid=true], .field select[aria-invalid=true] {
    border-color: var(--tpl-error);
}

.field-error {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--tpl-error);
}

.field-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.field-check input {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--tpl-primary);
}

.field-check label {
    margin: 0;
    font-weight: 400;
}

.choice-group legend {
    padding: 0;
}

.password-control {
    display: flex;
    align-items: stretch;
}

.password-control input {
    flex: 1 1 auto;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.reveal {
    flex: 0 0 auto;
    min-width: 4.5rem;
    padding: 0 0.75rem;
    border: 1px solid #8a8a8a;
    border-left: 0;
    border-radius: 0 4px 4px 0;
    background: var(--tpl-background);
    color: var(--tpl-primary);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
    touch-action: none;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0 1.25rem;
}

/* MudButton Variant.Filled Color.Primary */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.375rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02857em;
    text-transform: uppercase;
    cursor: pointer;
}

.btn-primary {
    background: var(--tpl-primary);
    color: #ffffff;
    box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}

.btn-primary:hover:not(:disabled) {
    background: var(--tpl-primary-dark);
}

.btn-outline {
    background: var(--tpl-surface);
    border-color: var(--tpl-primary);
    color: var(--tpl-primary);
}

.btn-outline:hover:not(:disabled) {
    background: #eef3f6;
}

.btn:disabled, .btn-link:disabled, .reveal:disabled {
    opacity: 0.6;
    cursor: default;
}

.btn-link {
    padding: 0.25rem;
    border: 0;
    background: none;
    color: var(--tpl-primary);
    font: inherit;
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
}

.btn:focus-visible, .btn-link:focus-visible, .reveal:focus-visible, .field-check input:focus-visible {
    outline: 2px solid var(--tpl-primary);
    outline-offset: 2px;
}

.secondary-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.join {
    margin: 0;
}

.method-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.enroll-option + .enroll-option {
    border-top: 1px solid var(--tpl-secondary);
    padding-top: 1rem;
}

.notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--tpl-primary);
    border-radius: 4px;
    background: #eef3f6;
    text-align: left;
}

.notice p {
    margin: 0 0 0.25rem;
}

.alert:not(:empty) {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--tpl-error);
    border-radius: 4px;
    background: #f9edf0;
    color: var(--tpl-error);
    text-align: left;
}

.alert p {
    margin: 0;
}

.reference {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--tpl-text);
    overflow-wrap: anywhere;
    text-align: left;
}

.reference p {
    margin: 0;
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0.5rem auto 1rem;
    border: 4px solid var(--tpl-secondary);
    border-top-color: var(--tpl-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 3s;
    }
}

.rights {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    font-size: 12px;
    color: var(--tpl-text-muted);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

[hidden] {
    display: none !important;
}

@media (max-width: 480px) {
    .login-box .inner {
        padding: 0.5em 1.25em;
    }

    .top-squiggly, .bottom-squiggly {
        display: none;
    }
}
