/* FaciliateGateway — shared stylesheet for the public browser pages
   (login, MFA, realm/role select, change-password, profile, TOTP setup,
   success/cancel/error, OIDC completion).

   Mirrors the Admin portal design tokens in
   FaciliateGateway.Admin/wwwroot/css/app.css so both surfaces share one
   brand identity. Brand primary is #3eb1c8 (cyan-teal); because white text
   on #3eb1c8 fails WCAG AA, filled buttons use the darker --color-primary-strong. */

:root {
    /* Brand — teal (mirrors Admin app.css / "Admin Design System") */
    --color-primary: #3eb1c8;          /* accent: focus rings, links, active states */
    --color-primary-strong: #1f8499;   /* button fills with white text (WCAG AA) */
    --color-primary-hover: #186b7d;    /* button hover */
    --color-primary-soft: #eef9fb;     /* tint backgrounds */

    /* Semantic — refined 600-level */
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;

    /* Text — slate scale */
    --text: #1e293b;
    --text-muted: #64748b;
    --text-hint: #94a3b8;
    --text-label: #475569;

    /* Surfaces */
    --bg-page: #f6f8fa;
    --bg-surface: #fff;
    --bg-subtle: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-light: #eef2f6;

    /* Shape */
    --radius-input: 6px;
    --radius-button: 8px;
    --radius-card: 12px;
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-card-lg: 0 4px 16px rgba(15, 23, 42, 0.10);

    /* Type */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Status pastels (match Admin badge/alert palette) */
    --success-bg: #dcfce7; --success-fg: #166534;
    --danger-bg: #fee2e2;  --danger-fg: #991b1b;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Top-aligned, scrolling pages (profile, TOTP setup) opt out of centering */
body.scroll {
    display: block;
    padding: 20px;
}

/* ---- Containers ---- */
.auth-card {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}
.auth-card.wide { max-width: 520px; }
.auth-card.terminal { text-align: center; }
.auth-card.terminal h1 { font-size: 20px; margin-bottom: 8px; }

.container {
    max-width: 600px;
    margin: 0 auto;
}
.panel {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-bottom: 16px;
}

/* ---- Headings ---- */
h1 { text-align: center; color: var(--text); margin-bottom: 16px; font-size: 24px; }
.subtitle { text-align: center; color: var(--text-hint); margin-bottom: 24px; font-size: 14px; }
.auth-card h2, .panel h2 { font-size: 18px; margin: 0 0 16px; color: var(--text); text-align: left; }

/* Scrolling pages: left-aligned page title */
body.scroll h1 { text-align: left; margin: 0 0 24px; }

.profile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.profile-header h1 { margin: 0; }
.link-signout { color: var(--color-danger); text-decoration: none; font-size: 14px; }
.link-signout:hover { color: var(--color-danger-hover); }

/* ---- Forms ---- */
label { display: block; margin-bottom: 4px; font-weight: 600; color: var(--text-label); font-size: 14px; }
.form-group { margin-bottom: 12px; }
.form-group input,
input[type=text],
input[type=password] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
input[type=text]:focus,
input[type=password]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(62, 177, 200, 0.25);
}
.code-input {
    width: 100%;
    max-width: 240px;
    margin: 0 auto 12px;
    display: block;
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
}

/* TOTP enrolment QR code. The SVG is rendered server-side and carries a viewBox but no
   width/height, so it is sized here rather than by the markup that embeds it. */
.qr-code {
    display: inline-block;
    margin: 12px 0;
}
.qr-code svg {
    width: 200px;
    height: 200px;
    display: block;
}

/* Profile panels stack label/input pairs directly (no .form-group), so inputs
   carry their own bottom spacing. */
.panel input[type=text],
.panel input[type=password] { margin-bottom: 12px; }

/* ---- Buttons ---- */
/* Primary (compact, inline) — profile update/change, TOTP setup */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-input);
    background: var(--color-primary-strong);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn:hover { background: var(--color-primary-hover); }

/* Primary (full width) — login, change-password, MFA verify */
.local-button, .submit-button {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-input);
    background: var(--color-primary-strong);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}
.local-button:hover, .submit-button:hover { background: var(--color-primary-hover); }

/* Outline primary — passkey */
.btn-passkey {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-primary-strong);
    border-radius: var(--radius-input);
    background: var(--bg-surface);
    color: var(--color-primary-strong);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-passkey:hover { background: var(--color-primary-soft); }

/* Danger (compact) — delete passkey / disable TOTP */
.btn-danger {
    display: inline-block;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-input);
    background: var(--color-danger);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}
.btn-danger:hover { background: var(--color-danger-hover); }

/* Neutral choice buttons — IdP / realm / role selection */
.idp-button, .realm-button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--bg-surface);
    color: var(--text);
    text-decoration: none;
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.idp-button:hover, .realm-button:hover { background: var(--bg-subtle); }
.realm-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    text-align: left;
}
.realm-name { font-weight: 500; }
.realm-env { font-size: 12px; color: var(--text-hint); text-transform: uppercase; }

/* ---- Divider ---- */
.divider { text-align: center; margin: 20px 0; color: var(--text-hint); font-size: 13px; }
.divider span { background: var(--bg-surface); padding: 0 10px; }

/* ---- Banners / alerts ---- */
.error-message {
    background: var(--danger-bg);
    border: 1px solid #f5c6cb;
    color: var(--danger-fg);
    padding: 10px 14px;
    border-radius: var(--radius-input);
    margin-bottom: 16px;
    font-size: 14px;
}
.realm-info {
    background: var(--color-primary-soft);
    border: 1px solid #bfe6ee;
    color: #155e6b;
    padding: 10px 14px;
    border-radius: var(--radius-input);
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
}
.alert { padding: 10px 14px; border-radius: var(--radius-input); margin-bottom: 12px; font-size: 14px; }
.alert-success { background: var(--success-bg); color: var(--success-fg); }
.alert-danger { background: var(--danger-bg); color: var(--danger-fg); }

/* ---- Terminal status icon (success / cancel / error pages) ---- */
.status-icon { font-size: 48px; margin-bottom: 16px; text-align: center; }
.status-icon.is-success { color: var(--color-success); }
.status-icon.is-danger { color: var(--color-danger); }
.status-icon.is-muted { color: var(--text-hint); }

/* ---- Badges (profile MFA status) ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-on { background: var(--success-bg); color: var(--success-fg); }
.badge-off { background: var(--danger-bg); color: var(--danger-fg); }

/* ---- Info text, code, tables ---- */
.info { color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
p { color: var(--text-muted); }
.auth-card.terminal p { margin-top: 8px; }
code { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border-light); font-size: 14px; }

a { color: var(--color-primary-strong); }

.cancel-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--text-hint);
    font-size: 13px;
    text-decoration: none;
}
.cancel-link:hover { color: var(--text-muted); }

/* ---- Language selector ---- */
.lang-select-wrap { text-align: center; margin-top: 16px; }
.lang-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-surface);
    cursor: pointer;
}
