/* SpeedZone Admin - styles for the static account pages (sign-in, invitation, security) and the
   few things MudBlazor does not cover. Colours follow the system light/dark preference here; the
   interactive pages use the MudBlazor theme (MainLayout). */

:root {
    --sz-bg: #f4f6f8;
    --sz-surface: #ffffff;
    --sz-text: #1c2430;
    --sz-muted: #5b6675;
    --sz-border: #d8dee6;
    --sz-primary: #0b6e99;
    --sz-primary-hover: #095a7d;
    --sz-primary-text: #ffffff;
    --sz-danger: #b3261e;
    --sz-danger-bg: #fdecea;
    --sz-success: #1e6b34;
    --sz-success-bg: #e7f5ea;
    --sz-warning: #7a4f01;
    --sz-warning-bg: #fff4e0;
    --sz-info-bg: #e8f3f9;
    --sz-radius: 10px;
    --sz-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --sz-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --sz-bg: #11161c;
        --sz-surface: #1a2129;
        --sz-text: #e6eaef;
        --sz-muted: #9aa5b3;
        --sz-border: #2e3844;
        --sz-primary: #4fb3e0;
        --sz-primary-hover: #74c4e8;
        --sz-primary-text: #06202c;
        --sz-danger: #ffb4ab;
        --sz-danger-bg: #3b1714;
        --sz-success: #9bd8a8;
        --sz-success-bg: #14301c;
        --sz-warning: #ffd08a;
        --sz-warning-bg: #35280f;
        --sz-info-bg: #13303d;
    }
}

html, body {
    margin: 0;
    font-family: var(--sz-font);
}

/* ---- Account layout (static pages) -------------------------------------------------------- */

.account-body {
    min-height: 100vh;
    background: var(--sz-bg);
    color: var(--sz-text);
    display: flex;
    flex-direction: column;
}

.account-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--sz-border);
    background: var(--sz-surface);
}

.account-topbar .brand {
    font-weight: 700;
    color: var(--sz-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-topbar .spacer {
    flex: 1;
}

.account-topbar a {
    color: var(--sz-primary);
}

.account-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem 3rem;
}

.auth-card, .settings-card {
    background: var(--sz-surface);
    border: 1px solid var(--sz-border);
    border-radius: var(--sz-radius);
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    align-self: flex-start;
}

.settings-wrap {
    width: 100%;
    max-width: 60rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

.auth-card h1, .settings-wrap h1 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
}

.muted {
    color: var(--sz-muted);
}

.small {
    font-size: 0.875rem;
}

.account-body label {
    display: block;
    font-weight: 600;
    margin: 1rem 0 0.35rem;
}

.account-body input[type=text], .account-body input[type=search], .account-body input:not([type]) {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--sz-border);
    border-radius: 8px;
    background: var(--sz-bg);
    color: var(--sz-text);
    font: inherit;
}

.account-body input:focus-visible, .account-body button:focus-visible, .account-body a:focus-visible {
    outline: 3px solid var(--sz-primary);
    outline-offset: 2px;
}

.hint {
    font-size: 0.85rem;
    color: var(--sz-muted);
    margin-top: 0.3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--sz-border);
    background: var(--sz-surface);
    color: var(--sz-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    border-color: var(--sz-primary);
}

.btn.primary {
    background: var(--sz-primary);
    border-color: var(--sz-primary);
    color: var(--sz-primary-text);
}

.btn.primary:hover {
    background: var(--sz-primary-hover);
}

.btn.danger {
    color: var(--sz-danger);
}

.btn.block {
    width: 100%;
    margin-top: 1.25rem;
}

.btn.small {
    padding: 0.35rem 0.7rem;
    font-size: 0.875rem;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: var(--sz-info-bg);
}

.alert.error {
    background: var(--sz-danger-bg);
    color: var(--sz-danger);
}

.alert.success {
    background: var(--sz-success-bg);
    color: var(--sz-success);
}

.alert.warning {
    background: var(--sz-warning-bg);
    color: var(--sz-warning);
}

