/* The id host's own pages (Pages/IdHostShared/_IdHostLayout.cshtml). Every colour is a brand token. */

.idhost-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--surface-alt);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.idhost-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background-color: var(--surface);
    border-bottom: 4px solid var(--brand-primary);
}

.idhost-logo {
    height: 32px;
    width: auto;
}

.idhost-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 30rem;
    margin: 0 auto;
    padding: 32px 16px;
}

.idhost-main:focus {
    outline: none;
}

.idhost-card {
    padding: 24px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.idhost-card h1 {
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.idhost-help {
    margin-top: 16px;
    color: var(--muted);
}

.idhost-footer {
    padding: 16px 24px;
    text-align: center;
    color: var(--muted);
}

/* Skip link: off screen until it receives keyboard focus (WCAG 2.4.1). */
.skip-link {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 2000;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    width: auto;
    height: auto;
    margin: 0;
    padding: 10px 16px;
    overflow: visible;
    clip: auto;
    background-color: var(--surface);
    color: var(--text);
    font-weight: 600;
    border: 2px solid var(--focus-ring);
    border-radius: 4px;
}

.idhost-body :focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Form fields and the primary action use the brand's accessible colours rather than Bootstrap's defaults. */
.idhost-card .form-control {
    border-color: var(--input-border);
}

.idhost-card .btn-primary {
    --bs-btn-bg: var(--text);
    --bs-btn-border-color: var(--text);
    --bs-btn-color: var(--surface);
    --bs-btn-hover-bg: var(--text);
    --bs-btn-hover-border-color: var(--text);
    --bs-btn-hover-color: var(--surface);
    --bs-btn-active-bg: var(--text);
    --bs-btn-active-border-color: var(--text);
    --bs-btn-active-color: var(--surface);
    --bs-btn-focus-shadow-rgb: var(--focus-ring-rgb);
}

.idhost-card .btn-outline-secondary {
    --bs-btn-color: var(--text);
    --bs-btn-border-color: var(--input-border);
    --bs-btn-hover-bg: var(--surface-alt);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-border-color: var(--text);
    --bs-btn-active-bg: var(--surface-alt);
    --bs-btn-active-color: var(--text);
}

.idhost-card .alert-danger {
    --bs-alert-bg: var(--danger-surface);
    --bs-alert-color: var(--text);
    --bs-alert-border-color: var(--danger);
}

/* The passkey button under the password form (shown by platform-passkeys.js when the browser supports passkeys). */
.idhost-passkey {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--input-border);
}

.idhost-passkey .idhost-status-error {
    color: var(--text);
    font-weight: 600;
}

/* Enrolment (Pages/Staff/Enrol.cshtml): stacked cards, the numbered set-up steps, the QR code and the key. */
.idhost-section {
    margin-top: 16px;
}

.idhost-section h2 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.idhost-steps {
    padding-left: 1.25rem;
}

.idhost-steps > li {
    margin-bottom: 1rem;
}

/* The QR code keeps black on white whatever the palette: a scanner needs the contrast. */
.idhost-qr {
    display: inline-block;
    padding: 8px;
    background-color: var(--surface);
    border: 1px solid var(--input-border);
    border-radius: 4px;
}

.idhost-qr svg {
    display: block;
    width: 12rem;
    height: 12rem;
}

/* A problem with one field of a form (self-service registration): text colour from the palette, the danger colour only as the bar beside it. */
.idhost-card .form-control[aria-invalid="true"] {
    border-color: var(--danger);
    border-width: 2px;
}

.idhost-field-error {
    margin-top: 4px;
    padding-left: 8px;
    border-left: 4px solid var(--danger);
    color: var(--text);
}

.idhost-key {
    font-family: Consolas, 'Courier New', monospace;
    letter-spacing: 0.05em;
}

.idhost-signout {
    margin-top: 16px;
}

/* The consent screen (Pages/Connect/_ConsentBody.cshtml) of /connect/authorize and /connect/device. */
.consent-calls-itself {
    margin-top: -8px;
    font-size: 0.875rem;
    color: var(--muted);
}

/* The facts box right under the heading: who asks, where the answer goes, how old the registration and the installation are. */
.consent-facts {
    margin: 0 0 16px;
    padding: 12px 16px 12px 32px;
    background-color: var(--surface-alt);
    border: 1px solid var(--input-border);
    border-left: 4px solid var(--brand-primary);
    border-radius: 4px;
    font-weight: 600;
}

.consent-permissions > li {
    margin-bottom: 4px;
}

.consent-sensitive {
    margin-left: 4px;
    background-color: var(--text);
    color: var(--surface);
}

.consent-section {
    margin-top: 16px;
}

.consent-section h2,
.consent-section legend {
    font-size: 1.1rem;
    font-weight: 600;
}

.consent-alert {
    --bs-alert-bg: var(--surface-alt);
    --bs-alert-color: var(--text);
    --bs-alert-border-color: var(--input-border);
}

.consent-no-expiry {
    margin-top: 8px;
    font-weight: 600;
}

/* "All …, including future ones": while it is ticked the single picks are hidden; unticked, they and the note appear. The
   all-resources confirmation shows only while "all" is ticked. CSS only: the id host runs no script here. */
.consent-resources > .consent-all {
    margin-right: 8px;
}

.consent-all:checked ~ .consent-picks,
.consent-all:not(:checked) ~ .consent-all-confirm {
    display: none;
}

.consent-all-confirm,
.consent-picks {
    margin-top: 8px;
    padding-left: 24px;
}

.consent-note {
    font-weight: 600;
}

.consent-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Native checkboxes and radios: Bootstrap draws the tick as a data: SVG background, which the id host's img-src 'self' refuses (and
   the box would then look empty when ticked). The browser's own control needs no image and keeps its focus ring. */
.idhost-card .form-check-input {
    appearance: auto;
    -webkit-appearance: auto;
    background-image: none;
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--text);
}
