/* Touch-first kiosk styling (landscape tablets). --brand/--accent come from the tenant branding. */
:root {
    --brand: #1d3f8f;
    --accent: #1d3f8f;
    --text: #15171c;
    --muted: #5d6573;
    --line: #d9dfeb;
    --card: rgba(255, 255, 255, 0.92);
    --danger: #b3261e;
    --radius: 20px;
    --touch: 64px;
    color-scheme: light only;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: #e9eef8;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
}

input {
    -webkit-user-select: text;
    user-select: text;
}

h1 {
    font-size: clamp(2rem, 3.6vw, 3rem);
    line-height: 1.1;
    margin: 0 0 0.75rem;
    letter-spacing: -0.01em;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.15rem;
    margin: 0 0 1rem;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Shell */
.kiosk {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 700px at 15% 10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
        radial-gradient(900px 600px at 90% 95%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        linear-gradient(160deg, #dfe6f4 0%, #f2f5fb 55%, #e4eaf6 100%);
}

.kiosk-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2rem 2.5rem 0;
}

.kiosk-brand {
    border: 0;
    background: none;
    padding: 0;
    min-height: 48px;
    cursor: pointer;
}

.kiosk-brand img {
    max-height: 56px;
    max-width: 220px;
    object-fit: contain;
}

.kiosk-brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand);
}

.kiosk-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2.5rem 2.5rem;
}


.btn-ghost {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--line);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-large {
    min-height: var(--touch);
    padding: 0 2.2rem;
    font-size: 1.3rem;
}

.error {
    color: var(--danger);
    font-weight: 600;
    font-size: 1.1rem;
    margin: 1rem 0 0;
}

/* Options (pairing) */
.option-list {
    display: grid;
    gap: 0.6rem;
    max-height: 46vh;
    overflow-y: auto;
}

.option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-height: var(--touch);
    padding: 0.75rem 1.1rem;
    border-radius: 14px;
    border: 2px solid var(--line);
    background: #fff;
    font-size: 1.15rem;
    text-align: left;
    cursor: pointer;
}

.option.selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent);
}

.option:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.option-title {
    font-weight: 600;
}

.option-hint {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Welcome */
.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.welcome-title {
    font-size: clamp(2.4rem, 4.6vw, 3.8rem);
}

.welcome-subtitle {
    color: var(--muted);
    font-size: 1.35rem;
    margin: 0 0 3rem;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    min-height: 220px;
    padding: 2rem;
    border-radius: 28px;
    background: var(--card);
    box-shadow: 0 20px 50px rgba(20, 30, 60, 0.12);
    transition: transform 0.08s ease;
}

.tile:active {
    transform: scale(0.98);
}

.tile-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--brand) 10%, transparent);
    color: var(--brand);
    margin-bottom: auto;
}

.tile-title {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 1.5rem;
}

.tile-hint {
    color: var(--muted);
    font-size: 1.15rem;
}

.tile-primary {
    background: var(--brand);
    color: #fff;
}

.tile-primary .tile-icon {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.tile-primary .tile-hint {
    color: rgba(255, 255, 255, 0.8);
}

/* Camera */
.camera {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    overflow: hidden;
    background: #0f1420;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-video.mirrored {
    transform: scaleX(-1);
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #fff;
    text-align: center;
    padding: 1rem;
}

.camera-status {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.small-camera {
    max-height: 240px;
}

.manual {
    margin-top: 1.25rem;
}

.manual-row {
    display: flex;
    gap: 0.75rem;
}

/* Confirm & done */
.details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.9rem 1.5rem;
    margin: 0;
    font-size: 1.3rem;
}

.details dt {
    color: var(--muted);
}

.details dd {
    margin: 0;
    font-weight: 600;
}

.details.compact {
    font-size: 0.95rem;
    gap: 0.45rem 1rem;
}

.done {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.done-icon {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--brand) 14%, transparent);
    margin-bottom: 1rem;
}

.done .btn {
    margin-top: 1.5rem;
}

/* Diagnostics */
.diag {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.diag-head {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.diag-head h1 {
    margin: 0;
}

.diag-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.scan-log {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    gap: 0.4rem;
}

@media (max-width: 900px) {

    .question,
    .tiles,
    .diag-grid {
        grid-template-columns: 1fr;
    }

    .question {
        gap: 1.5rem;
    }
}

/* Blazor template infrastructure */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 30vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #d9dfeb;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1d3f8f;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(30vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "");
}

/* Small "n/2" badge under the percentage, distinguishing the WASM download phase (1/2, native,
   set directly in index.html) from the app's own startup data load (2/2, set from Home.razor) -
   so both phases visibly belong to the same overall loading sequence instead of looking like two
   unrelated screens. */
.loading-progress-step {
    position: absolute;
    text-align: center;
    font-size: .8rem;
    opacity: .6;
    inset: calc(30vh + 8rem + 0.75rem) 0 auto 0;
}