.alt {
    margin-top: 1.5rem;
    text-align: center;
}

.alt a, .settings-card a {
    color: var(--sz-primary);
}

.radio-row {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.account-body .radio-row label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
    margin: 0;
}

table.list {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.925rem;
}

table.list th, table.list td {
    text-align: left;
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid var(--sz-border);
    vertical-align: middle;
}

table.list th {
    color: var(--sz-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

table.list form {
    display: inline;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--sz-info-bg);
    color: var(--sz-text);
}

.badge.ok {
    background: var(--sz-success-bg);
    color: var(--sz-success);
}

.badge.off {
    background: var(--sz-bg);
    color: var(--sz-muted);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
    margin-top: 1rem;
}

.inline-form > div {
    flex: 1 1 14rem;
}

.account-body .inline-form label {
    margin-top: 0;
}

.code-list {
    columns: 2;
    font-family: var(--sz-mono);
    font-size: 1.05rem;
    padding-left: 1.5rem;
}

.code-list li {
    margin: 0.2rem 0;
}

.qr {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    margin: 1rem 0;
}

.qr .qr-image {
    background: #ffffff;
    padding: 0.5rem;
    border-radius: 8px;
    width: 12rem;
    height: 12rem;
}

.qr .qr-image svg {
    width: 100%;
    height: 100%;
}

.secret {
    font-family: var(--sz-mono);
    font-size: 1.05rem;
    word-break: break-all;
}

.table-scroll {
    overflow-x: auto;
}

/* ---- Interactive pages ---------------------------------------------------------------------- */

.sz-mono {
    font-family: var(--sz-mono);
}

.sz-details {
    font-family: var(--sz-mono);
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
    white-space: normal;
    word-break: break-word;
}

.sz-drawer-footer {
    padding: 1rem;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.logout-form {
    display: inline;
    margin: 0;
}

[data-copied="true"]::after {
    content: " ✓";
}

/* ---- Reconnection dialog (from the ASP.NET Core template) ----------------------------------- */

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal {
    background-color: var(--sz-surface);
    color: var(--sz-text);
    width: 20rem;
    margin: 20vh auto;
    padding: 2rem;
    border: 0;
    border-radius: 0.5rem;
    box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
}

#components-reconnect-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.4);
}

.components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#components-reconnect-modal p {
    margin: 0;
    text-align: center;
}

#components-reconnect-modal button {
    border: 0;
    background-color: var(--sz-primary);
    color: var(--sz-primary-text);
    padding: 0.4rem 1.5rem;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
}

.components-rejoining-animation {
    position: relative;
    width: 80px;
    height: 80px;
}

.components-rejoining-animation div {
    position: absolute;
    border: 3px solid var(--sz-primary);
    opacity: 1;
    border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes components-rejoining-animation {
    0%, 4.9% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    5% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        top: 0;
        left: 0;
        width: 80px;
        height: 80px;
        opacity: 0;
    }
}

@media (max-width: 600px) {
    .auth-card, .settings-card {
        padding: 1.25rem;
    }

    .code-list {
        columns: 1;
    }
}

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

/* MudBlazor's CSS reset removes paragraph and list spacing; the static pages need it back. */
.auth-card p, .settings-card p, .settings-wrap > div > p {
    margin: 0.5rem 0;
}

.auth-card ol, .settings-card ol, .auth-card ul, .settings-card ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.auth-card ol li, .settings-card ol li {
    margin: 0.2rem 0;
}

.settings-card h2 + p {
    margin-top: 0.25rem;
}

/* FocusOnNavigate moves focus to the page heading for screen readers; no visible ring for that. */
h1:focus, h1:focus-visible {
    outline: none;
}

table.list td:last-child {
    white-space: nowrap;
    text-align: right;
}

.sz-nowrap {
    white-space: nowrap;
}

.sz-details {
    display: inline-block;
    max-width: 22rem;
}

.sz-title {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .sz-title-suffix {
        display: none;
    }
}
